-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
129 lines (82 loc) · 3.69 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
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(spc)
include(CompilerOptions.cmake)
include(Versioning.cmake)
################################## INSTALL OPTIONS #####################################################
set(SPC_INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set(SPC_INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set(SPC_INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
######################################################################################
INCLUDE(cmake/UpdateCacheVariable.cmake) #courtesy of ceres-solver
#my definitions
set(SPC_DEFINITIONS "")
# my libs
set(SPC_LIBRARIES CACHE INTERNAL "SPC libs" FORCE) #this will collect all the modular libs spc will create
# all libraries into a single dir for the build tree
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
add_subdirectory(submodules)
############################# OPTIONS ######################################################################
option(SPC_BUILD_SHARED "Build spc library as a shared lib." ON)
#option(SPC_BUILD_SANDBOX_TOOLS "Build sandbox tools." OFF)
option(SPC_BUILD_EXAMPLES_TOOLS "Build examples tools." OFF)
option(SPC_USE_IWYU "Use include-what-you-use to notify about unused includes" OFF)
OPTION(SPC_GFLAGS "Enable Google Flags. Needed by the tools" OFF)
option(SPC_BUILD_TESTS "Do tests" OFF)
option(SPC_ENABLE_INSTALL "Enable/Disable the install target" OFF)
option(SPC_WITH_PCL "Compile SPC lib with PCL support - Many more dependencies" OFF)
if (SPC_WITH_PCL)
option(SPC_BUILD_TOOLS "Build the tools." ON)
endif()
#option(SPC_GFLAGS_IN_NAMESPACE_GOOGLE "says if gflags is expected to be into the google namespace" OFF)
option(SPC_USE_PARALLEL_OPENMP "Enable paralellization of some algorithms via OpenMP" ON)
option(SPC_BUILD_TESTING_TOOLS "Build the tools contained into the tests folder" OFF)
#############################################################################################################
#
#add custom functions and macros
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/functions.cmake)
# include the current source dir
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include(FindExternal.cmake)
#micmac lib part
if(SPC_BUILD_MICMAC_RELATED)
# add_subdirectory(external)
set(CULTURE_3D_BUILD_DIR "/home/luca/Code/culture3d/build" CACHE STRING "path where a culture3d build has been compiled is located. This is my default. you should change to your needs")
set(CULTURE_3D_SOURCE_DIR "/home/luca/Code/culture3d" CACHE STRING "path where culture 3d source resides. This is my default. Change o your needs")
link_directories(${CULTURE_3D_BUILD_DIR}/src)
endif()
##################### ADD MY DEFINITIONS #################
add_definitions(${SPC_DEFINITIONS})
#########################################################
# the main libraries
add_subdirectory(spc)
#also tools if needed
if(SPC_BUILD_TOOLS)
add_subdirectory(tools)
endif()
#also tools if needed
if(SPC_BUILD_SANDBOX_TOOLS)
add_subdirectory(sandbox)
endif()
#also tools if needed
if(SPC_BUILD_EXAMPLES_TOOLS)
add_subdirectory(examples)
endif()
#also tools if needed
if(SPC_BUILD_TESTING_TOOLS)
add_subdirectory(tests)
endif()
if(SPC_BUILD_TESTS)
add_subdirectory(tests)
endif()
if(SPC_USE_IWYU)
find_program(iwyu_path NAMES include-what-you-use iwyu)
if(NOT iwyu_path)
message(FATAL_ERROR "Could not find the program include-what-you-use")
endif()
endif()
OPTION(SPC_OSGTEST "Compile test application for point cloud visualization" OFF)
if(SPC_OSGTEST)
add_subdirectory(osg_test)
endif()
INCLUDE(PackageExport.cmake)