diff OrthancServer/CMakeLists.txt @ 5266:a856daf71745 db-protobuf

integration mainline->db-protobuf
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Apr 2023 17:56:13 +0200
parents afe92108f463 0e8dfba67ac9
children cdeb7f027c1b
line wrap: on
line diff
--- a/OrthancServer/CMakeLists.txt	Wed Apr 12 11:54:29 2023 +0200
+++ b/OrthancServer/CMakeLists.txt	Wed Apr 12 17:56:13 2023 +0200
@@ -337,8 +337,6 @@
 # headers might get broken!
 
 if (MSVC)
-  add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
-
   set(TMP
     ${ORTHANC_CORE_SOURCES_INTERNAL}
     ${ORTHANC_DICOM_SOURCES_INTERNAL}
@@ -378,6 +376,13 @@
   ${AUTOGENERATED_SOURCES}
   )
 
+if (MSVC)
+  set_target_properties(
+    CoreLibrary
+    PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1"
+    )
+endif()
+
 add_dependencies(CoreLibrary AutogeneratedTarget)
 
 if (LIBICU_LIBRARIES)
@@ -419,6 +424,13 @@
   ${ORTHANC_SERVER_SOURCES}
   )
 
+if (MSVC)
+  set_target_properties(
+    ServerLibrary
+    PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1"
+    )
+endif()
+
 # Ensure autogenerated code is built before building ServerLibrary
 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf)
 
@@ -457,6 +469,13 @@
   ${BOOST_EXTENDED_SOURCES}
   )
 
+if (MSVC)
+  set_target_properties(
+    UnitTests
+    PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1"
+    )
+endif()
+
 target_link_libraries(UnitTests
   ServerLibrary
   CoreLibrary
@@ -472,65 +491,35 @@
 if (ENABLE_PLUGINS AND
     (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_HOUSEKEEPER OR
       BUILD_DELAYED_DELETION))
-  set(PLUGINS_FRAMEWORK_SOURCES
+  set(PLUGINS_DEPENDENCIES_SOURCES
     ${BOOST_SOURCES}
     ${JSONCPP_SOURCES}
     ${LIBICONV_SOURCES}
     ${LIBICU_SOURCES}
+    ${PUGIXML_SOURCES}
+    ${UUID_SOURCES}
+    ${ZLIB_SOURCES}
+    
+    ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/base64/base64.cpp
+    ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/md5/md5.c
     Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
     )
 
   if (BUILD_DELAYED_DELETION)
-    list(APPEND PLUGINS_FRAMEWORK_SOURCES
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/base64/base64.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/md5/md5.c
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/ChunkedBuffer.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/GzipCompressor.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/IBufferCompressor.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/ZipReader.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/ZipWriter.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/ZlibCompressor.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/DicomFormat/DicomTag.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Enumerations.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Logging.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/OrthancException.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/Connection.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/FunctionContext.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/Statement.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/StatementId.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/StatementReference.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/Transaction.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/StringMemoryBuffer.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SystemToolbox.cpp
-      ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Toolbox.cpp
+    list(APPEND PLUGINS_DEPENDENCIES_SOURCES
       ${DCMTK_SOURCES}
-      ${PUGIXML_SOURCES}
-      ${UUID_SOURCES}
-      ${ZLIB_SOURCES}
       ${SQLITE_SOURCES}
       )
   endif()
   
-  add_library(PluginsFramework STATIC
-    ${PLUGINS_FRAMEWORK_SOURCES}
-    )
-
-  # Remove the dependency upon ICU in plugins, as this greatly
-  # increase the size of the resulting binaries, since they must
-  # embed the ICU dictionary.
-  set_target_properties(
-    PluginsFramework
-    PROPERTIES COMPILE_DEFINITIONS "ORTHANC_ENABLE_ICU=0"
+  add_library(PluginsDependencies STATIC
+    ${PLUGINS_DEPENDENCIES_SOURCES}
     )
 
   # Add the "-fPIC" option as this static library must be embedded
   # inside shared libraries (important on UNIX)
   set_target_properties(
-    PluginsFramework
+    PluginsDependencies
     PROPERTIES POSITION_INDEPENDENT_CODE ON
     )
 endif()
@@ -567,7 +556,7 @@
     ${SERVE_FOLDERS_RESOURCES}
     )
 
-  target_link_libraries(ServeFolders PluginsFramework)
+  target_link_libraries(ServeFolders PluginsDependencies)
 
   set_target_properties(
     ServeFolders PROPERTIES 
@@ -615,7 +604,7 @@
     ${MODALITY_WORKLISTS_RESOURCES}
     )
 
-  target_link_libraries(ModalityWorklists PluginsFramework)
+  target_link_libraries(ModalityWorklists PluginsDependencies)
 
   set_target_properties(
     ModalityWorklists PROPERTIES 
@@ -667,13 +656,16 @@
     PROPERTIES COMPILE_DEFINITIONS "ORTHANC_PLUGIN_NAME=\"connectivity-checks\";ORTHANC_PLUGIN_VERSION=\"${ORTHANC_VERSION}\""
     )
   
+  # The "OrthancFrameworkDependencies.cpp" file is used to bypass the
+  # precompiled headers if compiling with Visual Studio
   add_library(ConnectivityChecks SHARED 
     ${AUTOGENERATED_DIR}/ConnectivityChecksResources.cpp
     ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/Plugin.cpp
+    ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/OrthancFrameworkDependencies.cpp
     ${CONNECTIVITY_CHECKS_RESOURCES}
     )
   
-  target_link_libraries(ConnectivityChecks PluginsFramework)
+  target_link_libraries(ConnectivityChecks PluginsDependencies)
   
   set_target_properties(
     ConnectivityChecks PROPERTIES
@@ -714,15 +706,17 @@
     ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/Plugin.cpp
     PROPERTIES COMPILE_DEFINITIONS "ORTHANC_PLUGIN_NAME=\"delayed-deletion\";ORTHANC_PLUGIN_VERSION=\"${ORTHANC_VERSION}\""
     )
-  
+
+  # The "OrthancFrameworkDependencies.cpp" file is used to bypass the
+  # precompiled headers if compiling with Visual Studio
   add_library(DelayedDeletion SHARED 
-    ${CMAKE_SOURCE_DIR}/Plugins/Engine/PluginsEnumerations.cpp
     ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/PendingDeletionsDatabase.cpp
     ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/Plugin.cpp
+    ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp
     ${DELAYED_DELETION_RESOURCES}
     )
   
-  target_link_libraries(DelayedDeletion PluginsFramework ${DCMTK_LIBRARIES})
+  target_link_libraries(DelayedDeletion PluginsDependencies ${DCMTK_LIBRARIES})
   
   set_target_properties(
     DelayedDeletion PROPERTIES
@@ -769,9 +763,7 @@
     ${HOUSEKEEPER_RESOURCES}
     )
   
-  target_link_libraries(Housekeeper 
-    PluginsFramework
-    )
+  target_link_libraries(Housekeeper PluginsDependencies)
   
   set_target_properties(
     Housekeeper PROPERTIES