Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ENH: Add support for external projects passed as configuration parameter

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21550 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
commit 8af134788212659fc85e28b2484f28d3d5eaaa71 1 parent 20a4228
Julien Finet finetjul authored
51 CMake/SlicerCPack.cmake
@@ -64,26 +64,57 @@ Plugins = ${Slicer_QtPlugins_DIR}
64 64 file(WRITE ${slicer_cpack_bundle_fixup_directory}/CMakeLists.txt
65 65 "install(SCRIPT \"${slicer_cpack_bundle_fixup_directory}/SlicerCPackBundleFixup.cmake\")")
66 66 add_subdirectory(${slicer_cpack_bundle_fixup_directory} ${slicer_cpack_bundle_fixup_directory}-binary)
  67 +
67 68 endif()
68 69
  70 +# Install additional projects if any, but also do a find_package to load CPACK
  71 +# variables of the Slicer_MAIN_PROJECT if different from SlicerApp
  72 +set(additional_projects ${Slicer_ADDITIONAL_DEPENDENCIES} ${Slicer_ADDITIONAL_PROJECTS})
  73 +foreach(additional_project ${additional_projects})
  74 + find_package(${additional_project})
  75 + if (${additional_project}_FOUND)
  76 + if (${additional_project}_USE_FILE)
  77 + include(${${additional_project}_USE_FILE})
  78 + endif()
  79 + if(NOT APPLE)
  80 + if (DEFINED ${additional_project}_CPACK_INSTALL_CMAKE_PROJECTS)
  81 + set(CPACK_INSTALL_CMAKE_PROJECTS
  82 + "${CPACK_INSTALL_CMAKE_PROJECTS};${${additional_project}_CPACK_INSTALL_CMAKE_PROJECTS}")
  83 + endif()
  84 + endif()
  85 + endif()
  86 +endforeach()
  87 +
69 88 # Install Slicer
70 89 set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${Slicer_BINARY_DIR};Slicer;ALL;/")
71 90
72 91 # -------------------------------------------------------------------------
73 92 # Package properties
74 93 # -------------------------------------------------------------------------
75   -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Medical Visualization and Processing Environment for Research")
76   -
77 94 set(CPACK_MONOLITHIC_INSTALL ON)
78 95
79   -set(CPACK_PACKAGE_NAME ${${Slicer_MAIN_PROJECT}_APPLICATION_NAME})
80   -set(CPACK_PACKAGE_VENDOR "NA-MIC")
81   -set(CPACK_PACKAGE_DESCRIPTION_FILE "${Slicer_SOURCE_DIR}/README.txt")
82   -set(CPACK_RESOURCE_FILE_LICENSE "${Slicer_SOURCE_DIR}/License.txt")
83   -set(CPACK_PACKAGE_VERSION_MAJOR "${Slicer_VERSION_MAJOR}")
84   -set(CPACK_PACKAGE_VERSION_MINOR "${Slicer_VERSION_MINOR}")
85   -set(CPACK_PACKAGE_VERSION_PATCH "${Slicer_VERSION_PATCH}")
86   -SET(CPACK_PACKAGE_VERSION "${Slicer_VERSION_FULL}")
  96 +set(Slicer_CPACK_PACKAGE_NAME ${SlicerApp_APPLICATION_NAME})
  97 +set(Slicer_CPACK_PACKAGE_VENDOR "NA-MIC")
  98 +set(Slicer_CPACK_PACKAGE_DESCRIPTION_FILE "${Slicer_SOURCE_DIR}/README.txt")
  99 +set(Slicer_CPACK_PACKAGE_DESCRIPTION_SUMMARY
  100 + "Medical Visualization and Processing Environment for Research")
  101 +set(Slicer_CPACK_RESOURCE_FILE_LICENSE "${Slicer_SOURCE_DIR}/License.txt")
  102 +set(Slicer_CPACK_PACKAGE_VERSION_MAJOR "${Slicer_VERSION_MAJOR}")
  103 +set(Slicer_CPACK_PACKAGE_VERSION_MINOR "${Slicer_VERSION_MINOR}")
  104 +set(Slicer_CPACK_PACKAGE_VERSION_PATCH "${Slicer_VERSION_PATCH}")
  105 +set(Slicer_CPACK_PACKAGE_VERSION "${Slicer_VERSION_FULL}")
  106 +
  107 +set(project ${${Slicer_MAIN_PROJECT}_APPLICATION_NAME})
  108 +
  109 +set(CPACK_PACKAGE_NAME ${${project}_CPACK_PACKAGE_NAME})
  110 +set(CPACK_PACKAGE_VENDOR ${${project}_CPACK_PACKAGE_VENDOR})
  111 +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${${project}_CPACK_PACKAGE_DESCRIPTION_SUMMARY})
  112 +set(CPACK_PACKAGE_DESCRIPTION_FILE ${${project}_CPACK_PACKAGE_DESCRIPTION_FILE})
  113 +set(CPACK_RESOURCE_FILE_LICENSE ${${project}_CPACK_PACKAGE_FILE_LICENSE})
  114 +set(CPACK_PACKAGE_VERSION_MAJOR ${${project}_CPACK_PACKAGE_VERSION_MAJOR})
  115 +set(CPACK_PACKAGE_VERSION_MINOR ${${project}_CPACK_PACKAGE_VERSION_MINOR})
  116 +set(CPACK_PACKAGE_VERSION_PATCH ${${project}_CPACK_PACKAGE_VERSION_PATCH})
  117 +set(CPACK_PACKAGE_VERSION ${${project}_CPACK_PACKAGE_VERSION})
