diff Resources/CMake/OrthancStone.cmake @ 113:2eca030792aa wasm

using the Orthanc Framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Sep 2017 15:32:32 +0200
parents 7665ccbf33db
children 3541fc81331a
line wrap: on
line diff
--- a/Resources/CMake/OrthancStone.cmake	Wed Sep 20 14:37:08 2017 +0200
+++ b/Resources/CMake/OrthancStone.cmake	Wed Sep 20 15:32:32 2017 +0200
@@ -17,60 +17,66 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-# Version of the build, should always be "mainline" except in release branches
-set(ORTHANC_STONE_VERSION "mainline")
 
 #####################################################################
-## Parameters of the build
+## Import the parameters of the Orthanc Framework
+#####################################################################
+
+# TODO => Import
+SET(ORTHANC_ROOT /home/jodogne/Subversion/orthanc)
+
+include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+
+# Optional components of the Orthanc Framework
+SET(ENABLE_CURL ON CACHE BOOL "Include support for libcurl")
+SET(ENABLE_SSL OFF CACHE BOOL "Include support for SSL")
+SET(ENABLE_LOGGING ON CACHE BOOL "Enable logging facilities from Orthanc")
+
+
+
+#####################################################################
+## Parameters of the Stone of Orthanc
 #####################################################################
 
 # Generic parameters
