forked from Kitware/TeleSculptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
227 lines (189 loc) · 6.26 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
cmake_minimum_required(VERSION 3.0)
project(MAPTK)
###
# CMake policies
#
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
###
# Versioning
#
set(MAPTK_VERSION_MAJOR 0)
set(MAPTK_VERSION_MINOR 8)
set(MAPTK_VERSION_PATCH 0)
set(MAPTK_VERSION "${MAPTK_VERSION_MAJOR}.${MAPTK_VERSION_MINOR}.${MAPTK_VERSION_PATCH}")
string(TIMESTAMP MAPTK_COPYRIGHT_YEAR "%Y")
find_package( vital REQUIRED )
###
# Check to see if fletch directory is valid from the vital config
#
if ( IS_DIRECTORY ${fletch_DIR} )
find_package( fletch NO_MODULE )
endif()
###
# Add the CMake directory for CMake modules
#
list(INSERT CMAKE_MODULE_PATH 0
"${MAPTK_SOURCE_DIR}/CMake"
)
###
# Options and setup
#
include(CMakeDependentOption)
# we can't build shared libraries on Windows so we leave it off by default
if (WIN32)
option(BUILD_SHARED_LIBS "Build shared libraries." ON)
else()
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
endif()
# default to MAPTK_LIB_SUFFIX for backwards compatibility
if(DEFINED MAPTK_LIB_SUFFIX)
message(WARNING "MAPTK_LIB_SUFFIX is deprecated. Please use LIB_SUFFIX instead.")
endif()
set(LIB_SUFFIX "${MAPTK_LIB_SUFFIX}" CACHE STRING "String suffix appended to the library directory we install into")
mark_as_advanced( LIB_SUFFIX )
###
# use kwiver util methods
#
include( kwiver-utils )
include( maptk-utils ) # local utilities
include( vital-flags ) # use same compile flags as vital
###
# check compiler support
include( kwiver-configcheck )
set(kwiver_export_name maptk_exports)
###
# Dependencies and Modules
#
include( maptk-depends )
# this is where the source code for libraries/plugins lives
add_subdirectory(maptk)
# this is where the executables source code lives
add_subdirectory(tools)
# this is where the algorithm default configuration files live
add_subdirectory(config)
# this is where configuration for example data sets lives
add_subdirectory(examples)
###
# GUI
#
option(MAPTK_ENABLE_GUI "Build MAPTK GUI" OFF)
if(MAPTK_ENABLE_GUI)
if(APPLE)
set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
# make sure CMAKE_INSTALL_PREFIX ends in /
if(NOT CMAKE_INSTALL_PREFIX MATCHES "/$")
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
endif()
set(CMAKE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}MAP-Tk.app/Contents")
endif()
add_subdirectory(gui)
endif()
###
# Manuals
#
option(MAPTK_ENABLE_MANUALS "Build MAPTK user manual(s)" OFF)
if(MAPTK_ENABLE_MANUALS)
add_subdirectory(doc/manuals)
endif()
###
# Testing
#
# The following are required to uses Dart and the Cdash dashboard
option(MAPTK_ENABLE_TESTING "Build MAPTK testing" OFF)
if(MAPTK_ENABLE_TESTING)
enable_testing()
include(CTest)
set(BUILD_TESTING ON)
mark_as_advanced(BUILD_TESTING)
add_subdirectory(tests)
endif()
###
# Top level installation
#
set(maptk_cmake_install_dir "lib${LIB_SUFFIX}/cmake/maptk")
# Install rules for CMake utilities
include(maptk-install-utils)
# Prepare space-separated list of library names for config
get_property(maptk_libs GLOBAL PROPERTY kwiver_libraries)
string(REPLACE ";" " " maptk_libs "${maptk_libs}")
# Configure build-tree CMake config file and export associated targets file
set(MAPTK_CONFIG_FILE "${MAPTK_BINARY_DIR}/maptk-config.cmake")
set(module_path "${MAPTK_SOURCE_DIR}/CMake")
kwiver_configure_file( maptk-config
"${MAPTK_SOURCE_DIR}/CMake/maptk-config.cmake.in"
"${MAPTK_CONFIG_FILE}"
MAPTK_SOURCE_DIR
MAPTK_BINARY_DIR
EIGEN3_INCLUDE_DIR
MAPTK_VERSION
maptk_libs
module_path
)
kwiver_export_targets("${MAPTK_BINARY_DIR}/maptk-config-targets.cmake")
# Configure install-tree CMake config file and export associated targets file
set(MAPTK_CONFIG_INSTALL_FILE "${MAPTK_BINARY_DIR}/maptk-config-install.cmake")
set(module_path "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/maptk")
kwiver_configure_file( maptk-install-config
"${MAPTK_SOURCE_DIR}/CMake/maptk-config-install.cmake.in"
"${MAPTK_CONFIG_INSTALL_FILE}"
EIGEN3_INCLUDE_DIR
maptk_libs
module_path
)
kwiver_install(
FILES "${MAPTK_CONFIG_INSTALL_FILE}"
DESTINATION "${maptk_cmake_install_dir}"
RENAME maptk-config.cmake
)
kwiver_install(
EXPORT ${kwiver_export_name}
DESTINATION "${maptk_cmake_install_dir}"
FILE maptk-config-targets.cmake
)
###
# CPack Packaging
#
#TODO: Define package dependencies
set(MAPTK_DEPS "")
if(EXISTS /etc/redhat-release)
file(READ /etc/redhat-release RHEL_VERSION)
string(REGEX REPLACE ".*release ([^\\. ]*).*" "\\1" RHEL_VERSION "${RHEL_VERSION}")
set(CPACK_SYSTEM_NAME "el${RHEL_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
set(CPACK_RPM_PACKAGE_REQUIRES "${MAPTK_DEPS}")
else()
set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
endif()
set(CPACK_PACKAGE_NAME "MAP-Tk")
set(CPACK_PACKAGE_VENDOR "Kitware, Inc.")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_MONOLITHIC_INSTALL true)
set(CPACK_PACKAGE_VERSION_MAJOR "${MAPTK_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${MAPTK_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${MAPTK_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${MAPTK_VERSION}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/packaging\\\\maptk_install.bmp")
set(CPACK_DMG_DS_STORE "${CMAKE_CURRENT_SOURCE_DIR}/packaging/DS_Store")
# NSIS Package options
set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\mapgui.exe")
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/gui/icons\\\\mapgui.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/gui/icons\\\\mapgui.ico")
set(CPACK_NSIS_CONTACT "${CPACK_PACKAGE_CONTACT}")
set(CPACK_NSIS_HELP_LINK "http://www.kitware.com")
set(CPACK_NSIS_URL_INFO_ABOUT "http://www.kwiver.org")
set(CPACK_NSIS_MENU_LINKS "http://www.kwiver.org" "KWIVER Website")
if(MAPTK_ENABLE_GUI)
set (CPACK_PACKAGE_EXECUTABLES "mapgui" "MAP-Tk GUI" ${CPACK_PACKAGE_EXECUTABLES})
endif()
if(APPLE)
set(CPACK_BINARY_DRAGNDROP ON)
set(CPACK_BINARY_PACKAGEMAKER OFF)
set(CPACK_SET_DESTDIR TRUE)
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/packaging/maptk_drive.icns")
endif()
include (CPack)