view CMakeLists.txt @ 6:7d2bc8ac883e

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Jun 2019 17:08:41 +0200
parents 520cba9a0d42
children 5217b1be6c4a
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)

project(GoogleCloudPlatform)

set(GCP_PLUGIN_VERSION "mainline")

# TODO - Update to 1.5.7 once available

if (GCP_PLUGIN_VERSION STREQUAL "mainline")
  set(ORTHANC_FRAMEWORK_VERSION "1.5.6")
  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
else()
  set(ORTHANC_FRAMEWORK_VERSION "1.5.6")
  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 source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
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(USE_SYSTEM_GDCM ON CACHE BOOL "Use the system version of Grassroot DICOM (GDCM)")
set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
set(ORTHANC_SDK_VERSION "1.0.0" CACHE STRING "Version of the Orthanc plugin SDK to use, if not using the system version (can be \"1.0.0\", or \"framework\")")


include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake)

include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)

set(ENABLE_CRYPTO_OPTIONS ON)
set(ENABLE_ZLIB ON)
set(ENABLE_WEB_CLIENT ON)
set(ENABLE_OPENSSL_ENGINES ON)  # Necessary on Windows

include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)

include(${CMAKE_SOURCE_DIR}/Resources/CMake/CRC32C.cmake)
include(${CMAKE_SOURCE_DIR}/Resources/CMake/NlohmannJson.cmake)
include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleCloudPlatform.cmake)


if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
  if (ORTHANC_SDK_VERSION STREQUAL "1.0.0")
    include_directories(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.0.0)
  elseif (ORTHANC_SDK_VERSION STREQUAL "framework")
    include_directories(${ORTHANC_ROOT}/Plugins/Include)
  else()
    message(FATAL_ERROR "Unsupported version of the Orthanc plugin SDK: ${ORTHANC_SDK_VERSION}")
  endif()
else ()
  CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H)
  if (NOT HAVE_ORTHANC_H)
    message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK")
  endif()
endif()



add_definitions(
  -DHAS_ORTHANC_EXCEPTION=1
  -DORTHANC_ENABLE_LOGGING=1
  -DORTHANC_ENABLE_LOGGING_PLUGIN=1
  -DGCP_PLUGIN_VERSION="${GCP_PLUGIN_VERSION}"
  )

include_directories(
  ${AUTOGENERATED_DIR}
  ${ORTHANC_ROOT}
  )

add_library(OrthancGoogleCloudPlatform SHARED
  ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
  Plugin/GoogleAccount.cpp
  Plugin/GoogleConfiguration.cpp
  Plugin/GoogleUpdater.cpp
  Plugin/Plugin.cpp

  ${CRC32C_SOURCES}
  ${CURL_SOURCES}
  ${GCP_SOURCES}
  ${OPENSSL_SOURCES}
  ${ZLIB_SOURCES}
  ${ORTHANC_CORE_SOURCES}
  )  

set_target_properties(OrthancGoogleCloudPlatform PROPERTIES 
  VERSION ${GCP_PLUGIN_VERSION} 
  SOVERSION ${GCP_PLUGIN_VERSION})

install(
  TARGETS OrthancGoogleCloudPlatform
  RUNTIME DESTINATION lib    # Destination for Windows
  LIBRARY DESTINATION share/orthanc/plugins    # Destination for Linux
  )