1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
# Make sure this file is included only once by creating globally unique varibles
# based on the name of this included file.
get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE)
if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED)
return()
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 VTK) #The find_package known name
set(proj VTK) #This local name
set(${extProjName}_REQUIRED_VERSION "6") #If a required version is necessary, then set this, else leave blank
#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})")
endif()
# Set dependency list
set(${proj}_DEPENDENCIES "")
if (${PROJECT_NAME}_USE_PYTHONQT)
list(APPEND ${proj}_DEPENDENCIES python)
endif()
# Include dependent projects if any
SlicerMacroCheckExternalProjectDependency(${proj})
if(NOT ( DEFINED "USE_SYSTEM_${extProjName}" AND "${USE_SYSTEM_${extProjName}}" ) )
#message(STATUS "${__indent}Adding project ${proj}")
# Set CMake OSX variable to pass down the external project
set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
if(APPLE)
list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DVTK_REQUIRED_OBJCXX_FLAGS:STRING="")
endif()
### --- Project specific additions here
set(VTK_WRAP_TCL OFF)
set(VTK_WRAP_PYTHON OFF)
if (${PROJECT_NAME}_USE_PYTHONQT)
set(VTK_WRAP_PYTHON ON)
endif()
set(VTK_PYTHON_ARGS)
if(${PROJECT_NAME}_USE_PYTHONQT)
set(VTK_PYTHON_ARGS
-DVTK_INSTALL_PYTHON_USING_CMAKE:BOOL=ON
-DPYTHON_EXECUTABLE:PATH=${slicer_PYTHON_EXECUTABLE}
-DPYTHON_INCLUDE_DIR:PATH=${slicer_PYTHON_INCLUDE}
-DPYTHON_LIBRARY:FILEPATH=${slicer_PYTHON_LIBRARY}
)
endif()
set(VTK_QT_ARGS)
if(${PRIMARY_PROJECT_NAME}_USE_QT)
if(NOT APPLE)
set(VTK_QT_ARGS
#-DDESIRED_QT_VERSION:STRING=4 # Unused
-DVTK_USE_GUISUPPORT:BOOL=ON
-DVTK_USE_QVTK_QTOPENGL:BOOL=ON
-DVTK_USE_QT:BOOL=ON
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
)
else()
set(VTK_QT_ARGS
-DVTK_USE_CARBON:BOOL=OFF
# Default to Cocoa, VTK/CMakeLists.txt will enable Carbon and disable cocoa if needed
-DVTK_USE_COCOA:BOOL=ON
-DVTK_USE_X:BOOL=OFF
#-DVTK_USE_RPATH:BOOL=ON # Unused
#-DDESIRED_QT_VERSION:STRING=4 # Unused
-DVTK_USE_GUISUPPORT:BOOL=ON
-DVTK_USE_QVTK_QTOPENGL:BOOL=ON
-DVTK_USE_QT:BOOL=ON
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
)
endif()
find_package(Qt4 REQUIRED)
else()
set(VTK_QT_ARGS
-DVTK_USE_GUISUPPORT:BOOL=OFF
-DVTK_USE_QT:BOOL=OFF
)
endif()
# Disable Tk when Python wrapping is enabled
if (${PROJECT_NAME}_USE_PYTHONQT)
list(APPEND VTK_QT_ARGS -DVTK_USE_TK:BOOL=OFF)
endif()
set(slicer_TCL_LIB)
set(slicer_TK_LIB)
set(slicer_TCLSH)
set(VTK_TCL_ARGS)
if(VTK_WRAP_TCL)
if(WIN32)
set(slicer_TCL_LIB ${CMAKE_BINARY_DIR}/tcl-build/lib/tcl84.lib)
set(slicer_TK_LIB ${CMAKE_BINARY_DIR}/tcl-build/lib/tk84.lib)
set(slicer_TCLSH ${CMAKE_BINARY_DIR}/tcl-build/bin/tclsh.exe)
elseif(APPLE)
set(slicer_TCL_LIB ${CMAKE_BINARY_DIR}/tcl-build/lib/libtcl8.4.dylib)
set(slicer_TK_LIB ${CMAKE_BINARY_DIR}/tcl-build/lib/libtk8.4.dylib)
set(slicer_TCLSH ${CMAKE_BINARY_DIR}/tcl-build/bin/tclsh84)
else()
set(slicer_TCL_LIB ${CMAKE_BINARY_DIR}/tcl-build/lib/libtcl8.4.so)
set(slicer_TK_LIB ${CMAKE_BINARY_DIR}/tcl-build/lib/libtk8.4.so)
set(slicer_TCLSH ${CMAKE_BINARY_DIR}/tcl-build/bin/tclsh84)
endif()
set(VTK_TCL_ARGS
-DTCL_INCLUDE_PATH:PATH=${CMAKE_BINARY_DIR}/tcl-build/include
-DTK_INCLUDE_PATH:PATH=${CMAKE_BINARY_DIR}/tcl-build/include
-DTCL_LIBRARY:FILEPATH=${slicer_TCL_LIB}
-DTK_LIBRARY:FILEPATH=${slicer_TK_LIB}
-DTCL_TCLSH:FILEPATH=${slicer_TCLSH}
)
endif()
set(VTK_BUILD_STEP "")
if(UNIX)
configure_file(SuperBuild/External_VTK_build_step.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/External_VTK_build_step.cmake
@ONLY)
set(VTK_BUILD_STEP ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/External_VTK_build_step.cmake)
endif()
set(${proj}_CMAKE_OPTIONS
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/${proj}-install
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
-DVTK_USE_PARALLEL:BOOL=ON
-DVTK_DEBUG_LEAKS:BOOL=${${PROJECT_NAME}_USE_VTK_DEBUG_LEAKS}
-DVTK_LEGACY_REMOVE:BOOL=OFF
-DVTK_WRAP_TCL:BOOL=${VTK_WRAP_TCL}
#-DVTK_USE_RPATH:BOOL=ON # Unused
${VTK_TCL_ARGS}
-DVTK_WRAP_PYTHON:BOOL=${VTK_WRAP_PYTHON}
-DVTK_INSTALL_LIB_DIR:PATH=${${PROJECT_NAME}_INSTALL_LIB_DIR}
${VTK_PYTHON_ARGS}
${VTK_QT_ARGS}
${VTK_MAC_ARGS}
)
### --- End Project specific additions
set(${proj}_REPOSITORY https://github.com/Kitware/VTK.git)
set(${proj}_GIT_TAG 836c511abf0b8d97599b25f9b26658b8636ed8d7 )
ExternalProject_Add(${proj}
GIT_REPOSITORY ${${proj}_REPOSITORY}
GIT_TAG ${${proj}_GIT_TAG}
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
BUILD_COMMAND ${VTK_BUILD_STEP}
LOG_CONFIGURE 0 # Wrap configure in script to ignore log output from dashboards
LOG_BUILD 0 # Wrap build in script to to ignore log output from dashboards
LOG_TEST 0 # Wrap test in script to to ignore log output from dashboards
LOG_INSTALL 0 # Wrap install in script to to ignore log output from dashboards
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
-Wno-dev
--no-warn-unused-cli
${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 ""
DEPENDS
${${proj}_DEPENDENCIES}
)
# set(VTKPatchScript ${CMAKE_CURRENT_LIST_DIR}/External_VTK_patch.cmake)
# ExternalProject_Add_Step(${proj} VTKPatch
# COMMENT "get rid of obsolete C/CXX flags"
# DEPENDEES download
# DEPENDERS configure
# COMMAND ${CMAKE_COMMAND}
# -DVTKSource=<SOURCE_DIR>
# -P ${VTKPatchScript}
# )
set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install/lib/vtk-6.2)
else()
if(${USE_SYSTEM_${extProjName}})
find_package(${extProjName} ${${extProjName}_REQUIRED_VERSION} REQUIRED)
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)
|