-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(STONE_SANDBOXED OFF CACHE BOOL "Whether Stone runs inside a sandboxed environment (such as Google NaCl)")
-SET(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof")
+SET(STONE_SANDBOXED OFF CACHE BOOL "Whether Stone runs inside a sandboxed environment (such as Google NaCl or WebAssembly)")
 
-# Optional components
-SET(ENABLE_CURL ON CACHE BOOL "Include support for libcurl")
-SET(ENABLE_SSL OFF CACHE BOOL "Include support for SSL")
+# Optional components of Stone
 SET(ENABLE_SDL ON CACHE BOOL "Include support for SDL")
-SET(ENABLE_LOGGING ON CACHE BOOL "Enable logging facilities from Orthanc")
 
 # 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_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
-SET(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib")
 SET(USE_SYSTEM_CAIRO ON CACHE BOOL "Use the system version of Cairo")
 SET(USE_SYSTEM_PIXMAN ON CACHE BOOL "Use the system version of Pixman")
-SET(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng")
-SET(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg")
-SET(USE_SYSTEM_CURL ON CACHE BOOL "Use the system version of LibCurl")
-SET(USE_SYSTEM_OPENSSL ON CACHE BOOL "Use the system version of OpenSSL")
 SET(USE_SYSTEM_SDL ON CACHE BOOL "Use the system version of SDL2")
 
 
 #####################################################################
+## Configure the Orthanc Framework
+#####################################################################
+
+if (NOT STONE_SANDBOXED)
+  SET(ORTHANC_BOOST_COMPONENTS program_options)
+  SET(ENABLE_CURL ON)
+  SET(ENABLE_CRYPTO_OPTIONS ON)
+  SET(ENABLE_WEB_CLIENT ON)
+endif()
+  
+SET(ENABLE_GOOGLE_TEST ON)
+SET(ENABLE_JPEG ON)
+SET(ENABLE_PNG ON)
+
+include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
+
+include_directories(${ORTHANC_ROOT})
+
+
+#####################################################################
 ## Configure mandatory third-party components
 #####################################################################
 
 SET(ORTHANC_STONE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-SET(ORTHANC_ROOT ${ORTHANC_STONE_DIR}/Resources/Orthanc)
 
-include(CheckIncludeFiles)
-include(CheckIncludeFileCXX)
-include(CheckLibraryExists)
-include(FindPythonInterp)
 include(FindPkgConfig)
-
-include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
-
-include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/LibPngConfiguration.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/LibJpegConfiguration.cmake)
-
 include(${CMAKE_CURRENT_LIST_DIR}/BoostExtendedConfiguration.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/CairoConfiguration.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/PixmanConfiguration.cmake)
@@ -86,68 +92,55 @@
 #####################################################################
 
 if (STONE_SANDBOXED)
+  if (ENABLE_CURL)
+    message(FATAL_ERROR "Cannot enable curl in sandboxed environments")
+  endif()
+
+  if (ENABLE_LOGGING)
+    message(FATAL_ERROR "Cannot enable logging in sandboxed environments")
+  endif()
+
+  if (ENABLE_SDL)
+    message(FATAL_ERROR "Cannot enable SDL in sandboxed environments")
+  endif()
+
+  if (ENABLE_SSL)
+    message(FATAL_ERROR "Cannot enable SSL in sandboxed environments")
+  endif()
+
   add_definitions(
-    -DORTHANC_ENABLE_CURL=0
-    -DORTHANC_ENABLE_LOGGING=0
-    -DORTHANC_ENABLE_SDL=0
-    -DORTHANC_ENABLE_SSL=0
     -DORTHANC_SANDBOXED=1
     )
+
 else()
   list(APPEND ORTHANC_STONE_SOURCES
-    ${ORTHANC_ROOT}/Core/HttpClient.cpp
-    ${ORTHANC_ROOT}/Core/SystemToolbox.cpp
     ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancHttpConnection.cpp
     )
 
   add_definitions(
     -DORTHANC_SANDBOXED=0
-    -DORTHANC_ENABLE_LOGGING_PLUGIN=0
     )
+endif()
 
-  if (ENABLE_LOGGING)
-    add_definitions(-DORTHANC_ENABLE_LOGGING=1)
-  else()
-    add_definitions(-DORTHANC_ENABLE_LOGGING=0)
-  endif()
-
-  if (ENABLE_SDL)
-    include(${CMAKE_CURRENT_LIST_DIR}/SdlConfiguration.cmake)  
-    add_definitions(-DORTHANC_ENABLE_SDL=1)
-  else()
-    add_definitions(-DORTHANC_ENABLE_SDL=0)
-  endif()
 
-  if (ENABLE_CURL)
-    add_definitions(-DORTHANC_ENABLE_CURL=1)
-    include(${ORTHANC_ROOT}/Resources/CMake/LibCurlConfiguration.cmake)
+if (ENABLE_SDL)
+  include(${CMAKE_CURRENT_LIST_DIR}/SdlConfiguration.cmake)  
+  add_definitions(-DORTHANC_ENABLE_SDL=1)
+else()
+  add_definitions(-DORTHANC_ENABLE_SDL=0)
+endif()
 
-    if (ENABLE_SSL)
-      set(ENABLE_PKCS11 OFF)
-      add_definitions(-DORTHANC_ENABLE_SSL=1)
-      include(${ORTHANC_ROOT}/Resources/CMake/OpenSslConfiguration.cmake)
-    else()
-      add_definitions(-DORTHANC_ENABLE_SSL=0)
-    endif()
-  else()
-    add_definitions(
-      -DORTHANC_ENABLE_SSL=0
-      -DORTHANC_ENABLE_CURL=0
-      )
-  endif()
-endif()
 
 add_definitions(
   -DHAS_ORTHANC_EXCEPTION=1
-  -DORTHANC_ENABLE_MD5=0
-  -DORTHANC_ENABLE_BASE64=1
-  -DORTHANC_ENABLE_PUGIXML=0
-  -DORTHANC_ENABLE_PKCS11=0
+  -DORTHANC_ENABLE_LOGGING_PLUGIN=0
   )
 
 
+
+
 #####################################################################
-## Link the colormaps into the binaries
+## Embed the colormaps into the binaries
 #####################################################################
 
 EmbedResources(
@@ -159,6 +152,7 @@
   )
 
 
+
 #####################################################################
 ## System-specific patches
 #####################################################################
@@ -176,19 +170,23 @@
 ## All the source files required to build Stone of Orthanc
 #####################################################################
 
-set(PLATFORM_SOURCES
-  ${ORTHANC_STONE_DIR}/Platforms/Generic/WebServiceGetCommand.cpp
-  ${ORTHANC_STONE_DIR}/Platforms/Generic/WebServicePostCommand.cpp
-  ${ORTHANC_STONE_DIR}/Platforms/Generic/Oracle.cpp
-  )
+if (NOT STONE_SANDBOXED)
+  set(PLATFORM_SOURCES
+    ${ORTHANC_STONE_DIR}/Platforms/Generic/WebServiceGetCommand.cpp
+    ${ORTHANC_STONE_DIR}/Platforms/Generic/WebServicePostCommand.cpp
+    ${ORTHANC_STONE_DIR}/Platforms/Generic/Oracle.cpp
+    )
+
+  set(APPLICATIONS_SOURCES
+    ${ORTHANC_STONE_DIR}/Applications/BasicApplicationContext.cpp
+    ${ORTHANC_STONE_DIR}/Applications/IBasicApplication.cpp
+    ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlEngine.cpp
+    ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlSurface.cpp
+    ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlWindow.cpp
+    )
+endif()
 
 list(APPEND ORTHANC_STONE_SOURCES
-  ${ORTHANC_STONE_DIR}/Applications/BasicApplicationContext.cpp
-  ${ORTHANC_STONE_DIR}/Applications/IBasicApplication.cpp
-  ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlEngine.cpp
-  ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlSurface.cpp
-  ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlWindow.cpp
-
   #${ORTHANC_STONE_DIR}/Framework/Layers/DicomStructureSetRendererFactory.cpp
   #${ORTHANC_STONE_DIR}/Framework/Layers/SeriesFrameRendererFactory.cpp
   #${ORTHANC_STONE_DIR}/Framework/Layers/SiblingSliceLocationFactory.cpp
@@ -232,43 +230,19 @@
   ${ORTHANC_STONE_DIR}/Framework/Widgets/WidgetBase.cpp
   ${ORTHANC_STONE_DIR}/Framework/Widgets/WorldSceneWidget.cpp
 
+  ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp
+  ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp
+  ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp
+  ${ORTHANC_ROOT}/Plugins/Samples/Common/FullOrthancDataset.cpp
+  
   ${PLATFORM_SOURCES}
-
-  ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp
-  ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp
-  ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp
-  ${ORTHANC_ROOT}/Core/Enumerations.cpp
-  ${ORTHANC_ROOT}/Core/Images/Image.cpp
-  ${ORTHANC_ROOT}/Core/Images/ImageAccessor.cpp
-  ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp
-  ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp
-  ${ORTHANC_ROOT}/Core/Images/JpegErrorManager.cpp
-  ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp
-  ${ORTHANC_ROOT}/Core/Images/PngReader.cpp
-  ${ORTHANC_ROOT}/Core/Logging.cpp
-  ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp
-  ${ORTHANC_ROOT}/Core/Toolbox.cpp
-  ${ORTHANC_ROOT}/Core/WebServiceParameters.cpp
-  ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp
-  ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp
-  ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp
-  ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomTag.cpp
-  ${ORTHANC_ROOT}/Plugins/Samples/Common/FullOrthancDataset.cpp
-  ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp
-
+  ${ORTHANC_CORE_SOURCES}
   ${AUTOGENERATED_SOURCES}
 
   # Mandatory components
-  ${BOOST_SOURCES}
   ${CAIRO_SOURCES}
-  ${JSONCPP_SOURCES}
   ${PIXMAN_SOURCES}
-  ${ZLIB_SOURCES}
-  ${LIBPNG_SOURCES}
-  ${LIBJPEG_SOURCES}
 
   # Optional components
-  ${OPENSSL_SOURCES}
-  ${CURL_SOURCES}
   ${SDL_SOURCES}
   )