changeset 5263:ae3f29be5ca5

fix compatibility with visual studio precompiled headers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Apr 2023 17:38:44 +0200
parents bf304ee8dd80
children 99751c5a7cfe
files OrthancServer/CMakeLists.txt OrthancServer/Plugins/Samples/ConnectivityChecks/OrthancFrameworkDependencies.cpp OrthancServer/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp OrthancServer/Plugins/Samples/DelayedDeletion/Plugin.cpp
diffstat 4 files changed, 129 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/CMakeLists.txt	Wed Apr 12 15:53:32 2023 +0200
+++ b/OrthancServer/CMakeLists.txt	Wed Apr 12 17:38:44 2023 +0200
@@ -492,65 +492,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()
@@ -587,7 +557,7 @@
     ${SERVE_FOLDERS_RESOURCES}
     )
 
-  target_link_libraries(ServeFolders PluginsFramework)
+  target_link_libraries(ServeFolders PluginsDependencies)
 
   set_target_properties(
     ServeFolders PROPERTIES 
@@ -635,7 +605,7 @@
     ${MODALITY_WORKLISTS_RESOURCES}
     )
 
-  target_link_libraries(ModalityWorklists PluginsFramework)
+  target_link_libraries(ModalityWorklists PluginsDependencies)
 
   set_target_properties(
     ModalityWorklists PROPERTIES 
@@ -687,13 +657,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
@@ -734,15 +707,18 @@
     ${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
@@ -789,9 +765,7 @@
     ${HOUSEKEEPER_RESOURCES}
     )
   
-  target_link_libraries(Housekeeper 
-    PluginsFramework
-    )
+  target_link_libraries(Housekeeper PluginsDependencies)
   
   set_target_properties(
     Housekeeper PROPERTIES 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancServer/Plugins/Samples/ConnectivityChecks/OrthancFrameworkDependencies.cpp	Wed Apr 12 17:38:44 2023 +0200
@@ -0,0 +1,36 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+/**
+ * Remove the dependency upon ICU in plugins, as this greatly increase
+ * the size of the resulting binaries, since they must embed the ICU
+ * dictionary.
+ **/
+
+#define ORTHANC_ENABLE_ICU 0
+
+#include "../../../../OrthancFramework/Sources/ChunkedBuffer.cpp"
+#include "../../../../OrthancFramework/Sources/Enumerations.cpp"
+#include "../../../../OrthancFramework/Sources/Logging.cpp"
+#include "../../../../OrthancFramework/Sources/OrthancException.cpp"
+#include "../../../../OrthancFramework/Sources/SystemToolbox.cpp"
+#include "../../../../OrthancFramework/Sources/Toolbox.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancServer/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp	Wed Apr 12 17:38:44 2023 +0200
@@ -0,0 +1,48 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+/**
+ * Remove the dependency upon ICU in plugins, as this greatly increase
+ * the size of the resulting binaries, since they must embed the ICU
+ * dictionary.
+ **/
+
+#define ORTHANC_ENABLE_ICU 0
+
+#include "../../../../OrthancFramework/Sources/ChunkedBuffer.cpp"
+#include "../../../../OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp"
+#include "../../../../OrthancFramework/Sources/Compression/GzipCompressor.cpp"
+#include "../../../../OrthancFramework/Sources/DicomFormat/DicomTag.cpp"
+#include "../../../../OrthancFramework/Sources/Enumerations.cpp"
+#include "../../../../OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp"
+#include "../../../../OrthancFramework/Sources/Logging.cpp"
+#include "../../../../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.cpp"
+#include "../../../../OrthancFramework/Sources/OrthancException.cpp"
+#include "../../../../OrthancFramework/Sources/SQLite/Connection.cpp"
+#include "../../../../OrthancFramework/Sources/SQLite/FunctionContext.cpp"
+#include "../../../../OrthancFramework/Sources/SQLite/Statement.cpp"
+#include "../../../../OrthancFramework/Sources/SQLite/StatementId.cpp"
+#include "../../../../OrthancFramework/Sources/SQLite/StatementReference.cpp"
+#include "../../../../OrthancFramework/Sources/SQLite/Transaction.cpp"
+#include "../../../../OrthancFramework/Sources/StringMemoryBuffer.cpp"
+#include "../../../../OrthancFramework/Sources/SystemToolbox.cpp"
+#include "../../../../OrthancFramework/Sources/Toolbox.cpp"
--- a/OrthancServer/Plugins/Samples/DelayedDeletion/Plugin.cpp	Wed Apr 12 15:53:32 2023 +0200
+++ b/OrthancServer/Plugins/Samples/DelayedDeletion/Plugin.cpp	Wed Apr 12 17:38:44 2023 +0200
@@ -1,3 +1,25 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
 #include "PendingDeletionsDatabase.h"
 
 #include "../../../../OrthancFramework/Sources/FileStorage/FilesystemStorage.h"