forked from Kitware/TeleSculptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
169 lines (137 loc) · 4.86 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
cmake_minimum_required(VERSION 2.8.3)
project(MAPTK)
###
# Versioning
#
set(MAPTK_VERSION_MAJOR 0)
set(MAPTK_VERSION_MINOR 4)
set(MAPTK_VERSION_PATCH 0)
set(MAPTK_VERSION "${MAPTK_VERSION_MAJOR}.${MAPTK_VERSION_MINOR}.${MAPTK_VERSION_PATCH}")
###
# 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;
# we haven't set up DLL exports or anything like that
if (WIN32)
option(BUILD_SHARED_LIBS "Build shared libraries." ON)
else()
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
endif()
set(MAPTK_LIB_SUFFIX "" CACHE STRING "String suffix appended to the library directory we install into")
option(MAPTK_ENABLE_OPENCV "Enable OpenCV-dependent code" OFF)
option(MAPTK_ENABLE_VXL "Enable VXL-dependent code" OFF)
option(MAPTK_ENABLE_VISCL "Enable VisCL dependent code (for OpenCL on GPU)" OFF)
option(MAPTK_ENABLE_PROJ "Enable PROJ dependent code" OFF)
###
# MAPTK CMake config
#
include(maptk-utils)
include(maptk-flags)
set(maptk_export_name maptk_exports)
###
# Dependencies and Modules
#
if(WIN32)
set(Boost_USE_STATIC_LIBS TRUE)
set(Boost_WIN_MODULES chrono)
endif()
find_package(Boost 1.48 REQUIRED COMPONENTS system filesystem program_options timer ${Boost_WIN_MODULES})
add_definitions(-DBOOST_ALL_NO_LIB)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MAPTK_ENABLE_OPENCV)
find_package(OpenCV REQUIRED)
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
# Docs say we don't need to add link_directories() call for OpenCV lib dirs
endif()
set(USE_OPENCV_VERSION MAPTK_ENABLE_OPENCV AND OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "2.4")
if(MAPTK_ENABLE_VXL)
find_package(VXL REQUIRED)
include_directories(SYSTEM ${VXL_VCL_INCLUDE_DIR})
include_directories(SYSTEM ${VXL_CORE_INCLUDE_DIR})
link_directories(${VXL_LIBRARY_DIR})
endif()
if(MAPTK_ENABLE_VISCL)
find_package(viscl REQUIRED)
include_directories(SYSTEM ${viscl_INCLUDE_DIR})
endif()
if(MAPTK_ENABLE_PROJ)
find_package(PROJ)
include_directories(${PROJ_INCLUDE_DIR})
endif()
# this is where the libraries source code lives
add_subdirectory(maptk)
# this is where the executables source code lives
add_subdirectory(tools)
###
# 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
#
# Configure build-tree CMake config file and export associated targets file
set(MAPTK_CONFIG_FILE "${MAPTK_BINARY_DIR}/maptk-config.cmake")
maptk_configure_file(maptk-config
"${MAPTK_SOURCE_DIR}/cmake/maptk-config.cmake.in"
"${MAPTK_CONFIG_FILE}"
MAPTK_SOURCE_DIR MAPTK_BINARY_DIR
)
maptk_export_targets("${MAPTK_BINARY_DIR}/maptk-config-targets.cmake")
# Configure install-tree CMake config file and export associated targets file
set(cmake_install_dir lib${MAPTK_LIB_SUFFIX}/cmake/maptk)
set(MAPTK_CONFIG_INSTALL_FILE "${MAPTK_BINARY_DIR}/maptk-config-install.cmake")
maptk_configure_file(maptk-install-config
"${MAPTK_SOURCE_DIR}/cmake/maptk-config-install.cmake.in"
"${MAPTK_CONFIG_INSTALL_FILE}"
)
maptk_install(
FILES "${MAPTK_CONFIG_INSTALL_FILE}"
DESTINATION "${cmake_install_dir}"
RENAME maptk-config.cmake
)
maptk_install(
EXPORT ${maptk_export_name}
DESTINATION "${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 "MAPTK")
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_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
include (CPack)