diff CMakeLists.txt @ 266:4e9d30c19b4b

linking against orthanc framework library
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 12:32:46 +0200
parents 38e9bb57f761
children fada2686f2c4
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Jun 08 18:05:15 2020 +0200
+++ b/CMakeLists.txt	Wed Jun 10 12:32:46 2020 +0200
@@ -36,7 +36,7 @@
 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
 set(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
-set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc framework (can be \"hg\", \"archive\", \"web\" or \"path\")")
+set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc framework (can be \"system\", \"hg\", \"archive\", \"web\" or \"path\")")
 set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_FRAMEWORK_DEFAULT_VERSION}" CACHE STRING "Version of the Orthanc framework")
 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
@@ -45,19 +45,37 @@
 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
 
 
+set(ENABLE_PLUGINS_VERSION_SCRIPT OFF)
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/VersionScript.map")
+
+
 # Download and setup the Orthanc framework
-include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake)
+
+
+if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+  set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
+  set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
+  mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
+  include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/CMake/GoogleTestConfiguration.cmake)
 
-set(ENABLE_LOCALE OFF)         # Disable support for locales (notably in Boost)
-set(ENABLE_GOOGLE_TEST ON)
-set(ENABLE_SQLITE ON)
-set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "")
-set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "")
-set(HAS_EMBEDDED_RESOURCES ON)
-
-include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
-include_directories(${ORTHANC_ROOT})
+  include_directories(
+    ${CMAKE_SOURCE_DIR}/Resources/Orthanc/
+    )
+  link_libraries(OrthancFramework)
+else()
+  include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+  
+  set(ENABLE_LOCALE OFF)         # Disable support for locales (notably in Boost)
+  set(ENABLE_GOOGLE_TEST ON)
+  set(ENABLE_SQLITE ON)
+  set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "")
+  set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "")
+  set(HAS_EMBEDDED_RESOURCES ON)
+  
+  include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
+  include_directories(${ORTHANC_ROOT}/Core)
+endif()
 
 
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JavaScriptLibraries.cmake)
@@ -89,7 +107,6 @@
 endif()
 
 add_definitions(
-  -DORTHANC_ENABLE_LOGGING_PLUGIN=1
   -DHAS_ORTHANC_EXCEPTION=1
   )
 
@@ -141,13 +158,17 @@
   ${ORTHANC_CORE_SOURCES}
   )
 
+include_directories(
+  ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/
+  )
+
 add_library(OrthancWebViewer
   SHARED
   ${AUTOGENERATED_SOURCES}
   ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp
   ${CMAKE_SOURCE_DIR}/Plugin/Plugin.cpp
   ${CORE_SOURCES}
-  ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
+  ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
   )
 
 add_dependencies(OrthancWebViewer AutogeneratedTarget)