# HG changeset patch # User Sebastien Jodogne # Date 1480422538 -3600 # Node ID 08f30c8962a761ff2d90869f433461066223b2d4 # Parent fcc3be30b1169d538698648364578f3663123f8b sync diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Core/SystemToolbox.cpp --- a/Orthanc/Core/SystemToolbox.cpp Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Core/SystemToolbox.cpp Tue Nov 29 13:28:58 2016 +0100 @@ -35,30 +35,45 @@ #if BOOST_HAS_DATE_TIME == 1 -#include +# include #endif #if defined(_WIN32) -#include -#include // For "_spawnvp()" and "_getpid()" +# include +# include // For "_spawnvp()" and "_getpid()" #else -#include // For "execvp()" -#include // For "waitpid()" +# include // For "execvp()" +# include // For "waitpid()" #endif + #if defined(__APPLE__) && defined(__MACH__) -#include /* _NSGetExecutablePath */ -#include /* PATH_MAX */ +# include /* _NSGetExecutablePath */ +# include /* PATH_MAX */ #endif + #if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) -#include /* PATH_MAX */ -#include -#include +# include /* PATH_MAX */ +# include +# include #endif +// Inclusions for UUID +// http://stackoverflow.com/a/1626302 + +extern "C" +{ +#ifdef WIN32 +# include +#else +# include +#endif +} + + #include "Logging.h" #include "OrthancException.h" #include "Toolbox.h" @@ -477,6 +492,28 @@ } + std::string SystemToolbox::GenerateUuid() + { +#ifdef WIN32 + UUID uuid; + UuidCreate ( &uuid ); + + unsigned char * str; + UuidToStringA ( &uuid, &str ); + + std::string s( ( char* ) str ); + + RpcStringFreeA ( &str ); +#else + uuid_t uuid; + uuid_generate_random ( uuid ); + char s[37]; + uuid_unparse ( uuid, s ); +#endif + return s; + } + + #if BOOST_HAS_DATE_TIME == 1 std::string SystemToolbox::GetNowIsoString() { diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Core/SystemToolbox.h --- a/Orthanc/Core/SystemToolbox.h Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Core/SystemToolbox.h Tue Nov 29 13:28:58 2016 +0100 @@ -90,6 +90,8 @@ FILE* OpenFile(const std::string& path, FileMode mode); + std::string GenerateUuid(); + #if BOOST_HAS_DATE_TIME == 1 std::string GetNowIsoString(); diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Core/Toolbox.cpp --- a/Orthanc/Core/Toolbox.cpp Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Core/Toolbox.cpp Tue Nov 29 13:28:58 2016 +0100 @@ -77,18 +77,9 @@ #endif - -// Inclusions for UUID -// http://stackoverflow.com/a/1626302 - -extern "C" -{ -#ifdef WIN32 -# include -#else -# include +#if defined(_WIN32) +# include // For ::Sleep #endif -} #if ORTHANC_ENABLE_PUGIXML == 1 @@ -1226,28 +1217,6 @@ } - std::string Toolbox::GenerateUuid() - { -#ifdef WIN32 - UUID uuid; - UuidCreate ( &uuid ); - - unsigned char * str; - UuidToStringA ( &uuid, &str ); - - std::string s( ( char* ) str ); - - RpcStringFreeA ( &str ); -#else - uuid_t uuid; - uuid_generate_random ( uuid ); - char s[37]; - uuid_unparse ( uuid, s ); -#endif - return s; - } - - bool Toolbox::IsUuid(const std::string& str) { if (str.size() != 36) diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Core/Toolbox.h --- a/Orthanc/Core/Toolbox.h Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Core/Toolbox.h Tue Nov 29 13:28:58 2016 +0100 @@ -204,8 +204,6 @@ const std::string& key, unsigned int defaultValue); - std::string GenerateUuid(); - bool IsUuid(const std::string& str); bool StartsWithUuid(const std::string& str); diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Resources/CMake/BoostConfiguration.cmake --- a/Orthanc/Resources/CMake/BoostConfiguration.cmake Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Resources/CMake/BoostConfiguration.cmake Tue Nov 29 13:28:58 2016 +0100 @@ -43,7 +43,7 @@ set(BOOST_NAME boost_1_60_0) set(BOOST_BCP_SUFFIX bcpdigest-1.0.1) set(BOOST_MD5 "a789f8ec2056ad1c2d5f0cb64687cc7b") - set(BOOST_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz") + set(BOOST_URL "http://www.orthanc-server.com/downloads/third-party/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz") set(BOOST_FILESYSTEM_SOURCES_DIR "${BOOST_NAME}/libs/filesystem/src") set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME}) diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Resources/CMake/Compiler.cmake --- a/Orthanc/Resources/CMake/Compiler.cmake Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Resources/CMake/Compiler.cmake Tue Nov 29 13:28:58 2016 +0100 @@ -164,6 +164,23 @@ endif() +if (DEFINED ENABLE_PROFILING AND ENABLE_PROFILING) + if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + message(WARNING "Enabling profiling on a non-debug build will not produce full information") + endif() + + if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pg") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") + else() + message(FATAL_ERROR "Don't know how to enable profiling on your configuration") + endif() +endif() + + if (STATIC_BUILD) add_definitions(-DORTHANC_STATIC=1) else() diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Resources/CMake/GoogleTestConfiguration.cmake --- a/Orthanc/Resources/CMake/GoogleTestConfiguration.cmake Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Resources/CMake/GoogleTestConfiguration.cmake Tue Nov 29 13:28:58 2016 +0100 @@ -1,15 +1,32 @@ if (USE_GTEST_DEBIAN_SOURCE_PACKAGE) - set(GTEST_SOURCES /usr/src/gtest/src/gtest-all.cc) - include_directories(/usr/src/gtest) + find_path(GTEST_DEBIAN_SOURCES_DIR + NAMES src/gtest-all.cc + PATHS + /usr/src/gtest + /usr/src/googletest/googletest + PATH_SUFFIXES src + ) - if (NOT EXISTS /usr/include/gtest/gtest.h OR - NOT EXISTS ${GTEST_SOURCES}) + find_path(GTEST_DEBIAN_INCLUDE_DIR + NAMES gtest.h + PATHS + /usr/include/gtest + ) + + message("Path to the Debian Google Test sources: ${GTEST_DEBIAN_SOURCES_DIR}") + message("Path to the Debian Google Test includes: ${GTEST_DEBIAN_INCLUDE_DIR}") + + set(GTEST_SOURCES ${GTEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc) + include_directories(${GTEST_DEBIAN_SOURCES_DIR}) + + if (NOT EXISTS ${GTEST_SOURCES} OR + NOT EXISTS ${GTEST_DEBIAN_INCLUDE_DIR}/gtest.h) message(FATAL_ERROR "Please install the libgtest-dev package") endif() elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST) set(GTEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0) - set(GTEST_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/gtest-1.7.0.zip") + set(GTEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip") set(GTEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7") DownloadPackage(${GTEST_MD5} ${GTEST_URL} "${GTEST_SOURCES_DIR}") diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Resources/CMake/JsonCppConfiguration.cmake --- a/Orthanc/Resources/CMake/JsonCppConfiguration.cmake Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Resources/CMake/JsonCppConfiguration.cmake Tue Nov 29 13:28:58 2016 +0100 @@ -1,6 +1,6 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_JSONCPP) set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.5) - set(JSONCPP_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/jsoncpp-0.10.5.tar.gz") + set(JSONCPP_URL "http://www.orthanc-server.com/downloads/third-party/jsoncpp-0.10.5.tar.gz") set(JSONCPP_MD5 "db146bac5a126ded9bd728ab7b61ed6b") DownloadPackage(${JSONCPP_MD5} ${JSONCPP_URL} "${JSONCPP_SOURCES_DIR}") diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Resources/CMake/SQLiteConfiguration.cmake --- a/Orthanc/Resources/CMake/SQLiteConfiguration.cmake Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Resources/CMake/SQLiteConfiguration.cmake Tue Nov 29 13:28:58 2016 +0100 @@ -17,7 +17,7 @@ if (SQLITE_STATIC) SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300) SET(SQLITE_MD5 "5fbeff9645ab035a1f580e90b279a16d") - SET(SQLITE_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/sqlite-amalgamation-3071300.zip") + SET(SQLITE_URL "http://www.orthanc-server.com/downloads/third-party/sqlite-amalgamation-3071300.zip") DownloadPackage(${SQLITE_MD5} ${SQLITE_URL} "${SQLITE_SOURCES_DIR}") diff -r fcc3be30b116 -r 08f30c8962a7 Orthanc/Resources/EmbedResources.py --- a/Orthanc/Resources/EmbedResources.py Wed Nov 16 21:08:01 2016 +0100 +++ b/Orthanc/Resources/EmbedResources.py Tue Nov 29 13:28:58 2016 +0100 @@ -159,6 +159,10 @@ #include #include +#if defined(_MSC_VER) +# pragma warning(disable: 4065) // "Switch statement contains 'default' but no 'case' labels" +#endif + namespace %s { namespace EmbeddedResources