changeset 1509:b7210c688ca7

linking SDL samples against system-wide orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 09:14:35 +0200
parents dd1d1cc0575d
children 1005c1cbe4dd
files Framework/Oracle/GenericOracleRunner.h Framework/Oracle/ThreadedOracle.h Resources/CMake/OrthancStoneConfiguration.cmake Resources/CMake/OrthancStoneParameters.cmake Samples/Sdl/CMakeLists.txt
diffstat 5 files changed, 79 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Oracle/GenericOracleRunner.h	Tue Jul 07 08:15:08 2020 +0200
+++ b/Framework/Oracle/GenericOracleRunner.h	Tue Jul 07 09:14:35 2020 +0200
@@ -21,6 +21,8 @@
 
 #pragma once
 
+#include <OrthancFramework.h>  // To have the macros properly defined
+
 #if !defined(ORTHANC_ENABLE_DCMTK)
 #  error The macro ORTHANC_ENABLE_DCMTK must be defined
 #endif
--- a/Framework/Oracle/ThreadedOracle.h	Tue Jul 07 08:15:08 2020 +0200
+++ b/Framework/Oracle/ThreadedOracle.h	Tue Jul 07 09:14:35 2020 +0200
@@ -21,6 +21,8 @@
 
 #pragma once
 
+#include <OrthancFramework.h>  // To have the macros properly defined
+
 #if !defined(ORTHANC_ENABLE_THREADS)
 #  error The macro ORTHANC_ENABLE_THREADS must be defined
 #endif
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Tue Jul 07 08:15:08 2020 +0200
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Tue Jul 07 09:14:35 2020 +0200
@@ -22,19 +22,25 @@
 ## Configure the Orthanc Framework
 #####################################################################
 
-if (ENABLE_DCMTK)
-  set(ENABLE_LOCALE ON)
+if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+  include(${CMAKE_CURRENT_LIST_DIR}/../Orthanc/CMake/DownloadOrthancFramework.cmake)
+  link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
+  
 else()
-  if (NOT DEFINED ENABLE_LOCALE)
-    set(ENABLE_LOCALE OFF)  # Disable support for locales (notably in Boost)
+  if (ENABLE_DCMTK)
+    set(ENABLE_LOCALE ON)
+  else()
+    if (NOT DEFINED ENABLE_LOCALE)
+      set(ENABLE_LOCALE OFF)  # Disable support for locales (notably in Boost)
+    endif()
   endif()
+  
+  include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
+  include_directories(
+    ${ORTHANC_FRAMEWORK_ROOT}/Sources/
+    )
 endif()
 
-include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
-include_directories(
-  ${ORTHANC_FRAMEWORK_ROOT}/Sources/
-  )
-
 
 #####################################################################
 ## Sanity check of the configuration
--- a/Resources/CMake/OrthancStoneParameters.cmake	Tue Jul 07 08:15:08 2020 +0200
+++ b/Resources/CMake/OrthancStoneParameters.cmake	Tue Jul 07 09:14:35 2020 +0200
@@ -19,19 +19,50 @@
 
 
 #####################################################################
+## Select the location of the Orthanc framework
+#####################################################################
+
+include(${CMAKE_CURRENT_LIST_DIR}/Version.cmake)
+
+if (ORTHANC_STONE_VERSION STREQUAL "mainline")
+  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
+  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
+else()
+  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.7.2")
+  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
+endif()
+
+# Parameters of the build
+set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
+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 \"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\"")
+
+# Advanced parameters to fine-tune linking against system libraries
+set(ORTHANC_FRAMEWORK_STATIC OFF CACHE BOOL "If linking against the Orthanc framework system library, indicates whether this library was statically linked")
+mark_as_advanced(ORTHANC_FRAMEWORK_STATIC)
+
+
+
+#####################################################################
 ## Import the parameters of the Orthanc Framework
 #####################################################################
 
-include(${CMAKE_CURRENT_LIST_DIR}/../Orthanc/CMake/DownloadOrthancFramework.cmake)
-include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
-
-set(ENABLE_DCMTK OFF)
-set(ENABLE_GOOGLE_TEST ON)
-set(ENABLE_JPEG ON)
-set(ENABLE_OPENSSL_ENGINES ON)
-set(ENABLE_PNG ON)
-set(ENABLE_SQLITE OFF)
-set(ENABLE_ZLIB ON)
+if (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+  include(${CMAKE_CURRENT_LIST_DIR}/../Orthanc/CMake/DownloadOrthancFramework.cmake)
+  include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+  
+  set(ENABLE_DCMTK OFF)
+  set(ENABLE_GOOGLE_TEST ON)
+  set(ENABLE_JPEG ON)
+  set(ENABLE_OPENSSL_ENGINES ON)
+  set(ENABLE_PNG ON)
+  set(ENABLE_SQLITE OFF)
+  set(ENABLE_ZLIB ON)
+endif()
+  
 
 
 #####################################################################
@@ -46,6 +77,7 @@
 set(USE_SYSTEM_SDL ON CACHE BOOL "Use the system version of SDL2")
 
 
+
 #####################################################################
 ## Internal CMake parameters to enable the optional subcomponents of
 ## the Stone of Orthanc
--- a/Samples/Sdl/CMakeLists.txt	Tue Jul 07 08:15:08 2020 +0200
+++ b/Samples/Sdl/CMakeLists.txt	Tue Jul 07 09:14:35 2020 +0200
@@ -2,29 +2,30 @@
 
 project(OrthancStone)
 
-set(ORTHANC_FRAMEWORK_SOURCE "path" CACHE STRING "select the source of Orthanc")
-set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc/OrthancFramework CACHE STRING "select the root path of Orthanc")
 set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../)
 
 include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake)
-include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/AutoGeneratedCode.cmake)
-include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/DownloadPackage.cmake)
+
+if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+  set(ORTHANC_BOOST_COMPONENTS program_options)
 
-set(ALLOW_DOWNLOADS ON)
-set(STANDALONE_BUILD ON)  # To have DCMTK_USE_EMBEDDED_DICTIONARIES defined
-if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-  set(STATIC_BUILD ON)
+  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(${STONE_ROOT}/Resources/Orthanc/CMake/GoogleTestConfiguration.cmake)
+  
+else()
+  set(ENABLE_GOOGLE_TEST ON)
+  set(ENABLE_LOCALE ON)  # Necessary for text rendering
+  set(ENABLE_OPENGL ON)  #  <==
+  set(ENABLE_WEB_CLIENT ON)
+  include(${CMAKE_SOURCE_DIR}/BoostExtendedConfiguration.cmake)
 endif()
-set(ENABLE_GOOGLE_TEST ON)
-set(ENABLE_LOCALE ON)  # Necessary for text rendering
-set(ENABLE_SDL ON)
+
 set(ENABLE_DCMTK ON)  # <==
-set(ENABLE_OPENGL ON)  #  <==
-set(ENABLE_WEB_CLIENT ON)
-set(ORTHANC_SANDBOXED OFF)
-  
+set(ENABLE_SDL ON)
+
 include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/BoostExtendedConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Utilities.cmake)
 
 
@@ -40,9 +41,6 @@
   )
 
 add_definitions(
-  -DORTHANC_ENABLE_LOGGING=1
-  -DORTHANC_ENABLE_LOGGING_PLUGIN=0
-  -DORTHANC_ENABLE_PUGIXML=0
   -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
   )
 
@@ -99,7 +97,7 @@
   ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp
   ${ORTHANC_STONE_ROOT}/UnitTestsSources/SortedFramesTests.cpp
   ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp
-)
+  )
 
 target_link_libraries(UnitTests OrthancStone)