-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
253 lines (208 loc) · 8.74 KB
/
CMakeLists.txt
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
if( APPLE AND NOT CMAKE_CXX_COMPILER)
set ( CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE STRING "CXX compiler." FORCE)
endif( APPLE AND NOT CMAKE_CXX_COMPILER)
PROJECT(VMTK)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
ENDIF(COMMAND cmake_policy)
# vmtk versions number
SET(VMTK_VERSION_MAJOR 1)
SET(VMTK_VERSION_MINOR 0)
SET(VMTK_VERSION_PATCH 1)
SET(VMTK_VERSION
"${VMTK_VERSION_MAJOR}.${VMTK_VERSION_MINOR}.${VMTK_VERSION_PATCH}")
# Append the library version information to the library target properties.
OPTION(VMTK_WITH_LIBRARY_VERSION "Build with library version information" OFF)
IF(VMTK_WITH_LIBRARY_VERSION)
# This setting of SOVERSION assumes that any API change
# will increment either the minor or major version number of vmtk.
SET(VMTK_LIBRARY_PROPERTIES
VERSION "${VMTK_VERSION}"
SOVERSION "${VMTK_VERSION_MAJOR}.${VMTK_VERSION_MINOR}"
)
ENDIF(VMTK_WITH_LIBRARY_VERSION)
#-----------------------------------------------------------------------------
# ITK Setup
option( USE_SYSTEM_ITK
"Exclude ITK from SuperBuild and use an existing build instead." OFF )
if( USE_SYSTEM_ITK )
find_package( ITK REQUIRED )
include( ${ITK_USE_FILE} )
endif( USE_SYSTEM_ITK )
#-----------------------------------------------------------------------------
# VTK Setup
option( USE_SYSTEM_VTK
"Exclude VTK from SuperBuild and use an existing build instead." OFF )
if( USE_SYSTEM_VTK )
find_package( VTK REQUIRED )
include( ${VTK_USE_FILE} )
endif( USE_SYSTEM_VTK )
#-----------------------------------------------------------------------------
# Superbuild setup
option( VMTK_USE_SUPERBUILD
"Build VMTK and the projects it depends on via SuperBuild.cmake." ON )
option( VMTK_BUNJEE_BUILD
"Build VMTK and the projects it depends on ready for being linked from Bunjee." OFF )
#if( APPLE )
# set ( CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE STRING "CXX compiler." FORCE)
#endif( APPLE )
if( VMTK_USE_SUPERBUILD )
if( NOT GIT_EXECUTABLE )
find_package( Git REQUIRED )
endif( NOT GIT_EXECUTABLE )
option( GIT_PROTOCOL_HTTPS
"Use HTTPS for git access (useful if behind a firewall)" OFF )
if( GIT_PROTOCOL_HTTPS )
set( GIT_PROTOCOL "https" CACHE STRING "Https protocol for file transfer" FORCE )
else( GIT_PROTOCOL_HTTPS )
set( GIT_PROTOCOL "git" CACHE STRING "Git protocol for file transfer" FORCE )
endif( GIT_PROTOCOL_HTTPS )
mark_as_advanced( GIT_PROTOCOL )
if( VMTK_BUNJEE_BUILD )
set ( VTK_VMTK_WRAP_PYTHON OFF CACHE BOOL "" FORCE )
set ( VMTK_CONTRIB_SCRIPTS OFF CACHE BOOL "" FORCE )
set ( VMTK_ENABLE_DISTRIBUTION OFF CACHE BOOL "" FORCE )
#set ( VMTK_BUILD_TETGEN OFF CACHE BOOL "" FORCE )
set ( VMTK_SCRIPTS_ENABLED OFF CACHE BOOL "" FORCE )
set ( BUILD_EXAMPLES OFF CACHE BOOL "" FORCE )
set ( BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE )
set ( BUILD_TESTING OFF CACHE BOOL "" FORCE )
set ( VTK_USE_CARBON OFF )
set ( VTK_USE_COCOA ON )
set ( VTK_VMTK_USE_COCOA ON )
set ( VTK_USE_INFOVIS OFF )
set ( VTK_USE_N_WAY_ARRAYS OFF )
set ( VTK_USE_PARALLEL OFF )
set ( VTK_USE_QT OFF )
set ( VTK_USE_RENDERING ON )
set ( VTK_USE_TEXT_ANALYSIS OFF )
set ( VTK_USE_X OFF )
set ( VTK_WRAP_PYTHON OFF )
set ( VTK_WRAP_TCL OFF )
set ( ITK_USE_FLAT_DIRECTORY_INSTALL ON )
set ( CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "" FORCE )
set ( CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE )
set ( ITK_NO_LIBRARY_VERSION ON )
set ( VTK_NO_LIBRARY_VERSION ON )
set ( VMTK_WITH_LIBRARY_VERSION OFF )
set ( VTK_REQUIRED_OBJCXX_FLAGS "-fobjc-gc" CACHE STRING "" FORCE)
else (VMTK_BUNJEE_BUILD)
option ( VTK_VMTK_WRAP_PYTHON "Generate Python wrappings for C++ classes." ON )
option ( VMTK_CONTRIB_SCRIPTS "Install modules from the vmtkScripts/contrib directory." ON )
option ( VTK_VMTK_CONTRIB "Build and install classes in the vtkVmtk/Contrib directory." ON )
option ( VMTK_ENABLE_DISTRIBUTION "Enable distribution targets." OFF )
option ( VMTK_BUILD_TETGEN "Build TetGen and TetGen wrapper. Check TetGen license before you activate this." ON )
option ( VMTK_BUILD_STREAMTRACER "Build static temporal stream tracer." ON )
if (APPLE)
option ( VTK_VMTK_USE_COCOA "Build with Cocoa support." ON )
set ( CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "" FORCE )
endif (APPLE)
set ( CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE )
option ( BUILD_SHARED_LIBS "Build shared libraries." ON )
option ( VTK_USE_RENDERING "Build VTK rendering classes." ON )
option ( VTK_USE_HYBRID "Build VTK Hybrid classes." ON )
OPTION(VMTK_SCRIPTS_ENABLED "Build and install vmtkScripts and Pypes" ON)
OPTION(VMTK_MINIMAL_INSTALL "Do not install individual scripts, only vmtk.py" OFF)
endif (VMTK_BUNJEE_BUILD)
include( "${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake" )
return()
else( VMTK_USE_SUPERBUILD )
if ( NOT ITK_FOUND )
find_package( ITK REQUIRED )
include( ${ITK_USE_FILE} )
endif( NOT ITK_FOUND )
if ( NOT VTK_FOUND )
find_package( VTK REQUIRED )
include( ${VTK_USE_FILE} )
endif( NOT VTK_FOUND )
endif( VMTK_USE_SUPERBUILD )
OPTION(VMTK_SCRIPTS_ENABLED "Build and install vmtkScripts and Pypes" ON)
MARK_AS_ADVANCED(VMTK_SCRIPTS_ENABLED)
IF(VMTK_SCRIPTS_ENABLED)
SUBDIRS(
PypeS
vtkVmtk
vmtkScripts
)
ELSE(VMTK_SCRIPTS_ENABLED)
SUBDIRS(
vtkVmtk
)
ENDIF(VMTK_SCRIPTS_ENABLED)
OPTION(VMTK_MINIMAL_INSTALL "Do not install individual scripts, only vmtk.py" OFF)
SET(LIBRARY_OUTPUT_PATH ${VMTK_BINARY_DIR}/bin CACHE PATH
"Single output directory for building all libraries.")
SET(EXECUTABLE_OUTPUT_PATH ${VMTK_BINARY_DIR}/bin CACHE PATH
"Single output directory for building all executables.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
SET(VMTK_SRCS
vmtk.py
)
SET(VMTK_MODULE_SRCS
__init__.py.in
)
IF(NOT VMTK_INSTALL_BIN_DIR)
#SET(VMTK_INSTALL_BIN_DIR ${VMTK_INSTALL_ROOT}/bin)
SET(VMTK_INSTALL_BIN_DIR bin)
ENDIF(NOT VMTK_INSTALL_BIN_DIR)
IF(NOT VMTK_MODULE_INSTALL_LIB_DIR)
#SET(VMTK_MODULE_INSTALL_LIB_DIR ${VMTK_SCRIPTS_INSTALL_ROOT}/lib/vmtk/vmtk)
SET(VMTK_MODULE_INSTALL_LIB_DIR lib/vmtk/vmtk)
ENDIF(NOT VMTK_MODULE_INSTALL_LIB_DIR)
IF(VMTK_SCRIPTS_ENABLED)
FOREACH (SCRIPT_FILE ${VMTK_SRCS})
CONFIGURE_FILE(${VMTK_SOURCE_DIR}/${SCRIPT_FILE} ${VMTK_BINARY_DIR}/${SCRIPT_FILE} COPYONLY)
ENDFOREACH (SCRIPT_FILE)
CONFIGURE_FILE(${VMTK_SOURCE_DIR}/__init__.py.in ${VMTK_BINARY_DIR}/__init__.py COPYONLY)
INSTALL(FILES __init__.py.in
DESTINATION ${VMTK_MODULE_INSTALL_LIB_DIR}
COMPONENT RuntimeLibraries
RENAME __init__.py)
IF (NOT WIN32)
SET (STRIPPED_SCRIPTS_SRCS )
FOREACH (SCRIPT_FILE ${VMTK_SRCS})
CONFIGURE_FILE(${VMTK_SOURCE_DIR}/${SCRIPT_FILE} ${VMTK_BINARY_DIR}/${SCRIPT_FILE} COPYONLY)
STRING(REGEX REPLACE ".py" "" STRIPPED_SCRIPT_FILE ${SCRIPT_FILE})
CONFIGURE_FILE(${VMTK_SOURCE_DIR}/${SCRIPT_FILE} ${VMTK_BINARY_DIR}/${STRIPPED_SCRIPT_FILE} COPYONLY)
SET (STRIPPED_SCRIPTS_SRCS ${STRIPPED_SCRIPTS_SRCS} ${VMTK_BINARY_DIR}/${STRIPPED_SCRIPT_FILE})
ENDFOREACH (SCRIPT_FILE)
#INSTALL_PROGRAMS(${VMTK_INSTALL_BIN_DIR} FILES ${STRIPPED_SCRIPTS_SRCS})
INSTALL(PROGRAMS ${STRIPPED_SCRIPTS_SRCS}
DESTINATION ${VMTK_INSTALL_BIN_DIR}
COMPONENT RuntimeExecutables)
ELSE (NOT WIN32)
FOREACH (SCRIPT_FILE ${VMTK_SRCS})
CONFIGURE_FILE(${VMTK_SOURCE_DIR}/${SCRIPT_FILE} ${VMTK_BINARY_DIR}/${SCRIPT_FILE} COPYONLY)
STRING(REGEX REPLACE ".py" "-exe.py" STRIPPED_SCRIPT_FILE ${SCRIPT_FILE})
CONFIGURE_FILE(${VMTK_SOURCE_DIR}/${SCRIPT_FILE} ${VMTK_BINARY_DIR}/${STRIPPED_SCRIPT_FILE} COPYONLY)
SET (STRIPPED_SCRIPTS_SRCS ${STRIPPED_SCRIPTS_SRCS} ${VMTK_BINARY_DIR}/${STRIPPED_SCRIPT_FILE})
ENDFOREACH (SCRIPT_FILE)
#INSTALL_PROGRAMS(${VMTK_INSTALL_BIN_DIR} FILES ${STRIPPED_SCRIPTS_SRCS})
INSTALL(PROGRAMS ${STRIPPED_SCRIPTS_SRCS}
DESTINATION ${VMTK_INSTALL_BIN_DIR}
COMPONENT RuntimeExecutables)
ENDIF (NOT WIN32)
OPTION(VMTK_ENABLE_DISTRIBUTION "Enable distribution targets." OFF)
IF(VMTK_ENABLE_DISTRIBUTION)
ADD_SUBDIRECTORY(distribution)
ENDIF(VMTK_ENABLE_DISTRIBUTION)
# Export Build settings and library dependencies
# INCLUDE(CMakeExportBuildSettings)
# CMAKE_EXPORT_BUILD_SETTINGS(
# ${VMTK_BINARY_DIR}/VMTKBuildSettings.cmake
# )
EXPORT_LIBRARY_DEPENDENCIES(
${VMTK_BINARY_DIR}/VMTKLibraryDepends.cmake
)
CONFIGURE_FILE(
${VMTK_SOURCE_DIR}/CMakeInput/VMTKConfig.cmake.in
${VMTK_BINARY_DIR}/VMTKConfig.cmake
@ONLY IMMEDIATE
)
CONFIGURE_FILE(
${VMTK_SOURCE_DIR}/CMakeInput/VMTKUse.cmake.in
${VMTK_BINARY_DIR}/VMTKUse.cmake
@ONLY IMMEDIATE
)
ENDIF(VMTK_SCRIPTS_ENABLED)