Permalink
Browse files

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...
1 parent 20a4228 commit 8af134788212659fc85e28b2484f28d3d5eaaa71 @finetjul finetjul committed Dec 31, 2012
View
51 CMake/SlicerCPack.cmake
@@ -64,26 +64,57 @@ Plugins = ${Slicer_QtPlugins_DIR}
file(WRITE ${slicer_cpack_bundle_fixup_directory}/CMakeLists.txt
"install(SCRIPT \"${slicer_cpack_bundle_fixup_directory}/SlicerCPackBundleFixup.cmake\")")
add_subdirectory(${slicer_cpack_bundle_fixup_directory} ${slicer_cpack_bundle_fixup_directory}-binary)
+
endif()
+# Install additional projects if any, but also do a find_package to load CPACK
+# variables of the Slicer_MAIN_PROJECT if different from SlicerApp
+set(additional_projects ${Slicer_ADDITIONAL_DEPENDENCIES} ${Slicer_ADDITIONAL_PROJECTS})
+foreach(additional_project ${additional_projects})
+ find_package(${additional_project})
+ if (${additional_project}_FOUND)
+ if (${additional_project}_USE_FILE)
+ include(${${additional_project}_USE_FILE})
+ endif()
+ if(NOT APPLE)
+ if (DEFINED ${additional_project}_CPACK_INSTALL_CMAKE_PROJECTS)
+ set(CPACK_INSTALL_CMAKE_PROJECTS
+ "${CPACK_INSTALL_CMAKE_PROJECTS};${${additional_project}_CPACK_INSTALL_CMAKE_PROJECTS}")
+ endif()
+ endif()
+ endif()
+endforeach()
+
# Install Slicer
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${Slicer_BINARY_DIR};Slicer;ALL;/")
# -------------------------------------------------------------------------
# Package properties
# -------------------------------------------------------------------------
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Medical Visualization and Processing Environment for Research")
-
set(CPACK_MONOLITHIC_INSTALL ON)
-set(CPACK_PACKAGE_NAME ${${Slicer_MAIN_PROJECT}_APPLICATION_NAME})
-set(CPACK_PACKAGE_VENDOR "NA-MIC")
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${Slicer_SOURCE_DIR}/README.txt")
-set(CPACK_RESOURCE_FILE_LICENSE "${Slicer_SOURCE_DIR}/License.txt")
-set(CPACK_PACKAGE_VERSION_MAJOR "${Slicer_VERSION_MAJOR}")
-set(CPACK_PACKAGE_VERSION_MINOR "${Slicer_VERSION_MINOR}")
-set(CPACK_PACKAGE_VERSION_PATCH "${Slicer_VERSION_PATCH}")
-SET(CPACK_PACKAGE_VERSION "${Slicer_VERSION_FULL}")
+set(Slicer_CPACK_PACKAGE_NAME ${SlicerApp_APPLICATION_NAME})
+set(Slicer_CPACK_PACKAGE_VENDOR "NA-MIC")
+set(Slicer_CPACK_PACKAGE_DESCRIPTION_FILE "${Slicer_SOURCE_DIR}/README.txt")
+set(Slicer_CPACK_PACKAGE_DESCRIPTION_SUMMARY
+ "Medical Visualization and Processing Environment for Research")
+set(Slicer_CPACK_RESOURCE_FILE_LICENSE "${Slicer_SOURCE_DIR}/License.txt")
+set(Slicer_CPACK_PACKAGE_VERSION_MAJOR "${Slicer_VERSION_MAJOR}")
+set(Slicer_CPACK_PACKAGE_VERSION_MINOR "${Slicer_VERSION_MINOR}")
+set(Slicer_CPACK_PACKAGE_VERSION_PATCH "${Slicer_VERSION_PATCH}")
+set(Slicer_CPACK_PACKAGE_VERSION "${Slicer_VERSION_FULL}")
+
+set(project ${${Slicer_MAIN_PROJECT}_APPLICATION_NAME})
+
+set(CPACK_PACKAGE_NAME ${${project}_CPACK_PACKAGE_NAME})
+set(CPACK_PACKAGE_VENDOR ${${project}_CPACK_PACKAGE_VENDOR})
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${${project}_CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+set(CPACK_PACKAGE_DESCRIPTION_FILE ${${project}_CPACK_PACKAGE_DESCRIPTION_FILE})
+set(CPACK_RESOURCE_FILE_LICENSE ${${project}_CPACK_PACKAGE_FILE_LICENSE})
+set(CPACK_PACKAGE_VERSION_MAJOR ${${project}_CPACK_PACKAGE_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${${project}_CPACK_PACKAGE_VERSION_MINOR})
+set(CPACK_PACKAGE_VERSION_PATCH ${${project}_CPACK_PACKAGE_VERSION_PATCH})
+set(CPACK_PACKAGE_VERSION ${${project}_CPACK_PACKAGE_VERSION})
set(CPACK_SYSTEM_NAME "${Slicer_OS}-${Slicer_ARCHITECTURE}")
if(APPLE)
View
10 CMake/SlicerCPackBundleFixup.cmake.in
@@ -230,6 +230,16 @@ function(fixup_bundle_with_plugins app)
endif()
list(APPEND libs_path "@Slicer_BINARY_DIR@/@Slicer_QtPlugins_DIR@")
+ if (Slicer_ADDITIONAL_PROJECTS)
+ foreach(additional_project ${Slicer_ADDITIONAL_PROJECTS})
+ find_package(${additional_project})
+ if (${additional_project}_FOUND)
+ include(${${additional_project}_USE_FILE})
+ list(APPEND libs_path "${${additional_project}_LIBRARY_DIRS}")
+ endif()
+ endforeach()
+ endif()
+
list(REMOVE_DUPLICATES libs_path)
set(Slicer_BUILD_DIR "@Slicer_BINARY_DIR@")
View
8 CMake/SlicerMacroCheckExternalProjectDependency.cmake
@@ -53,7 +53,13 @@ macro(SlicerMacroCheckExternalProjectDependency proj)
# Include dependencies
foreach(dep ${${proj}_DEPENDENCIES})
if(NOT External_${dep}_FILE_INCLUDED)
- include(${EXTERNAL_PROJECT_DIR}/External_${dep}.cmake)
+ if(EXISTS "${EXTERNAL_PROJECT_DIR}/External_${dep}.cmake")
+ include(${EXTERNAL_PROJECT_DIR}/External_${dep}.cmake)
+ elseif(EXISTS "${Slicer_ADDITIONAL_EXTERNAL_PROJECT_DIR}/External_${dep}.cmake")
+ include(${Slicer_ADDITIONAL_EXTERNAL_PROJECT_DIR}/External_${dep}.cmake)
+ else()
+ message(FATAL_ERROR "Can't find External_${dep}.cmake")
+ endif()
endif()
endforeach()
View
18 CMakeLists.txt
@@ -362,6 +362,8 @@ if (NOT DEFINED Slicer_MAIN_PROJECT)
endif()
if (NOT DEFINED ${Slicer_MAIN_PROJECT}_APPLICATION_NAME)
set(${Slicer_MAIN_PROJECT}_APPLICATION_NAME Slicer CACHE INTERNAL "Main application name")
+else()
+ set(SlicerApp_APPLICATION_NAME Slicer)
endif()
set(Slicer_MAIN_PROJECT_APPLICATION_NAME ${${Slicer_MAIN_PROJECT}_APPLICATION_NAME})
@@ -376,22 +378,6 @@ set(Slicer_VERSION_PATCH "0")
#set(Slicer_VERSION_TWEAK 0)
#set(Slicer_VERSION_RC 0)
-if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MAJOR)
- set(Slicer_VERSION_MAJOR ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MAJOR})
-endif()
-if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MINOR)
- set(Slicer_VERSION_MINOR ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_MINOR})
-endif()
-if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_PATCH)
- set(Slicer_VERSION_PATCH ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_PATCH})
-endif()
-if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_TWEAK)
- set(Slicer_VERSION_TWEAK ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_TWEAK})
-endif()
-if (${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_RC)
- set(Slicer_VERSION_RC ${${Slicer_MAIN_PROJECT_APPLICATION_NAME}_VERSION_RC})
-endif()
-
SlicerMacroExtractRepositoryInfo(VAR_PREFIX Slicer) # Used to configure vtkSlicerVersionConfigure.h.in
string(REGEX REPLACE ".*([0-9][0-9][0-9][0-9]\\-[0-9][0-9]\\-[0-9][0-9]).*" "\\1"
Slicer_BUILDDATE "${Slicer_WC_LAST_CHANGED_DATE}")
View
26 SuperBuild.cmake
@@ -167,6 +167,10 @@ if(Slicer_BUILD_DWIConvert)
list(APPEND Slicer_DEPENDENCIES DWIConvert)
endif()
+if(DEFINED Slicer_ADDITIONAL_DEPENDENCIES)
+ list(APPEND Slicer_DEPENDENCIES ${Slicer_ADDITIONAL_DEPENDENCIES})
+endif()
+
SlicerMacroCheckExternalProjectDependency(Slicer)
#-----------------------------------------------------------------------------
@@ -214,6 +218,8 @@ set(ep_cmake_boolean_args
Slicer_BUILD_MultiVolumeExplorer
Slicer_BUILD_MultiVolumeImporter
Slicer_BUILD_SlicerWebGLExport
+ Slicer_BUILD_Extensions
+ Slicer_BUILD_SkullStripper
)
set(ep_superbuild_boolean_args)
@@ -329,6 +335,26 @@ if(Slicer_BUILD_EXTENSIONMANAGER_SUPPORT)
)
endif()
+# Projects that Slicer needs to download/configure/build...
+if(Slicer_ADDITIONAL_DEPENDENCIES)
+ foreach(additional_dependency ${Slicer_ADDITIONAL_DEPENDENCIES})
+ list(APPEND ep_superbuild_extra_args
+ -D${additional_dependency}_DIR:PATH=${${additional_dependency}_DIR})
+ endforeach()
+endif()
+
+# Projects that Slicer needs to include
+if(Slicer_ADDITIONAL_PROJECTS)
+ # needed by packaging
+ list(APPEND ep_superbuild_extra_args
+ -DSlicer_ADDITIONAL_PROJECTS:STRING=${Slicer_ADDITIONAL_PROJECTS})
+ # needed to do find_package within Slicer
+ foreach(additional_project ${Slicer_ADDITIONAL_PROJECTS})
+ list(APPEND ep_superbuild_extra_args
+ -D${additional_project}_DIR:PATH=${${additional_project}_DIR})
+ endforeach()
+endif()
+
# Set CMake OSX variable to pass down the external project
set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
if(APPLE)

0 comments on commit 8af1347

Please sign in to comment.