Commit 329ade35 authored by jcfr's avatar jcfr

STYLE: Facilitate maintenance of external projects improving consistency

All projects now:
* systematically download archives or checkout sources in the top-level directory.
* use variables like EP_SOURCE_DIR, EP_BINARY_DIR or EP_INSTALL_DIR

This commit also:
* updates top-level CMakeLists to explicitly set variables SUPERBUILD_TOPLEVEL_PROJECT
  and EXTERNAL_PROJECT_DIR options instead of relying on their implicit values.
* includes CMake module ListToString where used.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@26528 3bd1e089-480b-0410-8dfb-8563597acbee
parent 3cf8c8da
......@@ -21,6 +21,8 @@ message(STATUS "${_msg} - C++${CMAKE_CXX_STANDARD}")
#-----------------------------------------------------------------------------
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
set(SUPERBUILD_TOPLEVEL_PROJECT Slicer)
set(EXTERNAL_PROJECT_DIR ${Slicer_SOURCE_DIR}/SuperBuild)
include(ExternalProject)
include(ExternalProjectDependency)
include(ExternalProjectDependencyForPython)
......
......@@ -247,9 +247,9 @@ list_conditional_append(Slicer_BUILD_SimpleFilters Slicer_REMOTE_DEPENDENCIES Si
set(BRAINSTools_options
BRAINSTools_SUPERBUILD:BOOL=OFF
BRAINSTools_CLI_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_LIB_DIR}
BRAINSTools_CLI_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_LIB_DIR}
BRAINSTools_CLI_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_BIN_DIR}
BRAINSTools_CLI_LIBRARY_OUTPUT_DIRECTORY:PATH=${Slicer_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_LIB_DIR}
BRAINSTools_CLI_ARCHIVE_OUTPUT_DIRECTORY:PATH=${Slicer_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_LIB_DIR}
BRAINSTools_CLI_RUNTIME_OUTPUT_DIRECTORY:PATH=${Slicer_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_BIN_DIR}
BRAINSTools_CLI_INSTALL_LIBRARY_DESTINATION:PATH=${Slicer_INSTALL_CLIMODULES_LIB_DIR}
BRAINSTools_CLI_INSTALL_ARCHIVE_DESTINATION:PATH=${Slicer_INSTALL_CLIMODULES_LIB_DIR}
BRAINSTools_CLI_INSTALL_RUNTIME_DESTINATION:PATH=${Slicer_INSTALL_CLIMODULES_BIN_DIR}
......@@ -299,7 +299,7 @@ Slicer_Remote_Add(BRAINSTools
list_conditional_append(Slicer_BUILD_BRAINSTOOLS Slicer_REMOTE_DEPENDENCIES BRAINSTools)
if(Slicer_BUILD_BRAINSTOOLS)
# This is added to SlicerConfig and is useful for extension depending on BRAINSTools
set(BRAINSCommonLib_DIR "${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/Modules/Remote/BRAINSTools/BRAINSCommonLib")
set(BRAINSCommonLib_DIR "${Slicer_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/Modules/Remote/BRAINSTools/BRAINSCommonLib")
mark_as_superbuild(BRAINSCommonLib_DIR:PATH)
endif()
......@@ -362,8 +362,6 @@ if(Slicer_ADDITIONAL_PROJECTS)
mark_as_superbuild(Slicer_ADDITIONAL_PROJECTS:STRING)
endif()
include(ListToString)
ExternalProject_Include_Dependencies(Slicer DEPENDS_VAR Slicer_DEPENDENCIES)
set(EXTERNAL_PROJECT_OPTIONAL_ARGS)
......@@ -412,7 +410,7 @@ ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
DEPENDS ${Slicer_DEPENDENCIES} ${Slicer_REMOTE_DEPENDENCIES}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
BINARY_DIR ${Slicer_BINARY_INNER_SUBDIR}
BINARY_DIR ${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
CMAKE_CACHE_ARGS
......
......@@ -86,12 +86,15 @@ if(NOT DEFINED CTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -132,7 +135,7 @@ if(NOT DEFINED CTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
ExternalProject_GenerateProjectDescription_Step(${proj})
set(CTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(CTK_DIR ${EP_BINARY_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
......
......@@ -35,12 +35,14 @@ if(Slicer_USE_CTKAPPLAUNCHER)
set(md5 "1f0d86b1eeb386d6892a76db7b111280")
endif()
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj})
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
URL https://github.com/commontk/AppLauncher/releases/download/v${launcher_version}/CTKAppLauncher-${launcher_version}-${CTKAPPLAUNCHER_OS}-${CTKAPPLAUNCHER_ARCHITECTURE}.tar.gz
URL_MD5 ${md5}
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${EP_BINARY_DIR}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
......@@ -53,7 +55,7 @@ if(Slicer_USE_CTKAPPLAUNCHER)
VERSION ${launcher_version}
)
set(CTKAppLauncher_DIR ${CMAKE_BINARY_DIR}/${proj})
set(CTKAppLauncher_DIR ${EP_BINARY_DIR})
else()
ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
......
......@@ -41,12 +41,15 @@ if(NOT DEFINED CTKAppLauncherLib_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${
)
endif()
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -68,7 +71,7 @@ if(NOT DEFINED CTKAppLauncherLib_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${
ExternalProject_GenerateProjectDescription_Step(${proj})
set(CTKAppLauncherLib_DIR ${CMAKE_BINARY_DIR}/CTKAppLauncherLib-build)
set(CTKAppLauncherLib_DIR ${EP_BINARY_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
......
......@@ -31,11 +31,15 @@ if(NOT DEFINED CTKResEdit_EXECUTABLE)
set(url "${url}&id=${item_id}&dummy=CTKResEdit-${CTKResEdit_VERSION}-${CTKResEdit_OS}-${CTKResEdit_ARCHITECTURE}.tar.gz")
set(md5 "f59547c480420199081b94e96df292ec")
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj})
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
URL ${url}
URL_MD5 ${md5}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${EP_BINARY_DIR}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
......@@ -47,7 +51,7 @@ if(NOT DEFINED CTKResEdit_EXECUTABLE)
VERSION ${CTKResEdit_VERSION}
)
set(CTKResEdit_EXECUTABLE ${CMAKE_BINARY_DIR}/${proj}/bin/CTKResEdit.exe)
set(CTKResEdit_EXECUTABLE ${EP_BINARY_DIR}/bin/CTKResEdit.exe)
else()
ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
......
......@@ -67,12 +67,15 @@ if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -101,7 +104,7 @@ if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
ExternalProject_GenerateProjectDescription_Step(${proj})
set(DCMTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(DCMTK_DIR ${EP_BINARY_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
......
......@@ -88,12 +88,15 @@ if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
)
endif()
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......
......@@ -41,12 +41,16 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -74,9 +78,9 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${proj}_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(${proj}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(${proj}_INCLUDE_DIR ${${proj}_SOURCE_DIR}/include)
set(${proj}_DIR ${EP_BINARY_DIR})
set(${proj}_SOURCE_DIR ${EP_SOURCE_DIR})
set(${proj}_INCLUDE_DIR ${EP_SOURCE_DIR}/include)
if(WIN32)
set(lib_prefix "")
set(lib_ext "lib")
......
......@@ -52,13 +52,17 @@ if((NOT DEFINED LibArchive_INCLUDE_DIR
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(EP_INSTALL_DIR ${CMAKE_BINARY_DIR}/${proj}-install)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
INSTALL_DIR LibArchive-install
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
INSTALL_DIR ${EP_INSTALL_DIR}
CMAKE_CACHE_ARGS
# Not used -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
# Not used -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -88,7 +92,7 @@ if((NOT DEFINED LibArchive_INCLUDE_DIR
)
if(APPLE)
ExternalProject_Add_Step(${proj} fix_rpath
COMMAND install_name_tool -id ${CMAKE_BINARY_DIR}/${proj}-install/lib/libarchive.16.dylib ${CMAKE_BINARY_DIR}/${proj}-install/lib/libarchive.16.dylib
COMMAND install_name_tool -id ${EP_INSTALL_DIR}/lib/libarchive.16.dylib ${EP_INSTALL_DIR}/lib/libarchive.16.dylib
DEPENDEES install
)
endif()
......
......@@ -84,6 +84,7 @@ ExternalProject_Execute(${proj} \"install\" \"${PYTHON_EXECUTABLE}\" setup.py in
${${proj}_EP_ARGS}
URL "https://pypi.python.org/packages/c0/3a/40967d9f5675fbb097ffec170f59c2ba19fc96373e73ad47c2cae9a30aed/numpy-${_version}.zip"
URL_MD5 "2c3c0f4edf720c3a7b525dacc825b9ae"
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${proj}
BUILD_IN_SOURCE 1
PATCH_COMMAND
......
......@@ -37,12 +37,15 @@ if(NOT DEFINED OpenIGTLink_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR OpenIGTLink
BINARY_DIR OpenIGTLink-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -65,7 +68,7 @@ if(NOT DEFINED OpenIGTLink_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
ExternalProject_GenerateProjectDescription_Step(${proj})
set(OpenIGTLink_DIR ${CMAKE_BINARY_DIR}/OpenIGTLink-build)
set(OpenIGTLink_DIR ${EP_BINARY_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
......
......@@ -109,7 +109,7 @@ ExternalProject_Execute(${proj} \"configure\" sh config --with-zlib-lib=${_zlib_
${${proj}_EP_ARGS}
URL ${OpenSSL_${OPENSSL_DOWNLOAD_VERSION}_URL}
URL_MD5 ${OpenSSL_${OPENSSL_DOWNLOAD_VERSION}_MD5}
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${EP_SOURCE_DIR}
BUILD_IN_SOURCE 1
PATCH_COMMAND ${CMAKE_COMMAND} -P ${_configure_script}
......@@ -245,7 +245,7 @@ this version of visual studio [${MSVC_VERSION}]. You could either:
${${proj}_EP_ARGS}
URL ${OpenSSL_${OPENSSL_DOWNLOAD_VERSION}_${MSVC_VERSION}_URL}
URL_MD5 ${OpenSSL_${OPENSSL_DOWNLOAD_VERSION}_${MSVC_VERSION}_MD5}
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${EP_SOURCE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
......
......@@ -21,17 +21,16 @@ if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# PCRE (Perl Compatible Regular Expressions)
#
# follow the standard EP_PREFIX locations
set(pcre_binary_dir ${CMAKE_CURRENT_BINARY_DIR}/PCRE-prefix/src/PCRE-build)
set(pcre_source_dir ${CMAKE_CURRENT_BINARY_DIR}/PCRE-prefix/src/PCRE)
set(pcre_install_dir ${CMAKE_CURRENT_BINARY_DIR}/PCRE)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/PCRE)
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/PCRE-build)
set(EP_INSTALL_DIR ${CMAKE_BINARY_DIR}/PCRE-install)
include(ExternalProjectForNonCMakeProject)
include(ExternalProjectForNonCMakeProject)
# environment
set(_env_script ${CMAKE_BINARY_DIR}/${proj}_Env.cmake)
ExternalProject_Write_SetBuildEnv_Commands(${_env_script})
file(APPEND ${_env_script}
# environment
set(_env_script ${CMAKE_BINARY_DIR}/${proj}_Env.cmake)
ExternalProject_Write_SetBuildEnv_Commands(${_env_script})
file(APPEND ${_env_script}
"#------------------------------------------------------------------------------
# Added by '${CMAKE_CURRENT_LIST_FILE}'
......@@ -39,13 +38,13 @@ set(ENV{YACC} \"${BISON_EXECUTABLE}\")
set(ENV{YFLAGS} \"${BISON_FLAGS}\")
")
# configure step
set(_configure_script ${CMAKE_BINARY_DIR}/${proj}_configure_step.cmake)
file(WRITE ${_configure_script}
# configure step
set(_configure_script ${CMAKE_BINARY_DIR}/${proj}_configure_step.cmake)
file(WRITE ${_configure_script}
"include(\"${_env_script}\")
set(${proj}_WORKING_DIR \"${pcre_binary_dir}\")
ExternalProject_Execute(${proj} \"configure\" sh ${pcre_source_dir}/configure
--prefix=${pcre_install_dir} --disable-shared)
set(${proj}_WORKING_DIR \"${EP_BINARY_DIR}\")
ExternalProject_Execute(${proj} \"configure\" sh ${EP_SOURCE_DIR}/configure
--prefix=${EP_INSTALL_DIR} --disable-shared)
")
set(_version "8.38")
......@@ -54,6 +53,9 @@ ExternalProject_Execute(${proj} \"configure\" sh ${pcre_source_dir}/configure
${${proj}_EP_ARGS}
URL http://slicer.kitware.com/midas3/download/item/263369/pcre-${_version}.tar.gz
URL_MD5 8a353fe1450216b6655dfcf3561716d9
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
UPDATE_COMMAND "" # Disable update
CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${_configure_script}
DEPENDS
......@@ -63,4 +65,6 @@ ExternalProject_Execute(${proj} \"configure\" sh ${pcre_source_dir}/configure
ExternalProject_GenerateProjectDescription_Step(${proj}
VERSION ${_version}
)
set(PCRE_DIR ${EP_INSTALL_DIR})
endif()
......@@ -35,12 +35,15 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -61,8 +64,8 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${proj}_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(${proj}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(${proj}_DIR ${EP_BINARY_DIR})
set(${proj}_SOURCE_DIR ${EP_SOURCE_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
......
......@@ -36,12 +36,15 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -64,8 +67,8 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${proj}_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(${proj}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(${proj}_DIR ${EP_BINARY_DIR})
set(${proj}_SOURCE_DIR ${EP_SOURCE_DIR})
set(${proj}_INCLUDE_DIR ${${proj}_SOURCE_DIR}/include)
else()
......
......@@ -85,12 +85,15 @@ if(NOT DEFINED SlicerExecutionModel_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -120,7 +123,7 @@ if(NOT DEFINED SlicerExecutionModel_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM
ExternalProject_GenerateProjectDescription_Step(${proj})
set(SlicerExecutionModel_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(SlicerExecutionModel_DIR ${EP_BINARY_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
......
......@@ -17,19 +17,21 @@ if(NOT SWIG_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(SWIG_DOWNLOAD_WIN_HASH "f229724fe856aa78df6128ecfefe6e0a")
if(WIN32)
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION})
# swig.exe available as pre-built binary on Windows:
ExternalProject_Add(Swig
URL http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${SWIG_DOWNLOAD_WIN_HASH}&name=swigwin-${SWIG_TARGET_VERSION}.zip
URL_MD5 ${SWIG_DOWNLOAD_WIN_HASH}
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}"
SOURCE_DIR "${EP_BINARY_DIR}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_COMMAND ""
)
set(SWIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}") # path specified as source in ep
set(SWIG_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}/swig.exe")
set(SWIG_DIR "${EP_BINARY_DIR}") # path specified as source in ep
set(SWIG_EXECUTABLE "${EP_BINARY_DIR}/swig.exe")
set(Swig_DEPEND Swig)
else()
......@@ -50,10 +52,9 @@ if(NOT SWIG_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(BISON_FLAGS "" CACHE STRING "Flags used by bison")
mark_as_advanced(BISON_FLAGS)
# follow the standard EP_PREFIX locations
set(swig_binary_dir ${CMAKE_CURRENT_BINARY_DIR}/Swig-prefix/src/Swig-build)
set(swig_source_dir ${CMAKE_CURRENT_BINARY_DIR}/Swig-prefix/src/Swig)
set(swig_install_dir ${CMAKE_CURRENT_BINARY_DIR}/Swig)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/Swig)
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/Swig-build)
set(EP_INSTALL_DIR ${CMAKE_BINARY_DIR}/Swig-install)
include(ExternalProjectForNonCMakeProject)
......@@ -72,10 +73,10 @@ set(ENV{YFLAGS} \"${BISON_FLAGS}\")
set(_configure_script ${CMAKE_BINARY_DIR}/${proj}_configure_step.cmake)
file(WRITE ${_configure_script}
"include(\"${_env_script}\")
set(${proj}_WORKING_DIR \"${swig_binary_dir}\")
ExternalProject_Execute(${proj} \"configure\" sh ${swig_source_dir}/configure
--prefix=${swig_install_dir}
--with-pcre-prefix=${pcre_install_dir}
set(${proj}_WORKING_DIR \"${EP_BINARY_DIR}\")
ExternalProject_Execute(${proj} \"configure\" sh ${EP_SOURCE_DIR}/configure
--prefix=${EP_INSTALL_DIR}
--with-pcre-prefix=${PCRE_DIR}
--without-octave
--with-python=${PYTHON_EXECUTABLE})
")
......@@ -83,12 +84,15 @@ ExternalProject_Execute(${proj} \"configure\" sh ${swig_source_dir}/configure
ExternalProject_add(Swig
URL http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${SWIG_DOWNLOAD_SOURCE_HASH}&name=swig-${SWIG_TARGET_VERSION}.tar.gz
URL_MD5 ${SWIG_DOWNLOAD_SOURCE_HASH}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${_configure_script}
DEPENDS ${${proj}_DEPENDENCIES}
)
set(SWIG_DIR "${swig_install_dir}/share/swig/${SWIG_TARGET_VERSION}")
set(SWIG_EXECUTABLE ${swig_install_dir}/bin/swig)
set(SWIG_DIR "${EP_INSTALL_DIR}/share/swig/${SWIG_TARGET_VERSION}")
set(SWIG_EXECUTABLE ${EP_INSTALL_DIR}/bin/swig)
set(Swig_DEPEND Swig)
endif()
......
......@@ -132,12 +132,15 @@ endif()
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BINARY_DIR ${proj}-build
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......@@ -175,22 +178,8 @@ endif()
ExternalProject_GenerateProjectDescription_Step(${proj})
set(VTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(VTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
# set(PNG_INCLUDE_DIR ${VTK_SOURCE_DIR}/ThirdParty/png/vtkpng)
# set(PNG_LIBRARY_DIR ${VTK_DIR}/lib)
# if(CMAKE_CONFIGURATION_TYPES)
# set(PNG_LIBRARY_DIR ${PNG_LIBRARY_DIR}/${CMAKE_CFG_INTDIR})
# endif()
# if(WIN32)
# set(PNG_LIBRARY ${PNG_LIBRARY_DIR}/vtkpng-6.0.lib)
# elseif(APPLE)
# set(PNG_LIBRARY ${PNG_LIBRARY_DIR}/libvtkpng-6.0.dylib)
# else()
# set(PNG_LIBRARY ${PNG_LIBRARY_DIR}/libvtkpng-6.0.so)
# endif()
set(VTK_DIR ${EP_BINARY_DIR})
set(VTK_SOURCE_DIR ${EP_SOURCE_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
......@@ -240,6 +229,3 @@ mark_as_superbuild(
VARS VTK_DIR:PATH
LABELS "FIND_PACKAGE"
)
ExternalProject_Message(${proj} "PNG_INCLUDE_DIR:${PNG_INCLUDE_DIR}")
ExternalProject_Message(${proj} "PNG_LIBRARY:${PNG_LIBRARY}")
......@@ -30,10 +30,6 @@ if((NOT DEFINED BZIP2_INCLUDE_DIR
set(git_protocol "git")
endif()
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(EP_INSTALL_DIR ${CMAKE_BINARY_DIR}/${proj}-install)
ExternalProject_SetIfNotDefined(
${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY
"${git_protocol}://github.com/commontk/bzip2.git"
......@@ -46,6 +42,10 @@ if((NOT DEFINED BZIP2_INCLUDE_DIR
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(EP_INSTALL_DIR ${CMAKE_BINARY_DIR}/${proj}-install)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
......
......@@ -49,9 +49,6 @@ if((NOT DEFINED CURL_INCLUDE_DIR
set(${proj}_CMAKE_C_FLAGS "${ep_common_c_flags} -fPIC")
endif()
set(EP_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(EP_INSTALL_DIR ${CMAKE_BINARY_DIR}/${proj}-install)
ExternalProject_SetIfNotDefined(
${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY
"${git_protocol}://github.com/Slicer/curl.git"
......@@ -64,12 +61,16 @@ if((NOT DEFINED CURL_INCLUDE_DIR
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
set(EP_INSTALL_DIR ${CMAKE_BINARY_DIR}/${proj}-install)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}"
GIT_TAG "${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG}"
SOURCE_DIR curl
BINARY_DIR ${EP_BUILD_DIR}
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
#Not needed -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
#Not needed -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
......
......@@ -15,10 +15,6 @@ if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(INCR_TCL_VERSION_DOT "4.0")
set(INCR_TCL_VERSION "40")
set(incrTcl_DOWNLOAD_COMMAND
URL "http://slicer.kitware.com/midas3/download/item/155632/itcl4.0.1.tar.gz"
URL_MD5 "8d71d4247b19ad5d6bcbb776590ced55"
)
if(UNIX)
......@@ -56,9 +52,11 @@ ExternalProject_Execute(${proj} \"install\" make install)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
${incrTcl_DOWNLOAD_COMMAND}
URL "http://slicer.kitware.com/midas3/download/item/155632/itcl4.0.1.tar.gz"
URL_MD5 "8d71d4247b19ad5d6bcbb776590ced55"
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
UPDATE_COMMAND "" # Disable update
SOURCE_DIR tcl/incrTcl
SOURCE_DIR ${tcl_base}/incrTcl
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${_configure_script}
BUILD_COMMAND ${CMAKE_COMMAND} -P ${_build_script}
......
......@@ -27,7 +27,8 @@ if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
${${proj}_EP_ARGS}
URL "https://pypi.python.org/packages/e1/ec/9f2bbc86a0188bf83221212be87fa4b70dc71a9385efcc95a25e9789894e/GitPython-${_version}.tar.gz"
URL_MD5 "a63fdd2a650694ea23e268fd0c952034"
SOURCE_DIR ${proj}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
......
......@@ -26,7 +26,8 @@ if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
${${proj}_EP_ARGS}
URL "https://pypi.python.org/packages/1a/2d/7c1ee64a1b477c22eca28a583464172c92403df87ccdf56b34eabf68fce4/PyGithub-${_version}.tar.gz"
URL_MD5 "c921400a5c1acd4b7d7c4fd9ee42650d"
SOURCE_DIR ${proj}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
......
......@@ -25,7 +25,8 @@ if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
${${proj}_EP_ARGS}
URL "https://pypi.python.org/packages/48/69/d87c60746b393309ca30761f8e2b49473d43450b150cb08f3c6df5c11be5/appdirs-${_version}.tar.gz"
URL_MD5 "44c679904082a2133f5566c8a0d3ab42"
SOURCE_DIR ${proj}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
......
......@@ -26,7 +26,8 @@ if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
${${proj}_EP_ARGS}
URL "https://pypi.python.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-${_version}.tar.gz"
URL_MD5 "7dd1ba7f9c77e32351b0a0cfacf4055c"
SOURCE_DIR ${proj}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
......
......@@ -25,7 +25,8 @@ if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
${${proj}_EP_ARGS}
URL "https://pypi.python.org/packages/9a/e8/c3c8da6d00145aaca07f2b784794917613dad26532068da4e8392dc48d7f/CouchDB-${_version}.tar.gz"
URL_MD5 "2ed5ad2a477fd3cb472ed6dc5a381ff3"
SOURCE_DIR ${proj}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}