changeset 155:08f30c8962a7

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Nov 2016 13:28:58 +0100
parents fcc3be30b116
children 9e5358dd4dca
files Orthanc/Core/SystemToolbox.cpp Orthanc/Core/SystemToolbox.h Orthanc/Core/Toolbox.cpp Orthanc/Core/Toolbox.h Orthanc/Resources/CMake/BoostConfiguration.cmake Orthanc/Resources/CMake/Compiler.cmake Orthanc/Resources/CMake/GoogleTestConfiguration.cmake Orthanc/Resources/CMake/JsonCppConfiguration.cmake Orthanc/Resources/CMake/SQLiteConfiguration.cmake Orthanc/Resources/EmbedResources.py
diffstat 10 files changed, 97 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- 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 <boost/date_time/posix_time/posix_time.hpp>
+#  include <boost/date_time/posix_time/posix_time.hpp>
 #endif
 
 
 #if defined(_WIN32)
-#include <windows.h>
-#include <process.h>   // For "_spawnvp()" and "_getpid()"
+#  include <windows.h>
+#  include <process.h>   // For "_spawnvp()" and "_getpid()"
 #else
-#include <unistd.h>    // For "execvp()"
-#include <sys/wait.h>  // For "waitpid()"
+#  include <unistd.h>    // For "execvp()"
+#  include <sys/wait.h>  // For "waitpid()"
 #endif
 
+
 #if defined(__APPLE__) && defined(__MACH__)
-#include <mach-o/dyld.h> /* _NSGetExecutablePath */
-#include <limits.h>      /* PATH_MAX */
+#  include <mach-o/dyld.h> /* _NSGetExecutablePath */
+#  include <limits.h>      /* PATH_MAX */
 #endif
 
+
 #if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
-#include <limits.h>      /* PATH_MAX */
-#include <signal.h>
-#include <unistd.h>
+#  include <limits.h>      /* PATH_MAX */
+#  include <signal.h>
+#  include <unistd.h>
 #endif
 
 
+// Inclusions for UUID
+// http://stackoverflow.com/a/1626302
+
+extern "C"
+{
+#ifdef WIN32
+#  include <rpc.h>
+#else
+#  include <uuid/uuid.h>
+#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()
   {
--- 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();
 
--- 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 <rpc.h>
-#else
-#  include <uuid/uuid.h>
+#if defined(_WIN32)
+#  include <windows.h>   // 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)
--- 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);
--- 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})
 
--- 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()
--- 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}")
--- 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}")
--- 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}")
 
--- 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 <string>
 #include <list>
 
+#if defined(_MSC_VER)
+#  pragma warning(disable: 4065)  // "Switch statement contains 'default' but no 'case' labels"
+#endif
+
 namespace %s
 {
   namespace EmbeddedResources