2011-01-14 16:05:45 +00:00
|
|
|
# Minimum cmake version required
|
2018-04-06 15:23:44 +00:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)
|
2011-01-14 16:05:45 +00:00
|
|
|
|
|
|
|
# Project configuration
|
2018-04-06 15:23:44 +00:00
|
|
|
PROJECT(REACTPHYSICS3D LANGUAGES CXX)
|
|
|
|
|
|
|
|
# In order to install libraries into correct locations on all platforms.
|
|
|
|
include(GNUInstallDirs)
|
2012-07-31 21:48:35 +00:00
|
|
|
|
2014-07-08 21:47:14 +00:00
|
|
|
# Build type
|
|
|
|
IF (NOT CMAKE_BUILD_TYPE)
|
|
|
|
SET(CMAKE_BUILD_TYPE "Release")
|
2018-04-11 15:19:41 +00:00
|
|
|
ENDIF()
|
2013-10-06 14:03:25 +00:00
|
|
|
|
2012-07-31 21:48:35 +00:00
|
|
|
# Where to build the library
|
2013-10-06 14:03:25 +00:00
|
|
|
SET(LIBRARY_OUTPUT_PATH "lib")
|
|
|
|
|
|
|
|
# Where to build the executables
|
|
|
|
SET(OUR_EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
|
2012-07-31 21:48:35 +00:00
|
|
|
|
2018-04-04 19:53:01 +00:00
|
|
|
# CMake modules path
|
|
|
|
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
|
|
|
|
2018-04-06 15:23:44 +00:00
|
|
|
# Enable testing
|
2015-07-12 10:11:20 +00:00
|
|
|
ENABLE_TESTING()
|
|
|
|
|
2012-07-31 21:48:35 +00:00
|
|
|
# Options
|
2018-04-11 15:19:41 +00:00
|
|
|
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
|
2013-05-12 12:08:30 +00:00
|
|
|
values" OFF)
|
2015-08-17 04:44:26 +00:00
|
|
|
|
2018-04-11 15:19:41 +00:00
|
|
|
# Warning Compiler flags
|
2016-03-03 16:25:53 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
|
2018-04-11 15:19:41 +00:00
|
|
|
IF(RP3D_CODE_COVERAGE_ENABLED)
|
2018-04-04 19:53:01 +00:00
|
|
|
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()
|
|
|
|
|
2016-03-03 16:25:53 +00:00
|
|
|
# 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()
|
2015-08-17 04:44:26 +00:00
|
|
|
|
2018-04-05 05:40:01 +00:00
|
|
|
# Use libc++ with Clang
|
2018-04-05 05:13:35 +00:00
|
|
|
#IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
|
|
|
#ENDIF()
|
2018-04-04 19:53:01 +00:00
|
|
|
|
2018-04-11 15:19:41 +00:00
|
|
|
IF(RP3D_PROFILING_ENABLED)
|
2013-09-16 18:35:23 +00:00
|
|
|
ADD_DEFINITIONS(-DIS_PROFILING_ACTIVE)
|
2018-04-11 15:19:41 +00:00
|
|
|
ENDIF()
|
2013-09-16 18:35:23 +00:00
|
|
|
|
2018-04-11 15:19:41 +00:00
|
|
|
IF(RP3D_LOGS_ENABLED)
|
2018-03-14 06:33:28 +00:00
|
|
|
ADD_DEFINITIONS(-DIS_LOGGING_ACTIVE)
|
2018-04-11 15:19:41 +00:00
|
|
|
ENDIF()
|
2018-03-14 06:33:28 +00:00
|
|
|
|
2018-04-11 15:19:41 +00:00
|
|
|
IF(RP3D_DOUBLE_PRECISION_ENABLED)
|
2013-09-16 18:35:23 +00:00
|
|
|
ADD_DEFINITIONS(-DIS_DOUBLE_PRECISION_ENABLED)
|
2018-04-11 15:19:41 +00:00
|
|
|
ENDIF()
|
2011-01-14 16:05:45 +00:00
|
|
|
|
2018-04-06 15:23:44 +00:00
|
|
|
# Headers files
|
|
|
|
SET (REACTPHYSICS3D_HEADERS
|
2013-09-16 18:35:23 +00:00
|
|
|
"src/configuration.h"
|
|
|
|
"src/decimal.h"
|
|
|
|
"src/reactphysics3d.h"
|
|
|
|
"src/body/Body.h"
|
|
|
|
"src/body/CollisionBody.h"
|
|
|
|
"src/body/RigidBody.h"
|
2017-02-26 11:48:50 +00:00
|
|
|
"src/collision/ContactPointInfo.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"src/collision/broadphase/BroadPhaseAlgorithm.h"
|
2014-03-16 19:59:10 +00:00
|
|
|
"src/collision/broadphase/DynamicAABBTree.h"
|
2015-08-19 16:48:08 +00:00
|
|
|
"src/collision/narrowphase/CollisionDispatch.h"
|
|
|
|
"src/collision/narrowphase/DefaultCollisionDispatch.h"
|
2016-07-05 20:02:16 +00:00
|
|
|
"src/collision/narrowphase/GJK/VoronoiSimplex.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"src/collision/narrowphase/GJK/GJKAlgorithm.h"
|
2017-02-02 21:58:40 +00:00
|
|
|
"src/collision/narrowphase/SAT/SATAlgorithm.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"src/collision/narrowphase/NarrowPhaseAlgorithm.h"
|
|
|
|
"src/collision/narrowphase/SphereVsSphereAlgorithm.h"
|
2017-02-02 21:58:40 +00:00
|
|
|
"src/collision/narrowphase/CapsuleVsCapsuleAlgorithm.h"
|
2017-02-02 22:10:01 +00:00
|
|
|
"src/collision/narrowphase/SphereVsCapsuleAlgorithm.h"
|
2017-04-01 22:33:29 +00:00
|
|
|
"src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.h"
|
2017-04-16 20:09:59 +00:00
|
|
|
"src/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.h"
|
2017-05-29 06:32:10 +00:00
|
|
|
"src/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"src/collision/shapes/AABB.h"
|
2015-08-31 15:33:34 +00:00
|
|
|
"src/collision/shapes/ConvexShape.h"
|
2017-04-01 22:33:29 +00:00
|
|
|
"src/collision/shapes/ConvexPolyhedronShape.h"
|
2015-08-31 15:33:34 +00:00
|
|
|
"src/collision/shapes/ConcaveShape.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"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"
|
2015-08-27 20:31:05 +00:00
|
|
|
"src/collision/shapes/TriangleShape.h"
|
|
|
|
"src/collision/shapes/ConcaveMeshShape.h"
|
2016-01-14 20:34:30 +00:00
|
|
|
"src/collision/shapes/HeightFieldShape.h"
|
2014-07-21 21:08:18 +00:00
|
|
|
"src/collision/RaycastInfo.h"
|
2014-08-04 20:46:58 +00:00
|
|
|
"src/collision/ProxyShape.h"
|
2015-08-27 20:31:05 +00:00
|
|
|
"src/collision/TriangleVertexArray.h"
|
2017-03-22 18:07:31 +00:00
|
|
|
"src/collision/PolygonVertexArray.h"
|
2015-08-27 20:31:05 +00:00
|
|
|
"src/collision/TriangleMesh.h"
|
2017-02-02 21:58:40 +00:00
|
|
|
"src/collision/PolyhedronMesh.h"
|
|
|
|
"src/collision/HalfEdgeStructure.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"src/collision/CollisionDetection.h"
|
2017-01-08 18:56:59 +00:00
|
|
|
"src/collision/NarrowPhaseInfo.h"
|
2015-10-02 05:04:05 +00:00
|
|
|
"src/collision/ContactManifold.h"
|
|
|
|
"src/collision/ContactManifoldSet.h"
|
2017-08-21 05:35:08 +00:00
|
|
|
"src/collision/MiddlePhaseTriangleCallback.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"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"
|
2015-11-13 20:23:34 +00:00
|
|
|
"src/engine/Timer.h"
|
|
|
|
"src/engine/Timer.cpp"
|
2017-07-30 20:14:46 +00:00
|
|
|
"src/collision/CollisionCallback.h"
|
|
|
|
"src/collision/OverlapCallback.h"
|
2013-09-16 18:35:23 +00:00
|
|
|
"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"
|
2014-07-14 01:15:16 +00:00
|
|
|
"src/mathematics/Ray.h"
|
2018-01-01 17:35:57 +00:00
|
|
|
"src/memory/MemoryAllocator.h"
|
2016-09-21 20:03:45 +00:00
|
|
|
"src/memory/PoolAllocator.h"
|
|
|
|
"src/memory/SingleFrameAllocator.h"
|
2017-12-06 20:55:50 +00:00
|
|
|
"src/memory/DefaultAllocator.h"
|
2017-12-27 19:53:09 +00:00
|
|
|
"src/memory/MemoryManager.h"
|
2017-01-08 18:56:59 +00:00
|
|
|
"src/containers/Stack.h"
|
|
|
|
"src/containers/LinkedList.h"
|
2017-12-06 20:55:50 +00:00
|
|
|
"src/containers/List.h"
|
2018-01-14 09:47:39 +00:00
|
|
|
"src/containers/Map.h"
|
2018-02-03 19:48:08 +00:00
|
|
|
"src/containers/Set.h"
|
2018-02-05 06:41:02 +00:00
|
|
|
"src/containers/Pair.h"
|
2018-03-14 06:33:28 +00:00
|
|
|
"src/utils/Profiler.h"
|
|
|
|
"src/utils/Logger.h"
|
2018-04-06 15:23:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Source files
|
|
|
|
SET (REACTPHYSICS3D_SOURCES
|
|
|
|
"src/body/Body.cpp"
|
|
|
|
"src/body/CollisionBody.cpp"
|
|
|
|
"src/body/RigidBody.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/PoolAllocator.cpp"
|
|
|
|
"src/memory/SingleFrameAllocator.cpp"
|
|
|
|
"src/memory/MemoryManager.cpp"
|
|
|
|
"src/utils/Profiler.cpp"
|
2018-03-14 06:33:28 +00:00
|
|
|
"src/utils/Logger.cpp"
|
2011-01-14 16:05:45 +00:00
|
|
|
)
|
2012-07-31 21:48:35 +00:00
|
|
|
|
2013-09-16 18:35:23 +00:00
|
|
|
# Create the library
|
2018-07-31 18:12:15 +00:00
|
|
|
ADD_LIBRARY(reactphysics3d ${REACTPHYSICS3D_HEADERS} ${REACTPHYSICS3D_SOURCES})
|
2018-04-06 15:23:44 +00:00
|
|
|
|
|
|
|
# Headers
|
|
|
|
TARGET_INCLUDE_DIRECTORIES(reactphysics3d PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
)
|
2016-01-05 17:39:22 +00:00
|
|
|
|
2015-04-08 18:50:31 +00:00
|
|
|
# If we need to compile the testbed application
|
2018-04-11 15:19:41 +00:00
|
|
|
IF(RP3D_COMPILE_TESTBED)
|
2015-04-08 18:50:31 +00:00
|
|
|
add_subdirectory(testbed/)
|
2018-04-11 15:19:41 +00:00
|
|
|
ENDIF()
|
2013-03-09 07:40:22 +00:00
|
|
|
|
|
|
|
# If we need to compile the tests
|
2018-04-11 15:19:41 +00:00
|
|
|
IF(RP3D_COMPILE_TESTS)
|
2013-03-09 07:40:22 +00:00
|
|
|
add_subdirectory(test/)
|
2018-04-11 15:19:41 +00:00
|
|
|
ENDIF()
|
2018-04-06 15:23:44 +00:00
|
|
|
|
2018-07-31 18:12:15 +00:00
|
|
|
SET_TARGET_PROPERTIES(reactphysics3d PROPERTIES PUBLIC_HEADER "${REACTPHYSICS3D_HEADERS}")
|
|
|
|
|
2018-08-04 05:25:32 +00:00
|
|
|
# Version number and soname for the library
|
|
|
|
SET_TARGET_PROPERTIES(reactphysics3d PROPERTIES
|
|
|
|
VERSION "0.7.0"
|
|
|
|
SOVERSION "0.7"
|
|
|
|
)
|
|
|
|
|
2018-04-06 15:23:44 +00:00
|
|
|
# Install target
|
|
|
|
INSTALL(TARGETS reactphysics3d
|
2018-04-11 15:19:41 +00:00
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2018-07-31 18:12:15 +00:00
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/reactphysics3d
|
2018-04-06 15:23:44 +00:00
|
|
|
)
|