changeset 315:11641063ddb2

speed up compilation by sharing library between plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Jul 2021 18:29:27 +0200
parents 64763998cdff
children 1c2cd90418c9
files Framework/Plugins/IndexUnitTests.h MySQL/CMakeLists.txt PostgreSQL/CMakeLists.txt
diffstat 3 files changed, 38 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexUnitTests.h	Wed Jul 14 17:17:23 2021 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Wed Jul 14 18:29:27 2021 +0200
@@ -676,8 +676,6 @@
       a.compressedHash = "md5";
       db.AddAttachment(*manager, resources[attachmentLevel], a, 42);
 
-      ASSERT_THROW(db.AddAttachment(*manager, resources[attachmentLevel], a, 43), Orthanc::OrthancException);
-      
       deletedAttachments.clear();
       a.uuid = "attachment2";
       db.DeleteAttachment(*output, *manager, resources[attachmentLevel], Orthanc::FileContentType_DicomAsJson);
--- a/MySQL/CMakeLists.txt	Wed Jul 14 17:17:23 2021 +0200
+++ b/MySQL/CMakeLists.txt	Wed Jul 14 18:29:27 2021 +0200
@@ -67,28 +67,32 @@
   ${AUTOGENERATED_SOURCES}
   )
 
+add_library(FrameworkForPlugins STATIC
+  ${AUTOGENERATED_SOURCES}
+  ${DATABASES_SOURCES}
+  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
+  Plugins/MySQLIndex.cpp
+  Plugins/MySQLStorageArea.cpp
+  )
+
+set_property(TARGET FrameworkForPlugins
+  PROPERTY POSITION_INDEPENDENT_CODE ON
+  )
+
 add_library(OrthancMySQLIndex SHARED
   ${INDEX_RESOURCES}
-  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
   Plugins/IndexPlugin.cpp
-  Plugins/MySQLIndex.cpp
+  )
 
-  ${DATABASES_SOURCES}
-  ${AUTOGENERATED_SOURCES}
+add_library(OrthancMySQLStorage SHARED
+  ${STORAGE_RESOURCES}
+  Plugins/StoragePlugin.cpp
   )
 
+target_link_libraries(OrthancMySQLIndex FrameworkForPlugins)
+target_link_libraries(OrthancMySQLStorage FrameworkForPlugins)
+
 add_dependencies(OrthancMySQLIndex AutogeneratedTarget)
-
-add_library(OrthancMySQLStorage SHARED
-  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
-  ${STORAGE_RESOURCES}
-  Plugins/MySQLStorageArea.cpp
-  Plugins/StoragePlugin.cpp
-
-  ${DATABASES_SOURCES}
-  ${AUTOGENERATED_SOURCES}
-  )
-
 add_dependencies(OrthancMySQLStorage AutogeneratedTarget)
 
 message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}")
--- a/PostgreSQL/CMakeLists.txt	Wed Jul 14 17:17:23 2021 +0200
+++ b/PostgreSQL/CMakeLists.txt	Wed Jul 14 18:29:27 2021 +0200
@@ -70,28 +70,32 @@
   ${AUTOGENERATED_SOURCES}
   )
 
+add_library(FrameworkForPlugins STATIC
+  ${AUTOGENERATED_SOURCES}
+  ${DATABASES_SOURCES}
+  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
+  Plugins/PostgreSQLIndex.cpp
+  Plugins/PostgreSQLStorageArea.cpp
+  )
+
+set_property(TARGET FrameworkForPlugins
+  PROPERTY POSITION_INDEPENDENT_CODE ON
+  )
+
 add_library(OrthancPostgreSQLIndex SHARED
   ${INDEX_RESOURCES}
-  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
   Plugins/IndexPlugin.cpp
-  Plugins/PostgreSQLIndex.cpp
+  )
 
-  ${DATABASES_SOURCES}
-  ${AUTOGENERATED_SOURCES}
+add_library(OrthancPostgreSQLStorage SHARED
+  ${STORAGE_RESOURCES}
+  Plugins/StoragePlugin.cpp
   )
 
+target_link_libraries(OrthancPostgreSQLIndex FrameworkForPlugins)
+target_link_libraries(OrthancPostgreSQLStorage FrameworkForPlugins)
+
 add_dependencies(OrthancPostgreSQLIndex AutogeneratedTarget)
-
-add_library(OrthancPostgreSQLStorage SHARED
-  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
-  ${STORAGE_RESOURCES}
-  Plugins/PostgreSQLStorageArea.cpp
-  Plugins/StoragePlugin.cpp
-
-  ${DATABASES_SOURCES}
-  ${AUTOGENERATED_SOURCES}
-  )
-
 add_dependencies(OrthancPostgreSQLStorage AutogeneratedTarget)
 
 message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}")