changeset 175:4ecd23ad4169

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 Apr 2018 14:39:12 +0200 (2018-04-17)
parents db6cc80efed0 (current diff) c5ef9c029a4c (diff)
children 0831444fd484
files CMakeLists.txt Resources/Orthanc/DownloadOrthancFramework.cmake
diffstat 2 files changed, 25 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Apr 17 14:26:18 2018 +0200
+++ b/CMakeLists.txt	Tue Apr 17 14:39:12 2018 +0200
@@ -23,29 +23,31 @@
 
 set(ORTHANC_POSTGRESQL_VERSION "mainline")
 
+if (ORTHANC_POSTGRESQL_VERSION STREQUAL "mainline")
+  set(ORTHANC_FRAMEWORK_VERSION "mainline")
+  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
+else()
+  set(ORTHANC_FRAMEWORK_VERSION "1.3.1")
+  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(BUILD_UNIT_TESTS ON CACHE BOOL "Build UnitTests")
+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_LIBPQ ON CACHE BOOL "Use the system version of the PostgreSQL client library")
 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
 
-# Download the Orthanc framework
-if (ORTHANC_POSTGRESQL_VERSION STREQUAL "mainline")
-  set(ORTHANC_FRAMEWORK_SOURCE "hg")
-  set(ORTHANC_FRAMEWORK_VERSION "mainline")
-else()
-  set(ORTHANC_FRAMEWORK_SOURCE "web")
-  set(ORTHANC_FRAMEWORK_VERSION "1.3.1")
-endif()
 
+# Download and setup the Orthanc framework
 include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake)
 
-
-# Initialize the Orthanc framework
 set(ORTHANC_FRAMEWORK_PLUGIN ON)
 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
 
--- a/Resources/Orthanc/DownloadOrthancFramework.cmake	Tue Apr 17 14:26:18 2018 +0200
+++ b/Resources/Orthanc/DownloadOrthancFramework.cmake	Tue Apr 17 14:39:12 2018 +0200
@@ -157,18 +157,24 @@
 
   set(ORTHANC_ROOT ${CMAKE_BINARY_DIR}/orthanc)
 
-  if (NOT EXISTS ${ORTHANC_ROOT})
+  if (EXISTS ${ORTHANC_ROOT})
+    message("Updating the Orthanc source repository using Mercurial")
+    execute_process(
+      COMMAND ${ORTHANC_FRAMEWORK_HG} pull
+      WORKING_DIRECTORY ${ORTHANC_ROOT}
+      RESULT_VARIABLE Failure
+      )    
+  else()
     message("Forking the Orthanc source repository using Mercurial")
-
     execute_process(
       COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://bitbucket.org/sjodogne/orthanc"
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       RESULT_VARIABLE Failure
-      )
-    
-    if (Failure OR NOT EXISTS ${ORTHANC_ROOT})
-      message(FATAL_ERROR "Cannot fork the Orthanc repository")
-    endif()
+      )    
+  endif()
+
+  if (Failure OR NOT EXISTS ${ORTHANC_ROOT})
+    message(FATAL_ERROR "Cannot fork the Orthanc repository")
   endif()
 
   message("Setting branch of the Orthanc repository to: ${ORTHANC_FRAMEWORK_BRANCH}")