forked from DanielChappuis/reactphysics3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
269 lines (245 loc) · 9.46 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# Minimum cmake version required
CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)
# Project configuration
PROJECT(REACTPHYSICS3D LANGUAGES CXX)
# In order to install libraries into correct locations on all platforms.
include(GNUInstallDirs)
# Build type
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
# Where to build the library
SET(LIBRARY_OUTPUT_PATH "lib")
# Where to build the executables
SET(OUR_EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
# CMake modules path
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
# Enable testing
ENABLE_TESTING()
# Options
OPTION(RP3D_COMPILE_TESTBED "Select this if you want to build the testbed application" OFF)
OPTION(RP3D_COMPILE_TESTS "Select this if you want to build the tests" OFF)
OPTION(RP3D_PROFILING_ENABLED "Select this if you want to compile with enabled profiling" OFF)
OPTION(RP3D_LOGS_ENABLED "Select this if you want to compile with logs enabled during execution" OFF)
OPTION(RP3D_CODE_COVERAGE_ENABLED "Select this if you need to build for code coverage calculation" OFF)
OPTION(RP3D_DOUBLE_PRECISION_ENABLED "Select this if you want to compile using double precision floating
values" OFF)
# Warning Compiler flags
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
IF(RP3D_CODE_COVERAGE_ENABLED)
IF(CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(CodeCoverage)
SETUP_TARGET_FOR_COVERAGE(${PROJECT_NAME}_coverage tests coverage)
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
ENDIF()
# C++11 flags
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
IF(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSE()
message("The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
ENDIF()
ENDIF()
# Use libc++ with Clang
#IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
#ENDIF()
IF(RP3D_PROFILING_ENABLED)
ADD_DEFINITIONS(-DIS_PROFILING_ACTIVE)
ENDIF()
IF(RP3D_LOGS_ENABLED)
ADD_DEFINITIONS(-DIS_LOGGING_ACTIVE)
ENDIF()
IF(RP3D_DOUBLE_PRECISION_ENABLED)
ADD_DEFINITIONS(-DIS_DOUBLE_PRECISION_ENABLED)
ENDIF()
# Headers files
SET (REACTPHYSICS3D_HEADERS
"src/configuration.h"
"src/decimal.h"
"src/reactphysics3d.h"
"src/body/Body.h"
"src/body/CollisionBody.h"
"src/body/RigidBody.h"
"src/collision/ContactPointInfo.h"
"src/collision/ContactManifoldInfo.h"
"src/collision/broadphase/BroadPhaseAlgorithm.h"
"src/collision/broadphase/DynamicAABBTree.h"
"src/collision/narrowphase/CollisionDispatch.h"
"src/collision/narrowphase/DefaultCollisionDispatch.h"
"src/collision/narrowphase/GJK/VoronoiSimplex.h"
"src/collision/narrowphase/GJK/GJKAlgorithm.h"
"src/collision/narrowphase/SAT/SATAlgorithm.h"
"src/collision/narrowphase/NarrowPhaseAlgorithm.h"
"src/collision/narrowphase/SphereVsSphereAlgorithm.h"
"src/collision/narrowphase/CapsuleVsCapsuleAlgorithm.h"
"src/collision/narrowphase/SphereVsCapsuleAlgorithm.h"
"src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.h"
"src/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.h"
"src/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h"
"src/collision/shapes/AABB.h"
"src/collision/shapes/ConvexShape.h"
"src/collision/shapes/ConvexPolyhedronShape.h"
"src/collision/shapes/ConcaveShape.h"
"src/collision/shapes/BoxShape.h"
"src/collision/shapes/CapsuleShape.h"
"src/collision/shapes/CollisionShape.h"
"src/collision/shapes/ConvexMeshShape.h"
"src/collision/shapes/SphereShape.h"
"src/collision/shapes/TriangleShape.h"
"src/collision/shapes/ConcaveMeshShape.h"
"src/collision/shapes/HeightFieldShape.h"
"src/collision/RaycastInfo.h"
"src/collision/ProxyShape.h"
"src/collision/TriangleVertexArray.h"
"src/collision/PolygonVertexArray.h"
"src/collision/TriangleMesh.h"
"src/collision/PolyhedronMesh.h"
"src/collision/HalfEdgeStructure.h"
"src/collision/CollisionDetection.h"
"src/collision/NarrowPhaseInfo.h"
"src/collision/ContactManifold.h"
"src/collision/ContactManifoldSet.h"
"src/collision/MiddlePhaseTriangleCallback.h"
"src/constraint/BallAndSocketJoint.h"
"src/constraint/ContactPoint.h"
"src/constraint/FixedJoint.h"
"src/constraint/HingeJoint.h"
"src/constraint/Joint.h"
"src/constraint/SliderJoint.h"
"src/engine/CollisionWorld.h"
"src/engine/ConstraintSolver.h"
"src/engine/ContactSolver.h"
"src/engine/DynamicsWorld.h"
"src/engine/EventListener.h"
"src/engine/Island.h"
"src/engine/Material.h"
"src/engine/OverlappingPair.h"
"src/engine/Timer.h"
"src/engine/Timer.cpp"
"src/collision/CollisionCallback.h"
"src/collision/OverlapCallback.h"
"src/mathematics/mathematics.h"
"src/mathematics/mathematics_functions.h"
"src/mathematics/Matrix2x2.h"
"src/mathematics/Matrix3x3.h"
"src/mathematics/Quaternion.h"
"src/mathematics/Transform.h"
"src/mathematics/Vector2.h"
"src/mathematics/Vector3.h"
"src/mathematics/Ray.h"
"src/memory/MemoryAllocator.h"
"src/memory/DefaultPoolAllocator.h"
"src/memory/DefaultSingleFrameAllocator.h"
"src/memory/DefaultAllocator.h"
"src/memory/MemoryManager.h"
"src/containers/Stack.h"
"src/containers/LinkedList.h"
"src/containers/List.h"
"src/containers/Map.h"
"src/containers/Set.h"
"src/containers/Pair.h"
"src/utils/Profiler.h"
"src/utils/Logger.h"
)
# Source files
SET (REACTPHYSICS3D_SOURCES
"src/body/Body.cpp"
"src/body/CollisionBody.cpp"
"src/body/RigidBody.cpp"
"src/collision/ContactManifoldInfo.cpp"
"src/collision/broadphase/BroadPhaseAlgorithm.cpp"
"src/collision/broadphase/DynamicAABBTree.cpp"
"src/collision/narrowphase/DefaultCollisionDispatch.cpp"
"src/collision/narrowphase/GJK/VoronoiSimplex.cpp"
"src/collision/narrowphase/GJK/GJKAlgorithm.cpp"
"src/collision/narrowphase/SAT/SATAlgorithm.cpp"
"src/collision/narrowphase/SphereVsSphereAlgorithm.cpp"
"src/collision/narrowphase/CapsuleVsCapsuleAlgorithm.cpp"
"src/collision/narrowphase/SphereVsCapsuleAlgorithm.cpp"
"src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.cpp"
"src/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.cpp"
"src/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.cpp"
"src/collision/shapes/AABB.cpp"
"src/collision/shapes/ConvexShape.cpp"
"src/collision/shapes/ConvexPolyhedronShape.cpp"
"src/collision/shapes/ConcaveShape.cpp"
"src/collision/shapes/BoxShape.cpp"
"src/collision/shapes/CapsuleShape.cpp"
"src/collision/shapes/CollisionShape.cpp"
"src/collision/shapes/ConvexMeshShape.cpp"
"src/collision/shapes/SphereShape.cpp"
"src/collision/shapes/TriangleShape.cpp"
"src/collision/shapes/ConcaveMeshShape.cpp"
"src/collision/shapes/HeightFieldShape.cpp"
"src/collision/RaycastInfo.cpp"
"src/collision/ProxyShape.cpp"
"src/collision/TriangleVertexArray.cpp"
"src/collision/PolygonVertexArray.cpp"
"src/collision/TriangleMesh.cpp"
"src/collision/PolyhedronMesh.cpp"
"src/collision/HalfEdgeStructure.cpp"
"src/collision/CollisionDetection.cpp"
"src/collision/NarrowPhaseInfo.cpp"
"src/collision/ContactManifold.cpp"
"src/collision/ContactManifoldSet.cpp"
"src/collision/MiddlePhaseTriangleCallback.cpp"
"src/constraint/BallAndSocketJoint.cpp"
"src/constraint/ContactPoint.cpp"
"src/constraint/FixedJoint.cpp"
"src/constraint/HingeJoint.cpp"
"src/constraint/Joint.cpp"
"src/constraint/SliderJoint.cpp"
"src/engine/CollisionWorld.cpp"
"src/engine/ConstraintSolver.cpp"
"src/engine/ContactSolver.cpp"
"src/engine/DynamicsWorld.cpp"
"src/engine/Island.cpp"
"src/engine/Material.cpp"
"src/engine/OverlappingPair.cpp"
"src/engine/Timer.cpp"
"src/collision/CollisionCallback.cpp"
"src/mathematics/mathematics_functions.cpp"
"src/mathematics/Matrix2x2.cpp"
"src/mathematics/Matrix3x3.cpp"
"src/mathematics/Quaternion.cpp"
"src/mathematics/Transform.cpp"
"src/mathematics/Vector2.cpp"
"src/mathematics/Vector3.cpp"
"src/memory/DefaultPoolAllocator.cpp"
"src/memory/DefaultSingleFrameAllocator.cpp"
"src/memory/MemoryManager.cpp"
"src/utils/Profiler.cpp"
"src/utils/Logger.cpp"
)
# Create the library
ADD_LIBRARY(reactphysics3d ${REACTPHYSICS3D_HEADERS} ${REACTPHYSICS3D_SOURCES})
# Headers
TARGET_INCLUDE_DIRECTORIES(reactphysics3d PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>
)
# If we need to compile the testbed application
IF(RP3D_COMPILE_TESTBED)
add_subdirectory(testbed/)
ENDIF()
# If we need to compile the tests
IF(RP3D_COMPILE_TESTS)
add_subdirectory(test/)
ENDIF()
SET_TARGET_PROPERTIES(reactphysics3d PROPERTIES PUBLIC_HEADER "${REACTPHYSICS3D_HEADERS}")
# Version number and soname for the library
SET_TARGET_PROPERTIES(reactphysics3d PROPERTIES
VERSION "0.7.0"
SOVERSION "0.7"
)
# Install target
INSTALL(TARGETS reactphysics3d
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/reactphysics3d
)