diff Resources/Orthanc/DownloadOrthancFramework.cmake @ 22:ebf978ab064d

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2020 07:59:10 +0200
parents 17f775299b4a
children
line wrap: on
line diff
--- a/Resources/Orthanc/DownloadOrthancFramework.cmake	Tue Jun 30 10:15:56 2020 +0200
+++ b/Resources/Orthanc/DownloadOrthancFramework.cmake	Wed Jul 01 07:59:10 2020 +0200
@@ -195,10 +195,8 @@
   endif()
   
   if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
-    message(FATAL_ERROR "Directory not containing the source code of Orthanc: ${ORTHANC_FRAMEWORK_ROOT}")
+    message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}")
   endif()
-  
-  set(ORTHANC_ROOT ${ORTHANC_FRAMEWORK_ROOT})
 endif()
 
 
@@ -245,6 +243,16 @@
   if (Failure)
     message(FATAL_ERROR "Error while running Mercurial")
   endif()
+
+  unset(ORTHANC_FRAMEWORK_ROOT CACHE)
+  set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE
+    STRING "Path to the Orthanc framework source directory")
+
+  if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+    message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}")
+  endif()
+
+  unset(ORTHANC_ROOT)
 endif()
 
 
@@ -372,6 +380,16 @@
       message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.")
     endif()
   endif()
+
+  unset(ORTHANC_FRAMEWORK_ROOT CACHE)
+  set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE
+    STRING "Path to the Orthanc framework source directory")
+
+  if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+    message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}")
+  endif()
+
+  unset(ORTHANC_ROOT)
 endif()
 
 
@@ -399,8 +417,10 @@
   include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
   set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py)
 
-  if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND
-      NOT ORTHANC_FRAMEWORK_STATIC)
+  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR
+      ORTHANC_FRAMEWORK_STATIC)
+    include_directories(${ORTHANC_FRAMEWORK_ROOT}/..)
+  else()
     # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake)
     find_path(JSONCPP_INCLUDE_DIR json/reader.h
       /usr/include/jsoncpp
@@ -447,6 +467,22 @@
       endif()
       link_libraries(sqlite3)
     endif()
+
+    # Optional component - Pugixml
+    if (ENABLE_PUGIXML)
+      CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H)
+      if (NOT HAVE_PUGIXML_H)
+        message(FATAL_ERROR "Please install the libpugixml-dev package")
+      endif()      
+      link_libraries(pugixml)
+    endif()
+
+    # Optional component - DCMTK
+    if (ENABLE_DCMTK)
+      include(FindDCMTK)
+      include_directories(${DCMTK_INCLUDE_DIRS})
+      link_libraries(${DCMTK_LIBRARIES})
+    endif()
   endif()
 
   # Optional component - Google Test
@@ -462,7 +498,6 @@
 
   if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
     set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT})
-    include_directories(${ORTHANC_FRAMEWORK_ROOT}/..)
   else()
     find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h
       /usr/include/orthanc-framework