diff CMakeLists.txt @ 191:993dd140bd30

Resort to Orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Apr 2018 21:29:30 +0200
parents 3f62dac67971
children 20636b255424
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Apr 11 16:23:44 2018 +0200
+++ b/CMakeLists.txt	Mon Apr 16 21:29:30 2018 +0200
@@ -29,40 +29,31 @@
 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
 
 # Advanced parameters to fine-tune linking against system libraries
-set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
 set(USE_SYSTEM_GDCM ON CACHE BOOL "Use the system version of Grassroot DICOM (GDCM)")
-set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
-set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
-set(USE_SYSTEM_SQLITE ON CACHE BOOL "Use the system version of SQLite")
-set(USE_SYSTEM_UUID ON CACHE BOOL "Use the system version of the uuid library from e2fsprogs")
 
-# Distribution-specific settings
-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)
-
-set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/Orthanc)
-set(ENABLE_LOCALE OFF)         # Disable support for locales (notably in Boost)
-
-if (NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
-  # The "patch" command-line tool is only needed for Boost and LSB
-  set(ORTHANC_DISABLE_PATCH ON)
+# Download the Orthanc framework
+if (ORTHANC_WEBVIEWER_VERSION STREQUAL "mainline")
+  set(ORTHANC_FRAMEWORK_SOURCE "hg")
+  set(ORTHANC_FRAMEWORK_VERSION "mainline")
+else()
+  set(ORTHANC_FRAMEWORK_SOURCE "web")
+  set(ORTHANC_FRAMEWORK_VERSION "1.3.1")
 endif()
 
-include(CheckIncludeFile)
-include(CheckIncludeFiles)
-include(CheckIncludeFileCXX)
-include(CheckLibraryExists)
-include(FindPythonInterp)
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/Compiler.cmake)
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/AutoGeneratedCode.cmake)
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/DownloadPackage.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake)
+
+
+# Initialize the Orthanc framework
+include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
 
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/BoostConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/GoogleTestConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/JsonCppConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/SQLiteConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/UuidConfiguration.cmake)
+set(ENABLE_LOCALE OFF)         # Disable support for locales (notably in Boost)
+set(ENABLE_GOOGLE_TEST ON)
+set(ENABLE_SQLITE ON)
+
+include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
+include_directories(${ORTHANC_ROOT})
+
 
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GdcmConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JavaScriptLibraries.cmake)
@@ -70,7 +61,7 @@
 
 # Check that the Orthanc SDK headers are available
 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
-  include_directories(${ORTHANC_ROOT}/Sdk-0.9.5)
+  include_directories(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-0.9.5)
 else ()
   CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H)
   if (NOT HAVE_ORTHANC_H)
@@ -99,15 +90,6 @@
   ${EMBEDDED_RESOURCES}
   )
 
-add_definitions(
-  -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
-  -DORTHANC_ENABLE_LOCALE=0
-  -DORTHANC_ENABLE_PUGIXML=0
-  -DORTHANC_ENABLE_SQLITE=1
-  -DORTHANC_SQLITE_STANDALONE=1
-  )
-
-
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
     ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
     ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
@@ -136,44 +118,17 @@
 endif()
 
 add_definitions(
-  -DORTHANC_ENABLE_MD5=0
-  -DORTHANC_ENABLE_BASE64=0
-  -DORTHANC_ENABLE_LOGGING=0
   -DORTHANC_SANDBOXED=0
   )
 
 set(CORE_SOURCES
-  ${BOOST_SOURCES}
-  ${JSONCPP_SOURCES}
-  ${SQLITE_SOURCES}
-  ${UUID_SOURCES}
-
-  # Sources inherited from Orthanc core
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/ChunkedBuffer.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/Enumerations.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/FileStorage/FilesystemStorage.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/Images/ImageAccessor.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/Images/ImageBuffer.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/Images/ImageProcessing.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/MultiThreading/SharedMessageQueue.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Connection.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/FunctionContext.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Statement.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/StatementId.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/StatementReference.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Transaction.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/SystemToolbox.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/Toolbox.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/DicomFormat/DicomMap.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/DicomFormat/DicomTag.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Core/DicomFormat/DicomValue.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Resources/ThirdParty/base64/base64.cpp
-
   ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheManager.cpp
   ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheScheduler.cpp
   ${CMAKE_SOURCE_DIR}/Plugin/ViewerToolbox.cpp
   ${CMAKE_SOURCE_DIR}/Plugin/ViewerPrefetchPolicy.cpp
   ${CMAKE_SOURCE_DIR}/Plugin/SeriesInformationAdapter.cpp
+  
+  ${ORTHANC_CORE_SOURCES}
   )
 
 add_library(OrthancWebViewer
@@ -184,9 +139,9 @@
 
   # The following files depend on GDCM
   ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp
-  ${CMAKE_SOURCE_DIR}/Orthanc/Plugins/Samples/GdcmDecoder/OrthancImageWrapper.cpp
+  ${ORTHANC_ROOT}/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp
+  ${ORTHANC_ROOT}/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp
+  ${ORTHANC_ROOT}/Plugins/Samples/GdcmDecoder/OrthancImageWrapper.cpp
   )
 
 
@@ -213,7 +168,6 @@
 add_executable(UnitTests
   ${CORE_SOURCES}
   ${GOOGLE_TEST_SOURCES}
-  ${JSONCPP_SOURCES}
   UnitTestsSources/UnitTestsMain.cpp
   )