view Resources/CMake/OrthancStone.cmake @ 18:61bcf35d4761

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Nov 2016 12:18:53 +0100
parents ff1e935768e7
children 946377d1c992
line wrap: on
line source

#####################################################################
## Parameters of the build
#####################################################################

# 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")

# Optional components
SET(ENABLE_CURL ON CACHE BOOL "Include support for libcurl")
SET(ENABLE_SSL OFF CACHE BOOL "Include support for SSL")
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 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)


#####################################################################
## Configure optional third-party components
#####################################################################

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_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()

add_definitions(
  -DORTHANC_ENABLE_MD5=0
  -DORTHANC_ENABLE_BASE64=1
  -DORTHANC_ENABLE_PUGIXML=0
  -DORTHANC_ENABLE_PKCS11=0
  -DORTHANC_SANDBOXED=0
  )


#####################################################################
## Link the colormaps into the binaries
#####################################################################

EmbedResources(
  COLORMAP_HOT    ${ORTHANC_STONE_DIR}/Resources/Colormaps/hot.lut
  COLORMAP_JET    ${ORTHANC_STONE_DIR}/Resources/Colormaps/jet.lut
  COLORMAP_RED    ${ORTHANC_STONE_DIR}/Resources/Colormaps/red.lut
  COLORMAP_GREEN  ${ORTHANC_STONE_DIR}/Resources/Colormaps/green.lut
  COLORMAP_BLUE   ${ORTHANC_STONE_DIR}/Resources/Colormaps/blue.lut
  )


#####################################################################
## System-specific patches
#####################################################################

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND
    NOT MSVC AND
    ENABLE_SDL)
  # This is necessary when compiling EXE for Windows using MinGW
  link_libraries(mingw32)
endif()



#####################################################################
## All the source files required to build Stone of Orthanc
#####################################################################

list(APPEND ORTHANC_STONE_SOURCES
  ${ORTHANC_STONE_DIR}/Framework/Applications/BasicApplicationContext.cpp
  ${ORTHANC_STONE_DIR}/Framework/Applications/IBasicApplication.cpp
  ${ORTHANC_STONE_DIR}/Framework/Applications/Sdl/SdlBuffering.cpp
  ${ORTHANC_STONE_DIR}/Framework/Applications/Sdl/SdlEngine.cpp
  ${ORTHANC_STONE_DIR}/Framework/Applications/Sdl/SdlWindow.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/CircleMeasureTracker.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/ColorFrameRenderer.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/DicomStructureSetRendererFactory.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/FrameRenderer.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/GrayscaleFrameRenderer.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/LineLayerRenderer.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/LineMeasureTracker.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/RenderStyle.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/SeriesFrameRendererFactory.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/SiblingSliceLocationFactory.cpp
  ${ORTHANC_STONE_DIR}/Framework/Layers/SingleFrameRendererFactory.cpp
  ${ORTHANC_STONE_DIR}/Framework/Messaging/CurlOrthancConnection.cpp
  ${ORTHANC_STONE_DIR}/Framework/Messaging/MessagingToolbox.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/BinarySemaphore.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/DicomDataset.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/DicomFrameConverter.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/DicomStructureSet.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/DownloadStack.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/GeometryToolbox.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/OrthancSeriesLoader.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/ParallelSlices.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/ParallelSlicesCursor.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/SliceGeometry.cpp
  ${ORTHANC_STONE_DIR}/Framework/Toolbox/ViewportGeometry.cpp
  ${ORTHANC_STONE_DIR}/Framework/Viewport/CairoContext.cpp
  ${ORTHANC_STONE_DIR}/Framework/Viewport/CairoFont.cpp
  ${ORTHANC_STONE_DIR}/Framework/Viewport/CairoSurface.cpp
  ${ORTHANC_STONE_DIR}/Framework/Viewport/WidgetViewport.cpp
  ${ORTHANC_STONE_DIR}/Framework/Volumes/ImageBuffer3D.cpp
  ${ORTHANC_STONE_DIR}/Framework/Volumes/VolumeImage.cpp
  ${ORTHANC_STONE_DIR}/Framework/Volumes/VolumeImagePolicyBase.cpp
  ${ORTHANC_STONE_DIR}/Framework/Volumes/VolumeImageProgressivePolicy.cpp
  ${ORTHANC_STONE_DIR}/Framework/Volumes/VolumeImageSimplePolicy.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/CairoWidget.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/EmptyWidget.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/LayeredSceneWidget.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/LayoutWidget.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/TestCairoWidget.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/TestWorldSceneWidget.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/WidgetBase.cpp
  ${ORTHANC_STONE_DIR}/Framework/Widgets/WorldSceneWidget.cpp

  ${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/HttpClient.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/SystemToolbox.cpp
  ${ORTHANC_ROOT}/Core/Toolbox.cpp
  ${ORTHANC_ROOT}/Core/WebServiceParameters.cpp
  ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp

  ${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}
  )