diff CMakeLists.txt @ 3622:8afc14fab01f

New sample plugin: ConnectivityChecks
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 24 Jan 2020 17:06:23 +0100
parents 54cdad5a7228
children a6bfa09df8b3
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Jan 23 18:00:08 2020 +0100
+++ b/CMakeLists.txt	Fri Jan 24 17:06:23 2020 +0100
@@ -37,6 +37,7 @@
 SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists")
 SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc")
 SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Whether to build the ServeFolders plugin")
+SET(BUILD_CONNECTIVITY_CHECKS ON CACHE BOOL "Whether to build the ConnectivityChecks plugin")
 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins")
 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
 
@@ -461,6 +462,65 @@
 
 
 #####################################################################
+## Build the "ConnectivityChecks" plugin
+#####################################################################
+
+if (ENABLE_PLUGINS AND BUILD_CONNECTIVITY_CHECKS)
+  include(ExternalProject)
+
+  unset(Flags)
+  
+  if (CMAKE_TOOLCHAIN_FILE)
+    # Take absolute path to the toolchain
+    get_filename_component(TMP ${CMAKE_TOOLCHAIN_FILE} REALPATH BASE ${CMAKE_SOURCE_DIR})
+    list(APPEND Flags -DCMAKE_TOOLCHAIN_FILE=${TMP})
+  endif()
+
+  if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
+    list(APPEND Flags
+      -DLSB_CC=$ENV{LSB_CC}
+      -DLSB_CXX=$ENV{LSB_CXX}
+      )
+  endif()
+
+  externalproject_add(ConnectivityChecksProject
+    SOURCE_DIR "${ORTHANC_ROOT}/Plugins/Samples/ConnectivityChecks"
+
+    CMAKE_ARGS
+    -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+    -DPLUGIN_VERSION=${ORTHANC_VERSION}
+    -DSTATIC_BUILD=${STATIC_BUILD}
+    -DUSE_LEGACY_JSONCPP=${USE_LEGACY_JSONCPP}
+    ${Flags}
+
+    INSTALL_COMMAND ""  # Skip the install step
+    )
+
+  ExternalProject_Get_Property(ConnectivityChecksProject binary_dir)
+
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+    if (MSVC)
+      set(Prefix "")
+    else()
+      set(Prefix "lib")  # MinGW
+    endif()
+
+    install(FILES
+      ${binary_dir}/${Prefix}OrthancChecks.dll
+      DESTINATION "lib")
+  else()
+    list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
+    list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
+    install(FILES
+      ${binary_dir}/${Prefix}OrthancChecks${Suffix}
+      ${binary_dir}/${Prefix}OrthancChecks${Suffix}.${ORTHANC_VERSION}
+      DESTINATION "share/orthanc/plugins")
+  endif()
+endif()
+
+
+
+#####################################################################
 ## Build the companion tool to recover files compressed using Orthanc
 #####################################################################