Commit 8c5fd778 authored by jcfr's avatar jcfr

COMP: Support Slicer_USE_SYSTEM_* option. Fixes #1739

This commit implements four main changes:

  (1) it updates Slicer build system to support configuring Slicer passing
      Slicer_USE_SYSTEM_* CMake variables

  (2) it updates to a newer version of CTK able to understand CTK_USE_SYSTEM_*
      options. List of CTK contribution associated with this update are
      reported below.

  (3) it changes curl library from "slicerlibcurl/cmcurl/curl" v7.12.1
      to the more recent official CMake'ified curl v7.33.0. This has the
      benefit of making it easier to build against the corresponding
      system library.

  (4) It implements workaround allowing some CLIs to built on Debian-like
      distribution that is providing DCMTK 3.6.0.
      See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687
      EMSegment project has also been updated to implement a similar
      workaround.

The macro "SlicerMacroCheckExternalProjectDependency" allowing to
recursively traverse the external project dependency tree has been
updated.

The traversal is now done in two passes. The first pass traverses the
complete tree to set the value of Slicer_USE_SYSTEM_*.

The second pass invokes the "ExternalProject_Add" function and displays
informative messages. In addition to the usual "[OK]" and "[INCLUDED]"
suffixes, an additional text "(SYSTEM)" is displayed. It means the
corresponding libraries (and headers) installed on the system will be
used.

On Ubuntu 13.10, support for the following options have been
tested simultaneously:
  -DSlicer_USE_PYTHONQT_WITH_OPENSSL:BOOL=ON
  -DSlicer_USE_SYSTEM_python:BOOL=ON
  -DSlicer_USE_SYSTEM_DCMTK:BOOL=ON
  -DSlicer_USE_SYSTEM_LibArchive:BOOL=ON
  -DSlicer_USE_SYSTEM_curl:BOOL=ON
  -DSlicer_USE_SYSTEM_teem:BOOL=ON
  -DSlicer_USE_SYSTEM_OpenIGTLink:BOOL=ON
  -DSlicer_USE_SYSTEM_OpenSSL:BOOL=ON # Implicitly set because python depends
                                      # on OpenSSL.
  -DSlicer_BUILD_OpenIGTLinkIF:BOOL=OFF # Only openigtlink version1 are available
                                        # and code does NOT supports only v2.

To successfully build Slicer against system libraries, the corresponding
packages have been installed:
  sudo apt-get install libssl-dev \
    libdcmtk-dev \
    libarchive-dev \
    libpython2.7-dev \
    python-numpy \
    libcurl4-openssl-dev \
    libteem-dev \
    tk-dev \
    tcl-dev \
    itcl3-dev \
    libopenigtlink1-dev

While not tested, support for the following option has also been
implemented:
  -DSlicer_USE_SYSTEM_ITKv4:BOOL=ON
  -DSlicer_USE_SYSTEM_VTK:BOOL=ON

CTK updates:

$ git shortlog  91cdf9e0f...02ecc27d0

Jean-Christophe Fillion-Robin (39):
      Ensure CTK_INSTALL_QTPLUGIN_DIR is properly set
      Ensure "CMAKE_INSTALL_PREFIX" is properly passed to inner project.
      By default, do not install application headers
      Install CTK's *.cmake files
      Merge branch '65-packaging-support' into 403-relocatable-ctkconfig-usectk
      Set plugin install rules for target and include files
      Remove commented code and unused vars from CTKConfig / CTKGenerateCTKConfig
      Explicitly set default value for CTK_INSTALL_QTPLUGIN_DIR
      Remove explicit setting of CMake policies.
      Improve FindDCMTK.cmake documentation
      Add DCMTK 3.6.0 support to ctkDICOMUtil.cpp
      Ensure DCMTK libraries can be found on system without setting DCMTK_DIR
      FindDCMTK - Workaround bug in packaging of DCMTK 3.6.0 on Debian.
      Add support for install-able and relocatable package.
      Merge branch '382-fix-find-dcmtk-issue'
      Merge branch '403-relocatable-ctkconfig-usectk'
      Merge branch '405-support-dcmtk-360'
      Fix -Wunused-but-set-variable in transfer function tests
      Merge branch '209-fix-vtk-transfer-function-test-warnings'
      Fix linking of VTKCoreCppTest by adding a check for linker capabilities
      Merge branch 'fix-vtk-core-test-link-error'
      COMP: FindDCMTK - Exclude -D from DCMTK_DEFINITIONS for easier re-use
      Merge branch '382-fix-find-dcmtk-issue'
      Associate DCMTK_DEFINITIONS to CTKDICOMCore
      Merge branch '413-associated-dcmtk-definitions-to-ctkdicomcore'
      Merge pull request #410 from NifTK/409-widgets-on-ctkPopupWidget-do-not-get-keyboard-focus
      Add DCMTK 3.6.0 support to CTK application.
      Merge branch '405-support-dcmtk-360'
      Fix configuration of CTKConfig based on DCMTK_HAVE_CONFIG_H_OPTIONAL value
      Merge branch '413-associated-dcmtk-definitions-to-ctkdicomcore'
      Add convenience function "ctk_list_to_string"
      Automatically reformat list passed to "CTK" inner build.
      COMP: Add support for CTK_USE_SYSTEM_* options
      Merge branch '418-support-use-system-option'
      FindDCMTK - Do not explicitly set DCMTK_DEFINITIONS
      FindDCMTK - Clean white spaces
      Merge branch '382-fix-find-dcmtk-issue' into 413-associated-dcmtk-definitions-to-ctkdicomcore
      Associate CTKDICOMCore with DCMTK_DEFINITIONS in build and install tree
      Merge branch '413-associated-dcmtk-definitions-to-ctkdicomcore'

