Skip to content

Commit

Permalink
COMP: Fix double-convert external project so that it works as intended
Browse files Browse the repository at this point in the history
1) The previous version was working because the double-conversion project
was exporting its build tree in the cmake package registry.

See http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command:export

Since the package was exported, the find_package(double-conversion ..) within
BRAINSTools was working. Line like the following weren't not used at all:

  list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH)

2) Remove dependency to DCMTK. See BRAINSia/BRAINSTools#5

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21791 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information
jcfr committed Mar 12, 2013
1 parent 3f9c8b0 commit 67f21d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 51 deletions.
3 changes: 2 additions & 1 deletion SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ if(Slicer_BUILD_CLI_SUPPORT)
endif()

if(Slicer_BUILD_BRAINSTOOLS)
list(APPEND Slicer_DEPENDENCIES BRAINSTools DoubleConvert)
list(APPEND Slicer_DEPENDENCIES BRAINSTools)
endif()

if(Slicer_BUILD_EMSegment)
Expand Down Expand Up @@ -296,6 +296,7 @@ endif()

if(Slicer_BUILD_BRAINSTOOLS)
list(APPEND ep_superbuild_extra_args -DBRAINSTools_SOURCE_DIR:PATH=${BRAINSTools_SOURCE_DIR})
list(APPEND ep_superbuild_extra_args -DDoubleConvert_DIR:PATH=${DoubleConvert_DIR})
endif()

if(Slicer_BUILD_MultiVolumeExplorer)
Expand Down
2 changes: 1 addition & 1 deletion SuperBuild/External_BRAINSTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(DEFINED BRAINSTools_SOURCE_DIR AND NOT EXISTS ${BRAINSTools_SOURCE_DIR})
endif()

# Set dependency list
set(BRAINSTools_DEPENDENCIES ${ITK_EXTERNAL_NAME} SlicerExecutionModel VTK )
set(BRAINSTools_DEPENDENCIES ${ITK_EXTERNAL_NAME} SlicerExecutionModel VTK DoubleConvert)

# Include dependent projects if any
SlicerMacroCheckExternalProjectDependency(BRAINSTools)
Expand Down
66 changes: 17 additions & 49 deletions SuperBuild/External_DoubleConvert.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,20 @@ if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED)
endif()
set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1)

## External_${extProjName}.cmake files can be recurisvely included,
## and cmake variables are global, so when including sub projects it
## is important make the extProjName and proj variables
## appear to stay constant in one of these files.
## Store global variables before overwriting (then restore at end of this file.)
#ProjectDependancyPush(CACHED_extProjName ${extProjName})
#ProjectDependancyPush(CACHED_proj ${proj})

# Make sure that the ExtProjName/IntProjName variables are unique globally
# even if other External_${ExtProjName}.cmake files are sourced by
# SlicerMacroCheckExternalProjectDependency
set(extProjName DoubleConvert) #The find_package known name
set(proj DoubleConvert) #This local name

#if(${USE_SYSTEM_${extProjName}})
# unset(${extProjName}_DIR CACHE)
#endif()

# Sanity checks
if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR})
message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})")
if(DEFINED DoubleConvert_DIR AND NOT EXISTS ${DoubleConvert_DIR})
message(FATAL_ERROR "DoubleConvert_DIR variable is defined but corresponds to non-existing directory")
endif()

# Set dependency list
set(${proj}_DEPENDENCIES "")
if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT)
list(APPEND ${proj}_DEPENDENCIES DCMTK)
endif()
set(DoubleConvert_DEPENDENCIES "")

# Include dependent projects if any
SlicerMacroCheckExternalProjectDependency(${proj})
SlicerMacroCheckExternalProjectDependency(DoubleConvert)
set(proj DoubleConvert)


if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) )
if(NOT DEFINED "DoubleConvert_DIR")
#message(STATUS "${__indent}Adding project ${proj}")

# Set CMake OSX variable to pass down the external project
Expand All @@ -51,51 +32,38 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
endif()

### --- Project specific additions here

if(NOT DEFINED git_protocol)
set(git_protocol "git")
endif()

set(${proj}_CMAKE_OPTIONS
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/${proj}-install
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/${proj}-install
)
### --- End Project specific additions

set(${proj}_REPOSITORY ${git_protocol}://github.com/BRAINSia/double-conversion.git)
set(${proj}_GIT_TAG 9014759697ed334753a8334e09ec8c01f9c53830)
ExternalProject_Add(${proj}
GIT_REPOSITORY ${${proj}_REPOSITORY}
GIT_TAG ${${proj}_GIT_TAG}
"${${PROJECT_NAME}_EP_UPDATE_IF_GREATER_288}"
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
-Wno-dev
--no-warn-unused-cli
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
${COMMON_EXTERNAL_PROJECT_ARGS}
${${proj}_CMAKE_OPTIONS}
## We really do want to install in order to limit # of include paths INSTALL_COMMAND ""
# INSTALL_COMMAND "" # Limit the number of include paths bu installing the project
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install/lib/cmake/ITK-4.4)
set(${proj}_DIR ${CMAKE_BINARY_DIR}/${proj}-install/lib/CMake/double-conversion)
else()
if(${USE_SYSTEM_${extProjName}})
find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED)
if(NOT ${extProjName}_DIR)
message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR")
endif()
message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}")
endif()
# The project is provided using ${extProjName}_DIR, nevertheless since other
# project may depend on ${extProjName}, let's add an 'empty' one
SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}")
endif()

list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH)

#ProjectDependancyPop(CACHED_extProjName extProjName)
#ProjectDependancyPop(CACHED_proj proj)

0 comments on commit 67f21d1

Please sign in to comment.