changeset 2429:fe90b3ec9d4a

improvement in Orthanc framework config
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Oct 2017 13:04:41 +0200
parents dedc24644cbe
children a6fab385b89e
files Resources/CMake/JsonCppConfiguration.cmake Resources/CMake/OrthancFrameworkConfiguration.cmake
diffstat 2 files changed, 82 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/JsonCppConfiguration.cmake	Tue Oct 10 13:23:16 2017 +0200
+++ b/Resources/CMake/JsonCppConfiguration.cmake	Fri Oct 27 13:04:41 2017 +0200
@@ -48,9 +48,10 @@
       JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
     message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
 
-    if (CMAKE_COMPILER_IS_GNUCXX AND 
+    if ((CMAKE_COMPILER_IS_GNUCXX OR
+          "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND 
         JSONCPP_VERSION_MAJOR GREATER 0)
-      message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0")
+      message("Switching to C++11 standard in gcc/clang, as version of JsonCpp is >= 1.0.0")
       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations")
     endif()
   else()
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake	Tue Oct 10 13:23:16 2017 +0200
+++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake	Fri Oct 27 13:04:41 2017 +0200
@@ -27,6 +27,85 @@
 
 
 #####################################################################
+## Disable unneeded macros
+#####################################################################
+
+if (NOT ENABLE_SQLITE)
+  unset(USE_SYSTEM_SQLITE CACHE)
+  add_definitions(-DORTHANC_ENABLE_SQLITE=0)
+endif()
+
+if (NOT ENABLE_CRYPTO_OPTIONS)
+  unset(ENABLE_SSL CACHE)
+  unset(ENABLE_PKCS11 CACHE)
+  unset(USE_SYSTEM_OPENSSL CACHE)
+  unset(USE_SYSTEM_LIBP11 CACHE)
+  add_definitions(
+    -DORTHANC_ENABLE_SSL=0
+    -DORTHANC_ENABLE_PKCS11=0
+    )
+endif()
+
+if (NOT ENABLE_WEB_CLIENT)
+  unset(USE_SYSTEM_CURL CACHE)
+  add_definitions(-DORTHANC_ENABLE_CURL=0)
+endif()
+
+if (NOT ENABLE_WEB_SERVER)
+  unset(ENABLE_CIVETWEB CACHE)
+  unset(USE_SYSTEM_CIVETWEB CACHE)
+  unset(USE_SYSTEM_MONGOOSE CACHE)
+  add_definitions(
+    -DORTHANC_ENABLE_CIVETWEB=0
+    -DORTHANC_ENABLE_MONGOOSE=0
+    )
+endif()
+
+if (NOT ENABLE_JPEG)
+  unset(USE_SYSTEM_LIBJPEG CACHE)
+  add_definitions(-DORTHANC_ENABLE_JPEG=0)
+endif()
+
+if (NOT ENABLE_PNG)
+  unset(USE_SYSTEM_LIBPNG CACHE)
+  add_definitions(-DORTHANC_ENABLE_PNG=0)
+endif()
+
+if (NOT ENABLE_LUA)
+  unset(USE_SYSTEM_LUA CACHE)
+  add_definitions(-DORTHANC_ENABLE_LUA=0)
+endif()
+
+if (NOT ENABLE_PUGIXML)
+  unset(USE_SYSTEM_PUGIXML CACHE)
+  add_definitions(-DORTHANC_ENABLE_PUGIXML=0)
+endif()
+
+if (NOT ENABLE_LOCALE)
+  unset(USE_SYSTEM_LIBICONV CACHE)
+  add_definitions(-DORTHANC_ENABLE_LOCALE=0)
+endif()
+
+if (NOT ENABLE_GOOGLE_TEST)
+  unset(USE_SYSTEM_GOOGLE_TEST CACHE)
+  unset(USE_GOOGLE_TEST_DEBIAN_PACKAGE CACHE)
+endif()
+
+if (NOT ENABLE_DCMTK)
+  add_definitions(
+    -DORTHANC_ENABLE_DCMTK=0
+    -DORTHANC_ENABLE_DCMTK_NETWORKING=0
+    )
+  unset(DCMTK_DICTIONARY_DIR CACHE)
+  unset(USE_DCMTK_360 CACHE)
+  unset(USE_DCMTK_362_PRIVATE_DIC CACHE)
+  unset(USE_SYSTEM_DCMTK CACHE)
+  unset(ENABLE_DCMTK_JPEG CACHE)
+  unset(ENABLE_DCMTK_JPEG_LOSSLESS CACHE)
+endif()
+
+
+#####################################################################
 ## List of source files
 #####################################################################
 
@@ -80,9 +159,6 @@
     ${ORTHANC_ROOT}/Core/SQLite/StatementReference.cpp
     ${ORTHANC_ROOT}/Core/SQLite/Transaction.cpp
     )
-else()
-  unset(USE_SYSTEM_SQLITE CACHE)
-  add_definitions(-DORTHANC_ENABLE_SQLITE=0)
 endif()
 
 
@@ -114,16 +190,6 @@
   else()
     add_definitions(-DORTHANC_ENABLE_PKCS11=0)  
   endif()
-
-else() # ENABLE_CRYPTO_OPTIONS == OFF
-  unset(ENABLE_SSL CACHE)
-  unset(ENABLE_PKCS11 CACHE)
-  unset(USE_SYSTEM_OPENSSL CACHE)
-  unset(USE_SYSTEM_LIBP11 CACHE)
-  add_definitions(
-    -DORTHANC_ENABLE_SSL=0
-    -DORTHANC_ENABLE_PKCS11=0
-    )
 endif()
 
 
@@ -138,9 +204,6 @@
   list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
     ${ORTHANC_ROOT}/Core/HttpClient.cpp
     )
