-
Notifications
You must be signed in to change notification settings - Fork 16
/
CMakeLists.txt
executable file
·221 lines (173 loc) · 6.77 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
############################################################
# CMake Build Script
############################################################
# Project settings
cmake_minimum_required(VERSION 2.8.7)
project(lamure)
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE TYPE INTERNAL FORCE )
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinsizeRel."
FORCE)
endif()
get_filename_component(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} ABSOLUTE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
if(MSVC)
option(CONTAINER_DEPLOYMENT_BUILD "Set to enable Docker-based deployment behaviors" ON)
endif()
############################################################
# Directories
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
set(THIRD_PARTY_PROJECTS_DIR ${CMAKE_SOURCE_DIR}/third_party)
set(GLOBAL_EXT_DIR ${CMAKE_SOURCE_DIR}/externals)
if(CONTAINER_DEPLOYMENT_BUILD)
set(GLOBAL_EXT_DIR ${DEPLOYMENT_EXTERNALS})
endif(CONTAINER_DEPLOYMENT_BUILD)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(TEST_OUTPUT_PATH ${CMAKE_BINARY_DIR}/test)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(LAMURE_CONFIG_DIR ${CMAKE_BINARY_DIR})
option (LAMURE_USE_CGAL_FOR_NNI "Set to enable CGAL library for natural neighbor interpolation. NNI will not work without CGAL." ON)
option (LAMURE_ENABLE_ALTERNATIVE_COMPUTATION_STRATEGIES "Enables preprocessing strategies different than NDC (requries CGAL)." OFF)
if (LAMURE_ENABLE_ALTERNATIVE_COMPUTATION_STRATEGIES)
add_definitions(-DCMAKE_OPTION_ENABLE_ALTERNATIVE_STRATEGIES)
endif()
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install" CACHE PATH "default install path" FORCE )
endif()
file(MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
file(MAKE_DIRECTORY ${TEST_OUTPUT_PATH})
file(MAKE_DIRECTORY ${LIBRARY_OUTPUT_PATH})
############################################################
# compiler flags
if(MSVC)
set(PROJECT_COMPILE_FLAGS "-D_VARIADIC_MAX=10 -D _SCL_SECURE=0 -D _USE_MATH_DEFINES=1 /MP -D NOMINMAX")
set(PROJECT_LIBS "")
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(PROJECT_COMPILE_FLAGS "-std=c++1y -Wall -pthread -fPIC -fopenmp")
set(PROJECT_LIBS "pthread")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROJECT_COMPILE_FLAGS}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
############################################################
# Externals
################################
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${GLOBAL_EXT_DIR})
################################
# schism
################################
include(find_schism)
#LINK_DIRECTORIES(${SCHISM_LIBRARY_DIRS})
################################
# Boost
################################
IF (MSVC)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
ENDIF ()
IF (MSVC)
set(BOOST_INCLUDEDIR ${GLOBAL_EXT_DIR}/boost/include)
set(BOOST_LIBRARYDIR ${GLOBAL_EXT_DIR}/boost/lib)
ELSEIF (UNIX)
set(BOOST_INCLUDEDIR /opt/boost/boost_1_62_0/include)
set(BOOST_LIBRARYDIR /opt/boost/boost_1_62_0/lib)
ENDIF ()
find_package( Boost 1.54.0 REQUIRED chrono date_time filesystem program_options regex serialization system thread timer wserialization iostreams)
find_package( Threads )
ADD_DEFINITIONS("-DBOOST_ALL_NO_LIB")
################################
# GLUT
################################
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GLOBAL_EXT_DIR}/freeglut/include)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GLOBAL_EXT_DIR}/freeglut/lib)
find_package(GLUT REQUIRED)
################################
# glfw
################################
find_package(GLFW3 REQUIRED)
# include(findGLFW3)
include(FindOpenGL)
include(FindGLEW)
################################
# OpenGL
################################
if (UNIX)
find_package(OpenGL REQUIRED)
include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})
endif ()
################################
# FreeImage
################################
include (find_freeimage)
if (${LAMURE_USE_CGAL_FOR_NNI})
################################
# CGAL
################################
if(NOT MSVC)
option(CGAL_USE_413 "Use Cgal version 4.13.1 (mesh preprocessing)" ON)
else()
option(CGAL_USE_413 "Use Cgal version 4.13.1 (mesh preprocessing)" OFF)
endif()
include(find_cgal)
################################
# GMP
################################
include(find_gmp)
################################
# MPFR
################################
include(find_mpfr)
else()
# include NNI alternative here
endif (${LAMURE_USE_CGAL_FOR_NNI})
################################
# GLM
################################
include(find_glm)
################################
# ZLIB
################################
IF (MSVC)
set(ZLIB_ROOT ${GLOBAL_EXT_DIR}/zlib)
ENDIF (MSVC)
include (FindZLIB)
include(FindGLEW)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=8 )
add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 )
if (CONTAINER_DEPLOYMENT_BUILD)
include(FindImageMagick)
else(CONTAINER_DEPLOYMENT_BUILD)
find_package(ImageMagick REQUIRED COMPONENTS Magick++ MagickWand MagickCore montage)
endif (CONTAINER_DEPLOYMENT_BUILD)
############################################################
# Build 3rd-party
############################################################
# Targets
add_subdirectory(${CMAKE_SOURCE_DIR}/common)
add_subdirectory(${CMAKE_SOURCE_DIR}/pvs_common)
add_subdirectory(${CMAKE_SOURCE_DIR}/preprocessing)
add_subdirectory(${CMAKE_SOURCE_DIR}/provenance)
add_subdirectory(${CMAKE_SOURCE_DIR}/virtual_texturing)
add_subdirectory(${CMAKE_SOURCE_DIR}/rendering)
add_subdirectory(${CMAKE_SOURCE_DIR}/pvs_preprocessing)
add_subdirectory(${CMAKE_SOURCE_DIR}/mesh_preprocessing)
add_subdirectory(${CMAKE_SOURCE_DIR}/apps)
add_dependencies(lamure_preprocessing lamure_common)
add_dependencies(lamure_provenance lamure_common)
add_dependencies(lamure_rendering lamure_common)
add_dependencies(lamure_virtual_texturing lamure_common)
add_dependencies(lamure_rendering lamure_common)
set_target_properties(lamure_common PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(lamure_rendering PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(lamure_virtual_texturing PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(lamure_preprocessing PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(lamure_provenance PROPERTIES DEBUG_POSTFIX "d")
IF(NOT MSVC)
add_dependencies(lamure_mesh_preprocessing lamure_common)
add_dependencies(lamure_mesh_preprocessing lamure_rendering)
set_target_properties(lamure_mesh_preprocessing PROPERTIES DEBUG_POSTFIX "d")
ENDIF(NOT MSVC)