Miklos Espak (1):
      Active window flag transferred on RequestSoftwareInputPanel event

Steve Pieper (2):
      Put all tags for a given instance into a list for a single batch insert
      Merge pull request #415 from pieper/414-batch-insert-tags

See #1739

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22724 3bd1e089-480b-0410-8dfb-8563597acbee
parent 05de7a4a
if(Slicer_USE_PYTHONQT)
if(Slicer_USE_PYTHONQT AND NOT Slicer_USE_SYSTEM_python)
# Python install rules are common to both 'bundled' and 'regular' package
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallPython.cmake)
endif()
if(Slicer_USE_PYTHONQT_WITH_TCL)
if(Slicer_USE_PYTHONQT_WITH_TCL AND NOT Slicer_USE_SYSTEM_tcl)
# Tcl install rules are common to both 'bundled' and 'regular' package
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallTcl.cmake)
endif()
set(SlicerBlockInstallQtPlugins_subdirectories imageformats sqldrivers)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQtPlugins.cmake)
if(NOT Slicer_USE_SYSTEM_QT)
set(SlicerBlockInstallQtPlugins_subdirectories imageformats sqldrivers)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQtPlugins.cmake)
endif()
if(Slicer_BUILD_DICOM_SUPPORT)
if(Slicer_BUILD_DICOM_SUPPORT AND NOT Slicer_USE_SYSTEM_DCMTK)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallDCMTKApps.cmake)
endif()
......@@ -24,20 +26,24 @@ if(NOT "${CTK_DIR}" STREQUAL "" AND EXISTS "${CTK_DIR}/CTK-build/CMakeCache.txt"
endif()
if(NOT APPLE)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQt.cmake)
if(Slicer_BUILD_DICOM_SUPPORT)
if(NOT Slicer_USE_SYSTEM_QT)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQt.cmake)
endif()
if(Slicer_BUILD_DICOM_SUPPORT AND NOT Slicer_USE_SYSTEM_DCMTK)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallDCMTKLibs.cmake)
endif()
if(Slicer_USE_PYTHONQT)
if(Slicer_USE_PYTHONQT AND NOT Slicer_USE_SYSTEM_CTK)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallPythonQt.cmake)
endif()
if(Slicer_USE_PYTHONQT_WITH_OPENSSL)
if(Slicer_USE_PYTHONQT_WITH_OPENSSL AND NOT Slicer_USE_SYSTEM_OpenSSL)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallOpenSSL.cmake)
endif()
if(Slicer_USE_QtTesting)
if(Slicer_USE_QtTesting AND NOT Slicer_USE_SYSTEM_CTK)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQtTesting.cmake)
endif()
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallLibArchive.cmake)
if(NOT Slicer_USE_SYSTEM_LibArchive)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallLibArchive.cmake)
endif()
include(InstallRequiredSystemLibraries)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallCMakeProjects.cmake)
......@@ -91,15 +97,17 @@ endif()
# 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}")
if(NOT Slicer_USE_SYSTEM_${additional_project})
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()
endif()
......
......@@ -399,9 +399,14 @@ slicer_config_set_ep(
CACHE PATH "Path to qRestAPI build or install directory" FORCE)
slicer_config_set_ep(
SLICERLIBCURL_DIR
"@SLICERLIBCURL_DIR_CONFIG@"
CACHE PATH "Path to Curl build or install directory" FORCE)
CURL_INCLUDE_DIR
"@CURL_INCLUDE_DIR_CONFIG@"
CACHE PATH "Path to CURL include directory" FORCE)
slicer_config_set_ep(
CURL_LIBRARY
"@CURL_LIBRARY_CONFIG@"
CACHE PATH "Path to CURL library" FORCE)
# SlicerExecutionModel settings
set(SlicerExecutionModel_CLI_LIBRARY_WRAPPER_CXX "@SlicerExecutionModel_CLI_LIBRARY_WRAPPER_CXX_CONFIG@")
......
......@@ -93,13 +93,14 @@ endif()
if(Slicer_BUILD_CLI_SUPPORT)
set(SlicerExecutionModel_DIR_CONFIG ${SlicerExecutionModel_DIR})
endif()
set(SLICERLIBCURL_DIR_CONFIG ${SLICERLIBCURL_DIR})
set(CURL_INCLUDE_DIR_CONFIG ${CURL_INCLUDE_DIR})
set(CURL_LIBRARY_CONFIG ${CURL_LIBRARY})
set(Teem_DIR_CONFIG ${Teem_DIR})
set(VTK_DIR_CONFIG ${VTK_DIR})
# List all required external project
set(Slicer_EXTERNAL_PROJECTS_CONFIG CTK ITK SLICERLIBCURL Teem VTK)
set(Slicer_EXTERNAL_PROJECTS_NO_USEFILE_CONFIG)
set(Slicer_EXTERNAL_PROJECTS_CONFIG CTK ITK CURL Teem VTK)
set(Slicer_EXTERNAL_PROJECTS_NO_USEFILE_CONFIG CURL)
if(Slicer_USE_QtTesting)
list(APPEND Slicer_EXTERNAL_PROJECTS_CONFIG QtTesting)
list(APPEND Slicer_EXTERNAL_PROJECTS_NO_USEFILE_CONFIG QtTesting)
......
......@@ -22,6 +22,10 @@ if(NOT EXISTS "${EXTERNAL_PROJECT_DIR}")
set(EXTERNAL_PROJECT_DIR ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/SuperBuild)
endif()
if(NOT DEFINED EXTERNAL_PROJECT_FILE_PREFIX)
set(EXTERNAL_PROJECT_FILE_PREFIX "External_")
endif()
macro(slicer_include_once)
# Make sure this file is included only once
get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE)
......@@ -31,7 +35,14 @@ macro(slicer_include_once)
set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1)
endmacro()
macro(_epd_status txt)
if(NOT __epd_first_pass)
message(STATUS ${txt})
endif()
endmacro()
macro(SlicerMacroCheckExternalProjectDependency proj)
# Set indent variable if needed
if(NOT DEFINED __indent)
set(__indent "")
......@@ -44,47 +55,84 @@ macro(SlicerMacroCheckExternalProjectDependency proj)
message(FATAL_ERROR "${__indent}${proj}_DEPENDENCIES variable is NOT defined !")
endif()
# Keep track of the projects
list(APPEND __epd_${CMAKE_PROJECT_NAME}_projects ${proj})
# Is this the first run ? (used to set the <CMAKE_PROJECT_NAME>_USE_SYSTEM_* variables)
if(${proj} STREQUAL ${CMAKE_PROJECT_NAME} AND NOT DEFINED __epd_first_pass)
message(STATUS "SuperBuild - First pass")
set(__epd_first_pass TRUE)
endif()
# Set message strings
set(__${proj}_indent ${__indent})
set(__${proj}_superbuild_message "SuperBuild - ${__indent}${proj}[OK]")
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(__${proj}_superbuild_message "${__${proj}_superbuild_message} (SYSTEM)")
endif()
# Display dependency of project being processed
if("${${proj}_DEPENDENCIES}" STREQUAL "")
message(STATUS "SuperBuild - ${__indent}${proj}[OK]")
_epd_status(${__${proj}_superbuild_message})
else()
set(dependency_str " ")
foreach(dep ${${proj}_DEPENDENCIES})
if(External_${dep}_FILE_INCLUDED)
if(${EXTERNAL_PROJECT_FILE_PREFIX}${dep}_FILE_INCLUDED)
set(dependency_str "${dependency_str}${dep}[INCLUDED], ")
else()
set(dependency_str "${dependency_str}${dep}, ")
endif()
endforeach()
message(STATUS "SuperBuild - ${__indent}${proj} => Requires${dependency_str}")
_epd_status("SuperBuild - ${__indent}${proj} => Requires${dependency_str}")
endif()
foreach(dep ${${proj}_DEPENDENCIES})
if(${${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${dep} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}})
endif()
#if(__epd_first_pass)
# message("${CMAKE_PROJECT_NAME}_USE_SYSTEM_${dep} set to [${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}:${${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}}]")
#endif()
endforeach()
# Include dependencies
foreach(dep ${${proj}_DEPENDENCIES})
if(NOT External_${dep}_FILE_INCLUDED)
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)
if(EXISTS "${EXTERNAL_PROJECT_DIR}/${EXTERNAL_PROJECT_FILE_PREFIX}${dep}.cmake")
include(${EXTERNAL_PROJECT_DIR}/${EXTERNAL_PROJECT_FILE_PREFIX}${dep}.cmake)
elseif(EXISTS "${Slicer_ADDITIONAL_EXTERNAL_PROJECT_DIR}/${EXTERNAL_PROJECT_FILE_PREFIX}${dep}.cmake")
include(${Slicer_ADDITIONAL_EXTERNAL_PROJECT_DIR}/${EXTERNAL_PROJECT_FILE_PREFIX}${dep}.cmake)
else()
message(FATAL_ERROR "Can't find External_${dep}.cmake")
message(FATAL_ERROR "Can't find ${EXTERNAL_PROJECT_FILE_PREFIX}${dep}.cmake")
endif()
endif()
endforeach()
set(__${proj}_superbuild_message "SuperBuild - ${__indent}${proj}[OK]")
set(__${proj}_indent ${__indent})
# If project being process has dependencies, indicates it has also been added.
if(NOT "${${proj}_DEPENDENCIES}" STREQUAL "")
message(STATUS ${__${proj}_superbuild_message})
_epd_status(${__${proj}_superbuild_message})
endif()
# Update indent variable
string(LENGTH "${__indent}" __indent_length)
math(EXPR __indent_length "${__indent_length}-2")
if(NOT ${__indent_length} LESS 0)
string(SUBSTRING "${__indent}" 0 ${__indent_length} __indent)
endif()
if(${proj} STREQUAL ${CMAKE_PROJECT_NAME} AND __epd_first_pass)
message(STATUS "SuperBuild - First pass - done")
if(${CMAKE_PROJECT_NAME}_SUPERBUILD)
set(__epd_first_pass FALSE)
unset(__indent)
foreach(proj_to_reset ${__epd_${CMAKE_PROJECT_NAME}_projects})
unset(${EXTERNAL_PROJECT_FILE_PREFIX}${proj_to_reset}_FILE_INCLUDED)
endforeach()
SlicerMacroCheckExternalProjectDependency(${CMAKE_PROJECT_NAME})
endif()
endif()
if(__epd_first_pass)
return()
endif()
endmacro()
......@@ -470,6 +470,85 @@ if(Slicer_BUILD_CLI_SUPPORT)
set(Slicer_INSTALL_CLIMODULES_SHARE_DIR "${Slicer_INSTALL_ROOT}${Slicer_CLIMODULES_SHARE_DIR}")
endif()
#-----------------------------------------------------------------------------
# ITKv4 - Slicer_ITK_COMPONENTS
#-----------------------------------------------------------------------------
set(Slicer_ITK_COMPONENTS "")
if(${ITK_VERSION_MAJOR} GREATER 3)
set(ITK_IO_MODULES_USED
ITKIOJPEG
ITKIOGDCM
ITKIOBMP
ITKIOLSM
ITKIOPNG
ITKIOTIFF
ITKIOVTK
ITKIOStimulate
ITKIOBioRad
ITKIOMeta
ITKIONIFTI
ITKIONRRD
ITKIOGIPL
)
if(Slicer_BUILD_DICOM_SUPPORT)
list(APPEND ITK_IO_MODULES_USED ITKIODCMTK)
endif()
set(Slicer_ITK_COMPONENTS
ITKAnisotropicSmoothing
ITKAntiAlias
ITKBiasCorrection
ITKBinaryMathematicalMorphology
ITKCommon
ITKConnectedComponents
ITKCurvatureFlow
ITKDeprecated
ITKDiffusionTensorImage
ITKDisplacementField
ITKDistanceMap
ITKFastMarching
ITKHDF5
ITKIOImageBase
ITKIOSpatialObjects
ITKIOStimulate
ITKIOTransformBase
ITKImageAdaptors
ITKImageCompare
ITKImageCompose
ITKImageFeature
ITKImageFilterBase
ITKImageFunction
ITKImageFusion
ITKImageGradient
ITKImageGrid
ITKImageIntensity
ITKImageSources
ITKImageStatistics
ITKLabelVoting
ITKLevelSets
ITKMathematicalMorphology
ITKMesh
ITKOptimizers
ITKPDEDeformableRegistration
ITKPath
ITKQuadEdgeMesh
ITKQuadEdgeMeshFiltering
ITKRegionGrowing
ITKRegistrationCommon
ITKReview
ITKSmoothing
ITKSpatialObjects
ITKStatistics
ITKTestKernel
ITKThresholding
ITKTransform
ITKV3Compatibility
ITKVTK
# ITKVtkGlue
ITKZLIB
${ITK_IO_MODULES_USED}
)
endif()
#-----------------------------------------------------------------------------
# Qt - Slicer_REQUIRED_QT_MODULES
#-----------------------------------------------------------------------------
......@@ -516,6 +595,12 @@ if(Slicer_SUPERBUILD)
return()
endif()
foreach(dep QT ${Slicer_DEPENDENCIES})
if(Slicer_USE_SYSTEM_${dep})
message(STATUS "Using system ${dep}")
endif()
endforeach()
#-----------------------------------------------------------------------------
# CMake Function(s) and Macro(s)
#-----------------------------------------------------------------------------
......@@ -607,78 +692,6 @@ endif()
set(expected_ITK_VERSION_MAJOR ${ITK_VERSION_MAJOR})
set(Slicer_ITK_COMPONENTS "")
if(${ITK_VERSION_MAJOR} GREATER 3)
set(ITK_IO_MODULES_USED
ITKIOJPEG
ITKIOGDCM
ITKIOBMP
ITKIOLSM
ITKIOPNG
ITKIOTIFF
ITKIOVTK
ITKIOStimulate
ITKIOBioRad
ITKIOMeta
ITKIONIFTI
ITKIONRRD
ITKIOGIPL
)
if(Slicer_BUILD_DICOM_SUPPORT)
list(APPEND ITK_IO_MODULES_USED ITKIODCMTK)
endif()
set(Slicer_ITK_COMPONENTS
ITKAnisotropicSmoothing
ITKAntiAlias
ITKBiasCorrection
ITKBinaryMathematicalMorphology
ITKCommon
ITKConnectedComponents
ITKCurvatureFlow
ITKDeprecated
ITKDiffusionTensorImage
ITKDisplacementField
ITKDistanceMap
ITKFastMarching
ITKHDF5
ITKIOImageBase
ITKIOSpatialObjects
ITKIOStimulate
ITKIOTransformBase
ITKImageAdaptors
ITKImageCompare
ITKImageCompose
ITKImageFeature
ITKImageFilterBase
ITKImageFunction
ITKImageFusion
ITKImageGradient
ITKImageGrid
ITKImageIntensity
ITKImageSources
ITKImageStatistics
ITKLabelVoting
ITKLevelSets
ITKMathematicalMorphology
ITKMesh
ITKOptimizers
ITKPDEDeformableRegistration
ITKPath
ITKQuadEdgeMesh
ITKQuadEdgeMeshFiltering
ITKRegionGrowing
ITKRegistrationCommon
ITKReview
ITKSmoothing
ITKSpatialObjects
ITKStatistics
ITKTestKernel
ITKThresholding
ITKTransform
ITKV3Compatibility
ITKVTK
# ITKVtkGlue
ITKZLIB
${ITK_IO_MODULES_USED}
)
find_package(ITK COMPONENTS ${Slicer_ITK_COMPONENTS})
else()
find_package(ITK REQUIRED)
......@@ -814,23 +827,15 @@ include(${Teem_USE_FILE})
#-----------------------------------------------------------------------------
# SlicerLibCurl
#-----------------------------------------------------------------------------
find_package(SLICERLIBCURL REQUIRED)
include(${SLICERLIBCURL_USE_FILE})
find_package(CURL REQUIRED)
include(${CURL_INCLUDE_DIRS})
#-----------------------------------------------------------------------------
# LibArchive
#-----------------------------------------------------------------------------
set(LibArchive_INCLUDE_DIR ${LibArchive_DIR}/include)
if(WIN32)
set(LibArchive_LIBRARY ${LibArchive_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}archive.lib)
else()
set(LibArchive_LIBRARY ${LibArchive_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}archive${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
foreach(var LibArchive_LIBRARY LibArchive_INCLUDE_DIR)
if(NOT EXISTS "${${var}}")
message(FATAL_ERROR "error: ${var} corresponds to an inexistant file or directory. [${${var}}]")
endif()
endforeach()
find_package(LibArchive REQUIRED MODULE)
set(LibArchive_LIBRARY ${LibArchive_LIBRARIES})
set(LibArchive_INCLUDE_DIR ${LibArchive_INCLUDE_DIRS})
#-----------------------------------------------------------------------------
# BatchMake
......
......@@ -30,8 +30,8 @@ if(${ITK_VERSION_MAJOR} GREATER 3)
endif()
include(${ITK_USE_FILE})
find_package(SLICERLIBCURL REQUIRED)
include(${SLICERLIBCURL_USE_FILE})
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
# Disable MSVC 8 warnings
if(WIN32)
......@@ -101,7 +101,7 @@ set(srcs ${RemoteIO_SRCS})
add_library(${lib_name} ${srcs})
set(libs
${SLICERLIBCURL_LIBRARIES}
${CURL_LIBRARIES}
MRMLCore
)
target_link_libraries(${lib_name} ${libs})
......
......@@ -5,7 +5,7 @@
#pragma warning ( disable : 4786 )
#endif
#include <slicerlibcurl/slicerlibcurl.h>
#include <curl/curl.h>
#include <vtkRemoteIOConfigure.h>
#include "vtkRemoteIO.h"
......
......@@ -23,6 +23,12 @@
#include "itkFloatingPointExceptions.h"
#endif
// XXX # Workaround bug in packaging of DCMTK 3.6.0 on Debian.
// # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687
#ifdef HAVE_CONFIG_H
#undef HAVE_CONFIG_H
#endif
#include "DiffusionWeightedVolumeMaskingCLP.h"
#define GRAD_0_TOL 1e-6
......
......@@ -9,9 +9,9 @@ endif(WIN32)
find_package(VTK REQUIRED)
include_directories(${VTK_SOURCE_DIR})
# Find SLICERLIBCURL (slicercurl)
find_package(SLICERLIBCURL REQUIRED)
include(${SLICERLIBCURL_USE_FILE})
# Find CURL
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
# Find GenerateCLP
find_package(GenerateCLP REQUIRED)
......@@ -20,6 +20,6 @@ include(${GenerateCLP_USE_FILE})
SEMMacroBuildCLI(
NAME ${PROJECT_NAME}
#LOGO_HEADER ${Slicer_SOURCE_DIR}/Resources/NAMICLogo.h
TARGET_LIBRARIES ${SLICERLIBCURL_LIBRARIES} ${ITK_LIBRARIES}
TARGET_LIBRARIES ${CURL_LIBRARIES} ${ITK_LIBRARIES}
)
......@@ -3,7 +3,7 @@
#endif
// Includes
#include <slicerlibcurl/slicerlibcurl.h>
#include <curl/curl.h>
#include <itksys/SystemTools.hxx>
#include <itksys/Process.h>
#include <math.h>
......
// XXX # Workaround bug in packaging of DCMTK 3.6.0 on Debian.
// # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687
#ifdef HAVE_CONFIG_H
#undef HAVE_CONFIG_H
#endif
#include "PETStandardUptakeValueComputationCLP.h"
// MRML includes
......
......@@ -16,6 +16,12 @@
*
*=========================================================================*/
// XXX # Workaround bug in packaging of DCMTK 3.6.0 on Debian.
// # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687
#ifndef HAVE_CONFIG_H
#define HAVE_CONFIG_H
#endif
#include "itkDCMTKFileReader.h"
#undef HAVE_SSTREAM // 'twould be nice if people coded without using
// incredibly generic macro names
......
......@@ -16,8 +16,14 @@
*
*=========================================================================*/
#ifndef __itkDCMTKFileReader_h
#define __itkDCMTKFileReader_h
// XXX # Workaround bug in packaging of DCMTK 3.6.0 on Debian.
// # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687
#ifndef HAVE_CONFIG_H
#define HAVE_CONFIG_H
#endif
#include <stack>
#include <vector>
#include "itkByteSwapper.h"
......
......@@ -86,7 +86,9 @@ endif()
set(ITK_EXTERNAL_NAME ITKv${ITK_VERSION_MAJOR})
set(Slicer_DEPENDENCIES cmcurl teem VTK ${ITK_EXTERNAL_NAME} CTK jqPlot LibArchive)
set(Slicer_DEPENDENCIES curl teem VTK ${ITK_EXTERNAL_NAME} CTK jqPlot LibArchive)
set(CURL_ENABLE_SSL ${Slicer_USE_PYTHONQT_WITH_OPENSSL})
if(Slicer_USE_OpenIGTLink)
list(APPEND Slicer_DEPENDENCIES OpenIGTLink)
......@@ -340,6 +342,19 @@ if(Slicer_ADDITIONAL_PROJECTS)
-DSlicer_ADDITIONAL_PROJECTS:STRING=${Slicer_ADDITIONAL_PROJECTS_STRING})
endif()
# Pass variable of the form 'Slicer_USE_SYSTEM_<proj>' allowing to check
# if a project identified by <proj> has been built by Slicer build system or not.
set(Slicer_PROJECTS_STRING)
foreach(ep ${Slicer_DEPENDENCIES})
list(APPEND EXTERNAL_PROJECT_OPTIONAL_ARGS
-DSlicer_USE_SYSTEM_${ep}:BOOL=${Slicer_USE_SYSTEM_${ep}}
)
endforeach()
list_to_string(${ep_list_separator} ${Slicer_DEPENDENCIES} ep_Slicer_DEPENDENCIES)
list(APPEND EXTERNAL_PROJECT_OPTIONAL_ARGS -DSlicer_DEPENDENCIES:STRING=${ep_Slicer_DEPENDENCIES})
# Set CMake OSX variable to pass down the external project
if(APPLE)
list(APPEND EXTERNAL_PROJECT_OPTIONAL_ARGS
......@@ -407,6 +422,8 @@ ExternalProject_Add(${proj}
-DSlicer_EXTENSION_SOURCE_DIRS:STRING=${Slicer_EXTENSION_SOURCE_DIRS}
-DDOXYGEN_EXECUTABLE:FILEPATH=${DOXYGEN_EXECUTABLE}
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# Qt
-DSlicer_USE_SYSTEM_QT:BOOL=${Slicer_USE_SYSTEM_QT}
# ITK
-DITK_VERSION_MAJOR:STRING=${ITK_VERSION_MAJOR}
-DITK_DIR:PATH=${ITK_DIR}
......@@ -415,8 +432,9 @@ ExternalProject_Add(${proj}
# VTK
-DVTK_DIR:PATH=${VTK_DIR}
-DVTK_DEBUG_LEAKS:BOOL=${Slicer_USE_VTK_DEBUG_LEAKS}
# cmcurl
-DSLICERLIBCURL_DIR:PATH=${SLICERLIBCURL_DIR}
# CURL
-DCURL_INCLUDE_DIR:PATH=${CURL_INCLUDE_DIR}
-DCURL_LIBRARY:PATH=${CURL_LIBRARY}
# Qt
-DSlicer_REQUIRED_QT_VERSION:STRING=${Slicer_REQUIRED_QT_VERSION}
-DQT_QMAKE_EXECUTABLE:PATH=${QT_QMAKE_EXECUTABLE}
......@@ -424,10 +442,14 @@ ExternalProject_Add(${proj}
-DCTK_DIR:PATH=${CTK_DIR}
# DCMTK
-DDCMTK_DIR:PATH=${DCMTK_DIR}
-DDCMTK_INCLUDE_DIRS:STRING=${DCMTK_INCLUDE_DIRS}
-DDCMTK_LIBRARIES:STRING=${DCMTK_LIBRARIES}
# jqPlot
-DjqPlot_DIR:PATH=${jqPlot_DIR}
# LibArchive
-DLibArchive_DIR:PATH=${LibArchive_DIR}
-DLibArchive_INCLUDE_DIRS:PATH=${LibArchive_INCLUDE_DIRS}
-DLibArchive_LIBRARIES:FILEPATH=${LibArchive_LIBRARIES}
# zlib
-DZLIB_ROOT:PATH=${ZLIB_ROOT}
-DZLIB_INCLUDE_DIR:PATH=${ZLIB_INCLUDE_DIR}
......
slicer_include_once()
# Sanity checks
if(DEFINED BRAINSTools_SOURCE_DIR AND NOT EXISTS ${BRAINSTools_SOURCE_DIR})
message(FATAL_ERROR "BRAINSTools_SOURCE_DIR variable is defined but corresponds to non-existing directory")
endif()
# Set dependency list
set(BRAINSTools_DEPENDENCIES ${ITK_EXTERNAL_NAME} SlicerExecutionModel VTK )
......@@ -13,6 +8,15 @@ set(BRAINSTools_DEPENDENCIES ${ITK_EXTERNAL_NAME} SlicerExecutionModel VTK )
SlicerMacroCheckExternalProjectDependency(BRAINSTools)
set(proj BRAINSTools)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")
endif()
# Sanity checks
if(DEFINED BRAINSTools_SOURCE_DIR AND NOT EXISTS ${BRAINSTools_SOURCE_DIR})
message(FATAL_ERROR "BRAINSTools_SOURCE_DIR variable is defined but corresponds to non-existing directory")
endif()
if(NOT DEFINED BRAINSTools_SOURCE_DIR)
#message(STATUS "${__indent}Adding project ${proj}")
set(GIT_TAG "8c2fb34b1f80ed0a68219292010087033fee8a4b" CACHE STRING "" FORCE)
......
......@@ -8,6 +8,10 @@ set(BatchMake_DEPENDENCIES ${ITK_EXTERNAL_NAME})
SlicerMacroCheckExternalProjectDependency(BatchMake)
set(proj BatchMake)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")
endif()
set(EXTERNAL_PROJECT_OPTIONAL_ARGS)
# Set CMake OSX variable to pass down the external project
......
slicer_include_once()
# Sanity checks
if(DEFINED CTK_DIR AND NOT EXISTS ${CTK_DIR})
message(FATAL_ERROR "CTK_DIR variable is defined but corresponds to non-existing directory")
endif()
# Set dependency list
set(CTK_DEPENDENCIES VTK ${ITK_EXTERNAL_NAME})
if(Slicer_USE_PYTHONQT)
......@@ -19,7 +14,17 @@ endif()
SlicerMacroCheckExternalProjectDependency(CTK)
set(proj CTK)
if(NOT DEFINED CTK_DIR)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")
endif()
# Sanity checks
if(DEFINED CTK_DIR AND NOT EXISTS ${CTK_DIR})
unset(CTK_DIR CACHE)
find_package(CTK 0.1.0 REQUIRED NO_MODULE)
endif()
if(NOT DEFINED CTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
#message(STATUS "${__indent}Adding project ${proj}")
set(EXTERNAL_PROJECT_OPTIONAL_ARGS)
......@@ -56,6 +61,7 @@ if(NOT DEFINED CTK_DIR)
if(Slicer_BUILD_DICOM_SUPPORT)
list(APPEND EXTERNAL_PROJECT_OPTIONAL_ARGS
-DCTK_USE_SYSTEM_DCMTK:BOOL=${CTK_USE_SYSTEM_DCMTK}
-DDCMTK_DIR:PATH=${DCMTK_DIR}
)
endif()
......@@ -66,7 +72,7 @@ if(NOT DEFINED CTK_DIR)
ExternalProject_Add(${proj}
GIT_REPOSITORY "${git_protocol}://github.com/commontk/CTK.git"
GIT_TAG "02ecc27d0bf68fc01f7ab73090c2a442ace64247"
GIT_TAG "91cdf9e0f7a9a70038dbe987025cf443fe665fd7"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
CMAKE_GENERATOR ${gen}
......@@ -83,7 +89,9 @@ if(NOT DEFINED CTK_DIR)
-DCTK_INSTALL_QTPLUGIN_DIR:STRING=${Slicer_INSTALL_QtPlugins_DIR}
-DCTK_USE_GIT_PROTOCOL:BOOL=${Slicer_USE_GIT_PROTOCOL}
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
-DCTK_USE_SYSTEM_VTK:BOOL=${CTK_USE_SYSTEM_VTK}
-DVTK_DIR:PATH=${VTK_DIR