-
Notifications
You must be signed in to change notification settings - Fork 63
/
CMakeLists.txt
190 lines (158 loc) · 4.54 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
cmake_minimum_required(VERSION 2.6)
project(hermes2d)
#set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../hermes_common/cmake)
#set(HERMES_COMMON_DIR ${PROJECT_SOURCE_DIR}/../hermes_common)
IF(H2D_DEBUG)
set(DEBUG YES)
ELSE(H2D_DEBUG)
set(DEBUG NO)
ENDIF(H2D_DEBUG)
IF(H2D_RELEASE)
set(RELEASE YES)
ELSE(H2D_RELEASE)
set(RELEASE NO)
ENDIF(H2D_RELEASE)
IF(H2D_WITH_EXAMPLES)
set(WITH_EXAMPLES YES)
ELSE(H2D_WITH_EXAMPLES)
set(WITH_EXAMPLES NO)
ENDIF(H2D_WITH_EXAMPLES)
IF(H2D_WITH_BENCHMARKS)
set(WITH_BENCHMARKS YES)
ELSE(H2D_WITH_BENCHMARKS)
set(WITH_BENCHMARKS NO)
ENDIF(H2D_WITH_BENCHMARKS)
IF(H2D_WITH_TESTS)
set(WITH_TESTS YES)
ELSE(H2D_WITH_TESTS)
set(WITH_TESTS NO)
ENDIF(H2D_WITH_TESTS)
IF(H2D_WITH_TUTORIAL)
set(WITH_TUTORIAL YES)
ELSE(H2D_WITH_TUTORIAL)
set(WITH_TUTORIAL NO)
ENDIF(H2D_WITH_TUTORIAL)
#
# Version configuration.
#
if (NOT DEBUG AND NOT RELEASE)
message(FATAL_ERROR "WITH_H2D is set to YES, but no versions are specified.
Re-run with DEBUG and/or RELEASE set to YES.")
endif (NOT DEBUG AND NOT RELEASE)
if(H2D_REAL)
list(APPEND VERS "real")
endif(H2D_REAL)
if(H2D_COMPLEX)
list(APPEND VERS "complex")
endif(H2D_COMPLEX)
list(LENGTH VERS VERS_LEN)
if(NOT(VERS_LEN GREATER 0))
message(FATAL_ERROR "WITH_H2D is set to YES, but no versions are specified.
Re-run with REAL and/or COMPLEX set to YES")
endif(NOT(VERS_LEN GREATER 0))
if(MSVC)
if(H2D_REAL)
set(HERMES2D_REAL "hermes2d-real") # Base name of the library.
set(HERMES2D_REAL_RELEASE ${HERMES2D_REAL}) # Name of the release version.
set(HERMES2D_REAL_DEBUG ${HERMES2D_REAL}-debug) # Name of the debug version.
endif(H2D_REAL)
if(H2D_COMPLEX)
set(HERMES2D_CPLX "hermes2d-cplx")
set(HERMES2D_CPLX_RELEASE ${HERMES2D_CPLX})
set(HERMES2D_CPLX_DEBUG ${HERMES2D_CPLX}-debug)
endif(H2D_COMPLEX)
else(MSVC)
if(DEBUG)
if(H2D_REAL)
set(HERMES2D_REAL_DEBUG "hermes2d-real-debug")
set(HERMES2D_REAL ${HERMES2D_REAL_DEBUG})
endif(H2D_REAL)
if(H2D_COMPLEX)
set(HERMES2D_CPLX_DEBUG "hermes2d-cplx-debug")
set(HERMES2D_CPLX ${HERMES2D_CPLX_DEBUG})
endif(H2D_COMPLEX)
# set(CMAKE_BUILD_TYPE Debug) # This does not work with multi-version configurations,
# because it is linked to the project (i.e. we would have
# to have separate projects for Debug and Release)
endif(DEBUG)
if(RELEASE)
if(H2D_REAL)
set(HERMES2D_REAL_RELEASE "hermes2d-real")
set(HERMES2D_REAL ${HERMES2D_REAL_RELEASE})
endif(H2D_REAL)
if(H2D_COMPLEX)
set(HERMES2D_CPLX_RELEASE "hermes2d-cplx")
set(HERMES2D_CPLX ${HERMES2D_CPLX_RELEASE})
endif(H2D_COMPLEX)
# set(CMAKE_BUILD_TYPE Release)
endif(RELEASE)
endif(MSVC)
#
# Optional libraries and settings for H2D.
#
if(H2D_WITH_GLUT)
if(NOT APPLE) # See hermes/OSX.cmake for APPLE-specific search procedures.
find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)
endif(NOT APPLE)
else(H2D_WITH_GLUT)
add_definitions(-DNOGLUT)
endif(H2D_WITH_GLUT)
if(H2D_WITH_VIEWER_GUI)
find_package(ANTTWEAKBAR REQUIRED)
include_directories(${ANTTWEAKBAR_INCLUDE_DIR})
endif(H2D_WITH_VIEWER_GUI)
#
# Python
#
# We require Python for the mesh parser (it also needs NumPy)
if(NOT PYTHON_FOUND OR NOT NUMPY_FOUND)
find_package(Python REQUIRED)
find_package(NumPy REQUIRED)
include_directories(${PYTHON_INCLUDE_PATH} ${NUMPY_INCLUDE_PATH})
endif(NOT PYTHON_FOUND OR NOT NUMPY_FOUND)
if(WITH_PYTHON)
set(REPORT_RUNTIME_CONTROL YES) # Required by python wrappers.
set(CYTHON_INCLUDE_DIRECTORIES -I.)
set(CYTHON_INCLUDE_DIRECTORIES ${CYTHON_INCLUDE_DIRECTORIES} -I${CMAKE_SOURCE_DIR}/hermes_common)
add_subdirectory(hermes2d)
endif(WITH_PYTHON)
#
# Subdirectories.
#
add_subdirectory(src)
if(WITH_TESTS)
enable_testing()
add_subdirectory(tests)
endif(WITH_TESTS)
if(WITH_EXAMPLES)
add_subdirectory(examples)
endif(WITH_EXAMPLES)
if(WITH_BENCHMARKS)
add_subdirectory(benchmarks)
endif(WITH_BENCHMARKS)
if(WITH_TUTORIAL)
add_subdirectory(tutorial)
endif(WITH_TUTORIAL)
if(H2D_WITH_UTIL)
add_subdirectory(util)
endif(H2D_WITH_UTIL)
#
# Documentation
#
# This doesn't work yet:
#add_subdirectory(doc)
#add_custom_target(doc)
#add_custom_command(
# SOURCE ${DOXYGEN_CONFIG_FILE}
# COMMAND ${DOXYGEN_BINARY}
# ARGS ${DOXYGEN_CONFIG_FILE}
# TARGET doc
# OUTPUTS ${PROJECT_BINARY_DIR}/doc/html
#)
#add_custom_command(
# SOURCE doc
# TARGET doc
# DEPENDS ${PROJECT_BINARY_DIR}/doc/html
#)
message("\n")