-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
112 lines (99 loc) · 2.97 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
project(PHOTK)
cmake_minimum_required(VERSION 2.8)
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
)
set(PACKAGE_VERSION "0.1")
set(PACKAGE_NAME "Photometry Toolkit")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "[email protected]")
set(PROTOBUF_INCLUDE_DIR ${PROTOBUF_ROOT}/include)
set(PROTOBUF_LIBRARY ${PROTOBUF_ROOT}/lib/libprotobuf.so)
# Custom PhoTK options
option(PHOTK_BUILD_TOOLS
"Build the PhotometryTK tools." ON)
option(BUILD_SHARED_LIBS
"Produce shared libraries." TRUE)
option(ENABLE_RPATHS
"Use RPaths in executables to find shared libraries." FALSE)
option(ENABLE_PROFILING
"Link against the google perftools." FALSE)
option(ENABLE_TCMALLOC
"Link against the google perftools's tcmalloc." FALSE)
if (ENABLE_RPATHS)
set(CMAKE_SKIP_RPATH FALSE CACHE BOOL "")
set(CMAKE_SKIP_BUILD_RPATH FALSE CACHE BOOL "")
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE CACHE BOOL "")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "")
if(APPLE)
set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif(APPLE)
mark_as_advanced(
CMAKE_SKIP_RPATH
CMAKE_SKIP_BUILD_RPATH
CMAKE_BUILD_WITH_INSTALL_RPATH
CMAKE_INSTALL_RPATH
CMAKE_INSTALL_RPATH_USE_LINK_PATH
)
endif(ENABLE_RPATHS)
# Find Dependencies
include(AddPHOTK)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON )
# Need the values of VISIONWORKBENCH_ROOT and PHOTK_SOURCE_DIR for 'make check'
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_FILESYSTEM_VERSION=3 -DPHOTK_SOURCE_DIR=${PHOTK_SOURCE_DIR} -DVISIONWORKBENCH_ROOT=${VISIONWORKBENCH_ROOT}")
if (ENABLE_SFS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SFS")
endif(ENABLE_SFS)
find_package(Boost 1.50.0
COMPONENTS
program_options
system
filesystem
thread
)
find_package(VisionWorkbench REQUIRED
COMPONENTS
core
math
image
fileio
cartography
)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
find_package(GooglePerfTools)
photk_enable_testing()
if (ENABLE_PROFILING AND GOOGLE_PERFTOOLS_FOUND)
set(PHOTK_ENABLE_PROFILING ON )
else()
set(PHOTK_ENABLE_PROFILING OFF )
endif()
if (ENABLE_TCMALLOC AND GOOGLE_PERFTOOLS_FOUND)
set(PHOTK_ENABLE_TCMALLOC ON)
else()
set(PHOTK_ENABLE_TCMALLOC OFF)
endif()
# The SfS tool. It depends on ISIS.
if (ENABLE_SFS)
find_package(ISIS REQUIRED
COMPONENTS
isis3
)
endif(ENABLE_SFS)
# Produce photk/config.h
configure_file(
${PHOTK_SOURCE_DIR}/src/photk/config.h.in
${PHOTK_BINARY_DIR}/src/photk/config.h
)
# Add common search locations
include_directories(${PHOTK_SOURCE_DIR}/src)
include_directories(${PHOTK_BINARY_DIR}/src) # Autogenerated files
# Adding build directories
add_subdirectory(src/photk)
add_subdirectory(src/tools)
# Adding test directories
add_subdirectory(src/photk/tests)