87 118 set(CPACK_SYSTEM_NAME "${Slicer_OS}-${Slicer_ARCHITECTURE}")
88 119
89 120 if(APPLE)
10 CMake/SlicerCPackBundleFixup.cmake.in
@@ -230,6 +230,16 @@ function(fixup_bundle_with_plugins app)
230 230 endif()
231 231 list(APPEND libs_path "@Slicer_BINARY_DIR@/@Slicer_QtPlugins_DIR@")
232 232
  233 + if (Slicer_ADDITIONAL_PROJECTS)
  234 + foreach(additional_project ${Slicer_ADDITIONAL_PROJECTS})
  235 + find_package(${additional_project})
  236 + if (${additional_project}_FOUND)
  237 + include(${${additional_project}_USE_FILE})
  238 + list(APPEND libs_path "${${additional_project}_LIBRARY_DIRS}")
  239 + endif()
  240 + endforeach()
  241 + endif()
  242 +
233 243 list(REMOVE_DUPLICATES libs_path)
234 244
235 245 set(Slicer_BUILD_DIR "@Slicer_BINARY_DIR@")
8 CMake/SlicerMacroCheckExternalProjectDependency.cmake
@@ -53,7 +53,13 @@ macro(SlicerMacroCheckExternalProjectDependency proj)
53 53 # Include dependencies
54 54 foreach(dep ${${proj}_DEPENDENCIES})
55 55 if(NOT External_${dep}_FILE_INCLUDED)
56   - include(${EXTERNAL_PROJECT_DIR}/External_${dep}.cmake)
  56 + if(EXISTS "${EXTERNAL_PROJECT_DIR}/External_${dep}.cmake")
  57 + include(${EXTERNAL_PROJECT_DIR}/External_${dep}.cmake)
  58 + elseif(EXISTS "${Slicer_ADDITIONAL_EXTERNAL_PROJECT_DIR}/External_${dep}.cmake")
  59 + include(${Slicer_ADDITIONAL_EXTERNAL_PROJECT_DIR}/External_${dep}.cmake)
  60 + else()
  61 + message(FATAL_ERROR "Can't find External_${dep}.cmake")
  62 + endif()
57 63 endif()
58 64 endforeach()
59 65
18 CMakeLists.txt
@@ -362,6 +362,8 @@ if (NOT DEFINED Slicer_MAIN_PROJECT)
362 362 endif()
363 363 if (NOT DEFINED ${Slicer_MAIN_PROJECT}_APPLICATION_NAME)
364 364 set(${Slicer_MAIN_PROJECT}_APPLICATION_NAME Slicer CACHE INTERNAL "Main application name")
  365 +else()
  366 + set(SlicerApp_APPLICATION_NAME Slicer)