-else()
-  unset(USE_SYSTEM_CURL CACHE)
-  add_definitions(-DORTHANC_ENABLE_CURL=0)
 endif()
 
 
@@ -181,15 +244,6 @@
     ${ORTHANC_ROOT}/Core/RestApi/RestApiOutput.cpp
     ${ORTHANC_ROOT}/Core/RestApi/RestApiPath.cpp
     )
-  
-else()
-  unset(ENABLE_CIVETWEB CACHE)
-  unset(USE_SYSTEM_CIVETWEB CACHE)
-  unset(USE_SYSTEM_MONGOOSE CACHE)
-  add_definitions(
-    -DORTHANC_ENABLE_CIVETWEB=0
-    -DORTHANC_ENABLE_MONGOOSE=0
-    )
 endif()
 
 
@@ -206,10 +260,6 @@
     ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp
     ${ORTHANC_ROOT}/Core/Images/JpegWriter.cpp
     )
-
-else()
-  unset(USE_SYSTEM_LIBJPEG CACHE)
-  add_definitions(-DORTHANC_ENABLE_JPEG=0)
 endif()
 
 
@@ -225,10 +275,6 @@
     ${ORTHANC_ROOT}/Core/Images/PngReader.cpp
     ${ORTHANC_ROOT}/Core/Images/PngWriter.cpp
     )
-  
-else()
-  unset(USE_SYSTEM_LIBPNG CACHE)
-  add_definitions(-DORTHANC_ENABLE_PNG=0)
 endif()
 
 
@@ -244,9 +290,6 @@
     ${ORTHANC_ROOT}/Core/Lua/LuaContext.cpp
     ${ORTHANC_ROOT}/Core/Lua/LuaFunctionCall.cpp
     )
-else()
-  unset(USE_SYSTEM_LUA CACHE)
-  add_definitions(-DORTHANC_ENABLE_LUA=0)
 endif()
 
 
@@ -257,9 +300,6 @@
 if (ENABLE_PUGIXML)
   include(${CMAKE_CURRENT_LIST_DIR}/PugixmlConfiguration.cmake)
   add_definitions(-DORTHANC_ENABLE_PUGIXML=1)
-else()
-  unset(USE_SYSTEM_PUGIXML CACHE)
-  add_definitions(-DORTHANC_ENABLE_PUGIXML=0)
 endif()
 
 
@@ -270,9 +310,6 @@
 if (ENABLE_LOCALE)
   include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake)
   add_definitions(-DORTHANC_ENABLE_LOCALE=1)
-else()
-  unset(USE_SYSTEM_LIBICONV CACHE)
-  add_definitions(-DORTHANC_ENABLE_LOCALE=0)
 endif()
 
 
@@ -282,9 +319,6 @@
 
 if (ENABLE_GOOGLE_TEST)
   include(${CMAKE_CURRENT_LIST_DIR}/GoogleTestConfiguration.cmake)
-else()
-  unset(USE_SYSTEM_GOOGLE_TEST CACHE)
-  unset(USE_GOOGLE_TEST_DEBIAN_PACKAGE CACHE)
 endif()
 
 
@@ -364,18 +398,6 @@
       ${AUTOGENERATED_SOURCES}
       )
   endif()
-  
-else()
-  add_definitions(
-    -DORTHANC_ENABLE_DCMTK=0
-    -DORTHANC_ENABLE_DCMTK_NETWORKING=0
-    )
-  unset(DCMTK_DICTIONARY_DIR CACHE)
-  unset(USE_DCMTK_360 CACHE)
-  unset(USE_DCMTK_362_PRIVATE_DIC CACHE)
-  unset(USE_SYSTEM_DCMTK CACHE)
-  unset(ENABLE_DCMTK_JPEG CACHE)
-  unset(ENABLE_DCMTK_JPEG_LOSSLESS CACHE)
 endif()