365 367 endif()
366 368
367 369 set(Slicer_MAIN_PROJECT_APPLICATION_NAME ${${Slicer_MAIN_PROJECT}_APPLICATION_NAME})
@@ -376,22 +378,6 @@ set(Slicer_VERSION_PATCH "0")
376 378 #set(Slicer_VERSION_TWEAK 0)
377 379 #set(Slicer_VERSION_RC 0)
378 380
379   -if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MAJOR)
380   - set(Slicer_VERSION_MAJOR ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MAJOR})
381   -endif()
382   -if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MINOR)
383   - set(Slicer_VERSION_MINOR ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MINOR})
384   -endif()
385   -if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_PATCH)
386   - set(Slicer_VERSION_PATCH ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_PATCH})
387   -endif()
388   -if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_TWEAK)
389   - set(Slicer_VERSION_TWEAK ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_TWEAK})
390   -endif()
391   -if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_RC)
392   - set(Slicer_VERSION_RC ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_RC})
393   -endif()
394   -
395 381 SlicerMacroExtractRepositoryInfo(VAR_PREFIX Slicer) # Used to configure vtkSlicerVersionConfigure.h.in
396 382 string(REGEX REPLACE ".*([0-9][0-9][0-9][0-9]\\-[0-9][0-9]\\-[0-9][0-9]).*" "\\1"
397 383 Slicer_BUILDDATE "${Slicer_WC_LAST_CHANGED_DATE}")
26 SuperBuild.cmake
@@ -167,6 +167,10 @@ if(Slicer_BUILD_DWIConvert)
167 167 list(APPEND Slicer_DEPENDENCIES DWIConvert)
168 168 endif()
169 169
  170 +if(DEFINED Slicer_ADDITIONAL_DEPENDENCIES)
  171 + list(APPEND Slicer_DEPENDENCIES ${Slicer_ADDITIONAL_DEPENDENCIES})
  172 +endif()
  173 +
170 174 SlicerMacroCheckExternalProjectDependency(Slicer)
171 175
172 176 #-----------------------------------------------------------------------------
@@ -214,6 +218,8 @@ set(ep_cmake_boolean_args
214 218 Slicer_BUILD_MultiVolumeExplorer
215 219 Slicer_BUILD_MultiVolumeImporter
216 220 Slicer_BUILD_SlicerWebGLExport
  221 + Slicer_BUILD_Extensions
  222 + Slicer_BUILD_SkullStripper
217 223 )
218 224
219 225 set(ep_superbuild_boolean_args)
@@ -329,6 +335,26 @@ if(Slicer_BUILD_EXTENSIONMANAGER_SUPPORT)
329 335 )
330 336 endif()
331 337
  338 +# Projects that Slicer needs to download/configure/build...
  339 +if(Slicer_ADDITIONAL_DEPENDENCIES)
  340 + foreach(additional_dependency ${Slicer_ADDITIONAL_DEPENDENCIES})
  341 + list(APPEND ep_superbuild_extra_args
  342 + -D${additional_dependency}_DIR:PATH=${${additional_dependency}_DIR})
  343 + endforeach()
  344 +endif()
  345 +
  346 +# Projects that Slicer needs to include
  347 +if(Slicer_ADDITIONAL_PROJECTS)
  348 + # needed by packaging
  349 + list(APPEND ep_superbuild_extra_args
  350 + -DSlicer_ADDITIONAL_PROJECTS:STRING=${Slicer_ADDITIONAL_PROJECTS})
  351 + # needed to do find_package within Slicer
  352 + foreach(additional_project ${Slicer_ADDITIONAL_PROJECTS})
  353 + list(APPEND ep_superbuild_extra_args
  354 + -D${additional_project}_DIR:PATH=${${additional_project}_DIR})
  355 + endforeach()
  356 +endif()
  357 +
332 358 # Set CMake OSX variable to pass down the external project
333 359 set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
334 360 if(APPLE)

0 comments on commit 8af1347

Please sign in to comment.
Something went wrong with that request. Please try again.