2013-12-19 20:40:59 +00:00
cmake_minimum_required ( VERSION 2.4.3 )
set ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
2017-05-21 00:47:46 +00:00
cmake_policy ( SET CMP0017 NEW )
2013-12-19 20:40:59 +00:00
#this line has to appear before 'PROJECT' in order to be able to disable incremental linking
SET ( MSVC_INCREMENTAL_DEFAULT ON )
PROJECT ( BULLET_PHYSICS )
2017-02-08 03:15:22 +00:00
FILE ( STRINGS "VERSION" BULLET_VERSION )
2013-12-19 20:40:59 +00:00
IF ( COMMAND cmake_policy )
cmake_policy ( SET CMP0003 NEW )
2016-09-14 17:00:51 +00:00
if ( POLICY CMP0042 )
# Enable MACOSX_RPATH by default.
2016-09-14 21:22:54 +00:00
cmake_policy ( SET CMP0042 NEW )
2016-09-14 17:00:51 +00:00
endif ( POLICY CMP0042 )
2013-12-19 20:40:59 +00:00
ENDIF ( COMMAND cmake_policy )
IF ( NOT CMAKE_BUILD_TYPE )
# SET(CMAKE_BUILD_TYPE "Debug")
SET ( CMAKE_BUILD_TYPE "Release" )
2015-12-07 22:08:04 +00:00
ENDIF ( NOT CMAKE_BUILD_TYPE )
2013-12-19 20:40:59 +00:00
SET ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG" )
#MESSAGE("CMAKE_CXX_FLAGS_DEBUG="+${CMAKE_CXX_FLAGS_DEBUG})
OPTION ( USE_DOUBLE_PRECISION "Use double precision" OFF )
OPTION ( USE_GRAPHICAL_BENCHMARK "Use Graphical Benchmark" ON )
2014-05-20 03:50:10 +00:00
OPTION ( BUILD_SHARED_LIBS "Use shared libraries" OFF )
2017-05-21 00:47:46 +00:00
OPTION ( USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" OFF )
2017-05-22 07:47:11 +00:00
OPTION ( BULLET2_USE_THREAD_LOCKS "Build Bullet 2 libraries with mutex locking around certain operations (required for multi-threading)" OFF )
IF ( BULLET2_USE_THREAD_LOCKS )
OPTION ( BULLET2_USE_OPEN_MP_MULTITHREADING "Build Bullet 2 with support for multi-threading with OpenMP (requires a compiler with OpenMP support)" OFF )
OPTION ( BULLET2_USE_TBB_MULTITHREADING "Build Bullet 2 with support for multi-threading with Intel Threading Building Blocks (requires the TBB library to be already installed)" OFF )
IF ( MSVC )
OPTION ( BULLET2_USE_PPL_MULTITHREADING "Build Bullet 2 with support for multi-threading with Microsoft Parallel Patterns Library (requires MSVC compiler)" OFF )
ENDIF ( MSVC )
ENDIF ( BULLET2_USE_THREAD_LOCKS )
2013-12-19 20:40:59 +00:00
2017-09-08 15:22:40 +00:00
2017-09-06 21:18:35 +00:00
IF ( NOT WIN32 )
2017-09-10 23:22:45 +00:00
SET ( DL ${ CMAKE_DL_LIBS } )
2017-09-06 21:18:35 +00:00
IF ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
2017-09-09 20:05:45 +00:00
MESSAGE ( "Linux" )
SET ( OSDEF -D_LINUX )
2017-09-06 21:18:35 +00:00
ELSE ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
IF ( APPLE )
2017-09-09 20:05:45 +00:00
MESSAGE ( "Apple" )
2017-09-06 21:18:35 +00:00
SET ( OSDEF -D_DARWIN )
ELSE ( APPLE )
2017-09-09 20:05:45 +00:00
MESSAGE ( "BSD?" )
2017-09-06 21:18:35 +00:00
SET ( OSDEF -D_BSD )
ENDIF ( APPLE )
ENDIF ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
ENDIF ( NOT WIN32 )
2013-12-19 20:40:59 +00:00
OPTION ( USE_MSVC_INCREMENTAL_LINKING "Use MSVC Incremental Linking" OFF )
OPTION ( USE_CUSTOM_VECTOR_MATH "Use custom vectormath library" OFF )
2014-10-24 22:44:33 +00:00
#statically linking VC++ isn't supported for WindowsPhone/WindowsStore
IF ( CMAKE_SYSTEM_NAME STREQUAL WindowsPhone OR CMAKE_SYSTEM_NAME STREQUAL WindowsStore )
OPTION ( USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC Runtime Library DLL (/MD or /MDd)" ON )
ELSE ( )
OPTION ( USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC Runtime Library DLL (/MD or /MDd)" OFF )
ENDIF ( CMAKE_SYSTEM_NAME STREQUAL WindowsPhone OR CMAKE_SYSTEM_NAME STREQUAL WindowsStore )
2013-12-19 20:40:59 +00:00
2015-12-07 22:08:04 +00:00
#SET(CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:NO")
#SET(CMAKE_EXE_LINKER_FLAGS "/STACK:10000000 /INCREMENTAL:NO")
2013-12-19 20:40:59 +00:00
#MESSAGE("MSVC_INCREMENTAL_YES_FLAG"+${MSVC_INCREMENTAL_YES_FLAG})
IF ( MSVC )
IF ( NOT USE_MSVC_INCREMENTAL_LINKING )
#MESSAGE("MSVC_INCREMENTAL_DEFAULT"+${MSVC_INCREMENTAL_DEFAULT})
SET ( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:NO" )
2015-12-07 22:08:04 +00:00
STRING ( REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags ${ CMAKE_EXE_LINKER_FLAGS_DEBUG } )
2013-12-19 20:40:59 +00:00
SET ( CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO ${replacementFlags}" )
MESSAGE ( "CMAKE_EXE_LINKER_FLAGS_DEBUG=${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
2015-12-07 22:08:04 +00:00
STRING ( REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${ CMAKE_EXE_LINKER_FLAGS } )
SET ( CMAKE_EXE_LINKER_FLAGS ${ replacementFlag2 } )
STRING ( REPLACE "INCREMENTAL:YES" "" replacementFlags3 "${CMAKE_EXTRA_LINK_FLAGS}" )
SET ( CMAKE_EXTRA_LINK_FLAGS ${ replacementFlag3 } )
2014-05-13 19:59:32 +00:00
STRING ( REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags3 "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}" )
2015-12-07 22:08:04 +00:00
SET ( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${ replacementFlags3 } )
2013-12-19 20:40:59 +00:00
SET ( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/INCREMENTAL:NO ${replacementFlags3}" )
2015-12-07 22:08:04 +00:00
2013-12-19 20:40:59 +00:00
ENDIF ( NOT USE_MSVC_INCREMENTAL_LINKING )
IF ( NOT USE_MSVC_RUNTIME_LIBRARY_DLL )
#We statically link to reduce dependancies
2014-08-27 00:21:08 +00:00
FOREACH ( flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO )
2013-12-19 20:40:59 +00:00
IF ( ${ flag_var } MATCHES "/MD" )
STRING ( REGEX REPLACE "/MD" "/MT" ${ flag_var } "${${flag_var}}" )
ENDIF ( ${ flag_var } MATCHES "/MD" )
IF ( ${ flag_var } MATCHES "/MDd" )
STRING ( REGEX REPLACE "/MDd" "/MTd" ${ flag_var } "${${flag_var}}" )
ENDIF ( ${ flag_var } MATCHES "/MDd" )
ENDFOREACH ( flag_var )
ENDIF ( NOT USE_MSVC_RUNTIME_LIBRARY_DLL )
IF ( CMAKE_CL_64 )
ADD_DEFINITIONS ( -D_WIN64 )
ELSE ( )
OPTION ( USE_MSVC_SSE "Use MSVC /arch:sse option" ON )
2017-03-25 19:03:40 +00:00
option ( USE_MSVC_SSE2 "Compile your program with SSE2 instructions" ON )
2013-12-19 20:40:59 +00:00
IF ( USE_MSVC_SSE )
2015-11-25 00:13:21 +00:00
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE" )
2013-12-19 20:40:59 +00:00
ENDIF ( )
2017-03-25 19:03:40 +00:00
IF ( USE_MSVC_SSE2 )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2" )
ENDIF ( )
2013-12-19 20:40:59 +00:00
ENDIF ( )
2017-03-25 19:03:40 +00:00
option ( USE_MSVC_AVX "Compile your program with AVX instructions" OFF )
IF ( USE_MSVC_AVX )
add_definitions ( /arch:AVX )
ENDIF ( )
2013-12-19 20:40:59 +00:00
OPTION ( USE_MSVC_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON )
IF ( USE_MSVC_FAST_FLOATINGPOINT )
2015-11-25 00:13:21 +00:00
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast" )
2013-12-19 20:40:59 +00:00
ENDIF ( )
2016-07-12 12:57:05 +00:00
2017-03-26 20:06:46 +00:00
OPTION ( USE_MSVC_STRING_POOLING "Use MSVC /GF string pooling option" ON )
IF ( USE_MSVC_STRING_POOLING )
SET ( CMAKE_C_FLAGS "/GF ${CMAKE_C_FLAGS}" )
SET ( CMAKE_CXX_FLAGS "/GF ${CMAKE_CXX_FLAGS}" )
ENDIF ( )
OPTION ( USE_MSVC_FUNCTION_LEVEL_LINKING "Use MSVC /Gy function level linking option" ON )
IF ( USE_MSVC_FUNCTION_LEVEL_LINKING )
SET ( CMAKE_C_FLAGS "/Gy ${CMAKE_C_FLAGS}" )
SET ( CMAKE_CXX_FLAGS "/Gy ${CMAKE_CXX_FLAGS}" )
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF" )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF" )
ENDIF ( USE_MSVC_FUNCTION_LEVEL_LINKING )
OPTION ( USE_MSVC_EXEPTIONS "Use MSVC C++ exceptions option" OFF )
2017-05-21 00:47:46 +00:00
2017-03-26 20:06:46 +00:00
OPTION ( USE_MSVC_COMDAT_FOLDING "Use MSVC /OPT:ICF COMDAT folding option" ON )
2017-05-21 00:47:46 +00:00
2017-03-26 20:06:46 +00:00
IF ( USE_MSVC_COMDAT_FOLDING )
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:ICF" )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:ICF" )
ENDIF ( )
2017-05-21 00:47:46 +00:00
2017-03-26 20:06:46 +00:00
OPTION ( USE_MSVC_DISABLE_RTTI "Use MSVC /GR- disabled RTTI flags option" ON )
IF ( USE_MSVC_DISABLE_RTTI )
STRING ( REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS ${ CMAKE_CXX_FLAGS } ) # Disable RTTI
SET ( CMAKE_C_FLAGS "/GR- ${CMAKE_C_FLAGS}" )
SET ( CMAKE_CXX_FLAGS "/GR- ${CMAKE_CXX_FLAGS}" )
ENDIF ( USE_MSVC_DISABLE_RTTI )
2017-05-21 00:47:46 +00:00
2016-07-12 12:57:05 +00:00
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267" )
2013-12-19 20:40:59 +00:00
ENDIF ( MSVC )
IF ( WIN32 )
OPTION ( INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES "Create MSVC projectfiles that can be distributed" OFF )
IF ( INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES )
SET ( LIBRARY_OUTPUT_PATH ${ BULLET_PHYSICS_SOURCE_DIR } /lib CACHE PATH "Single output directory for building all libraries." )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ BULLET_PHYSICS_SOURCE_DIR } )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${ BULLET_PHYSICS_SOURCE_DIR } )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${ BULLET_PHYSICS_SOURCE_DIR } )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${ BULLET_PHYSICS_SOURCE_DIR } )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${ BULLET_PHYSICS_SOURCE_DIR } )
ELSE ( )
SET ( LIBRARY_OUTPUT_PATH ${ CMAKE_BINARY_DIR } /lib CACHE PATH "Single output directory for building all libraries." )
ENDIF ( )
OPTION ( INTERNAL_CREATE_MSVC_RELATIVE_PATH_PROJECTFILES "Create MSVC projectfiles with relative paths" OFF )
OPTION ( INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES "Add MSVC postfix for executable names (_Debug)" OFF )
SET ( CMAKE_DEBUG_POSTFIX "_Debug" CACHE STRING "Adds a postfix for debug-built libraries." )
SET ( CMAKE_MINSIZEREL_POSTFIX "_MinsizeRel" CACHE STRING "Adds a postfix for MinsizeRelease-built libraries." )
SET ( CMAKE_RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo" CACHE STRING "Adds a postfix for ReleaseWithDebug-built libraries." )
IF ( INTERNAL_CREATE_MSVC_RELATIVE_PATH_PROJECTFILES )
SET ( CMAKE_SUPPRESS_REGENERATION 1 )
SET ( CMAKE_USE_RELATIVE_PATHS 1 )
ENDIF ( INTERNAL_CREATE_MSVC_RELATIVE_PATH_PROJECTFILES )
ENDIF ( WIN32 )
2015-12-07 22:08:04 +00:00
OPTION ( BUILD_CPU_DEMOS "Build original Bullet CPU examples" ON )
2013-12-19 20:40:59 +00:00
OPTION ( INTERNAL_UPDATE_SERIALIZATION_STRUCTURES "Internal update serialization structures" OFF )
IF ( INTERNAL_UPDATE_SERIALIZATION_STRUCTURES )
ADD_DEFINITIONS ( -DBT_INTERNAL_UPDATE_SERIALIZATION_STRUCTURES )
ENDIF ( INTERNAL_UPDATE_SERIALIZATION_STRUCTURES )
IF ( USE_DOUBLE_PRECISION )
ADD_DEFINITIONS ( -DBT_USE_DOUBLE_PRECISION )
SET ( BULLET_DOUBLE_DEF "-DBT_USE_DOUBLE_PRECISION" )
ENDIF ( USE_DOUBLE_PRECISION )
2016-10-19 00:38:43 +00:00
IF ( USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD )
ADD_DEFINITIONS ( -DUSE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD )
ENDIF ( USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD )
2013-12-19 20:40:59 +00:00
IF ( USE_GRAPHICAL_BENCHMARK )
ADD_DEFINITIONS ( -DUSE_GRAPHICAL_BENCHMARK )
ENDIF ( USE_GRAPHICAL_BENCHMARK )
2016-09-27 07:01:45 +00:00
IF ( BULLET2_USE_THREAD_LOCKS )
ADD_DEFINITIONS ( -DBT_THREADSAFE=1 )
IF ( NOT MSVC )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
ENDIF ( NOT MSVC )
ENDIF ( BULLET2_USE_THREAD_LOCKS )
2017-05-22 07:47:11 +00:00
IF ( BULLET2_USE_OPEN_MP_MULTITHREADING )
ADD_DEFINITIONS ( "-DBT_USE_OPENMP=1" )
IF ( MSVC )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp" )
ELSE ( MSVC )
# GCC, Clang
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp" )
ENDIF ( MSVC )
ENDIF ( BULLET2_USE_OPEN_MP_MULTITHREADING )
IF ( BULLET2_USE_TBB_MULTITHREADING )
SET ( BULLET2_TBB_INCLUDE_DIR "not found" CACHE PATH "Directory for Intel TBB includes." )
SET ( BULLET2_TBB_LIB_DIR "not found" CACHE PATH "Directory for Intel TBB libraries." )
find_library ( TBB_LIBRARY tbb PATHS ${ BULLET2_TBB_LIB_DIR } )
find_library ( TBBMALLOC_LIBRARY tbbmalloc PATHS ${ BULLET2_TBB_LIB_DIR } )
ADD_DEFINITIONS ( "-DBT_USE_TBB=1" )
INCLUDE_DIRECTORIES ( ${ BULLET2_TBB_INCLUDE_DIR } )
LINK_LIBRARIES ( ${ TBB_LIBRARY } ${ TBBMALLOC_LIBRARY } )
ENDIF ( BULLET2_USE_TBB_MULTITHREADING )
IF ( BULLET2_USE_PPL_MULTITHREADING )
ADD_DEFINITIONS ( "-DBT_USE_PPL=1" )
ENDIF ( BULLET2_USE_PPL_MULTITHREADING )
2013-12-19 20:40:59 +00:00
IF ( WIN32 )
OPTION ( USE_GLUT "Use Glut" ON )
ADD_DEFINITIONS ( -D_CRT_SECURE_NO_WARNINGS )
ADD_DEFINITIONS ( -D_CRT_SECURE_NO_DEPRECATE )
ADD_DEFINITIONS ( -D_SCL_SECURE_NO_WARNINGS )
IF ( USE_GLUT AND MSVC )
2015-12-07 22:08:04 +00:00
string ( REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS ${ CMAKE_CXX_FLAGS } )
remove_definitions ( -D_WINDOWS )
2013-12-19 20:40:59 +00:00
ENDIF ( )
ELSE ( WIN32 )
OPTION ( USE_GLUT "Use Glut" ON )
ENDIF ( WIN32 )
2015-12-07 22:08:04 +00:00
2013-12-19 20:40:59 +00:00
IF ( COMMAND cmake_policy )
cmake_policy ( SET CMP0003 NEW )
ENDIF ( COMMAND cmake_policy )
2015-12-07 22:08:04 +00:00
2013-12-19 20:40:59 +00:00
# This is the shortcut to finding GLU, GLUT and OpenGL if they are properly installed on your system
# This should be the case.
FIND_PACKAGE ( OpenGL )
IF ( OPENGL_FOUND )
MESSAGE ( "OPENGL FOUND" )
MESSAGE ( ${ OPENGL_LIBRARIES } )
ELSE ( OPENGL_FOUND )
MESSAGE ( "OPENGL NOT FOUND" )
SET ( OPENGL_gl_LIBRARY opengl32 )
SET ( OPENGL_glu_LIBRARY glu32 )
ENDIF ( OPENGL_FOUND )
#FIND_PACKAGE(GLU)
2014-03-18 06:58:03 +00:00
2014-05-20 03:50:10 +00:00
IF ( APPLE )
FIND_LIBRARY ( COCOA_LIBRARY Cocoa )
ENDIF ( )
2014-05-14 04:52:46 +00:00
OPTION ( BUILD_BULLET3 "Set when you want to build Bullet 3" ON )
2017-09-22 03:42:52 +00:00
# Optional Python configuration
# builds pybullet automatically if all the requirements are met
2017-09-26 19:49:35 +00:00
SET ( PYTHON_VERSION_PYBULLET "" CACHE STRING "Python version pybullet will use." )
SET ( Python_ADDITIONAL_VERSIONS 3 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.7.12 2.7.10 2.7.3 )
2017-09-22 03:42:52 +00:00
SET_PROPERTY ( CACHE PYTHON_VERSION_PYBULLET PROPERTY STRINGS ${ Python_ADDITIONAL_VERSIONS } )
SET ( CMAKE_MODULE_PATH ${ CMAKE_CURRENT_SOURCE_DIR } /build3/cmake ${ CMAKE_MODULE_PATH } )
OPTION ( EXACT_PYTHON_VERSION "Require Python and match PYTHON_VERSION_PYBULLET exactly, e.g. 2.7.12" OFF )
IF ( EXACT_PYTHON_VERSION )
set ( EXACT_PYTHON_VERSION_FLAG EXACT REQUIRED )
ENDIF ( EXACT_PYTHON_VERSION )
# first find the python interpreter
FIND_PACKAGE ( PythonInterp ${ PYTHON_VERSION_PYBULLET } ${ EXACT_PYTHON_VERSION_FLAG } )
# python library should exactly match that of the interpreter
FIND_PACKAGE ( PythonLibs ${ PYTHON_VERSION_STRING } EXACT )
SET ( DEFAULT_BUILD_PYBULLET OFF )
IF ( PYTHONLIBS_FOUND )
SET ( DEFAULT_BUILD_PYBULLET ON )
ENDIF ( PYTHONLIBS_FOUND )
OPTION ( BUILD_PYBULLET "Set when you want to build pybullet (Python bindings for Bullet)" ${ DEFAULT_BUILD_PYBULLET } )
2017-05-21 00:47:46 +00:00
2017-02-24 23:34:11 +00:00
OPTION ( BUILD_ENET "Set when you want to build apps with enet UDP networking support" ON )
OPTION ( BUILD_CLSOCKET "Set when you want to build apps with enet TCP networking support" ON )
2016-06-13 17:11:28 +00:00
2016-09-11 10:35:12 +00:00
2017-05-21 00:47:46 +00:00
IF ( BUILD_PYBULLET )
2017-09-19 17:50:24 +00:00
FIND_PACKAGE ( PythonLibs )
2017-09-22 03:42:52 +00:00
2017-09-19 01:14:46 +00:00
OPTION ( BUILD_PYBULLET_NUMPY "Set when you want to build pybullet with NumPy support" OFF )
2016-11-04 20:16:25 +00:00
OPTION ( BUILD_PYBULLET_ENET "Set when you want to build pybullet with enet UDP networking support" ON )
2017-02-21 04:55:37 +00:00
OPTION ( BUILD_PYBULLET_CLSOCKET "Set when you want to build pybullet with enet TCP networking support" ON )
2017-04-11 19:17:08 +00:00
2017-05-21 00:47:46 +00:00
OPTION ( BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" OFF )
2017-04-11 19:17:08 +00:00
2017-05-21 00:47:46 +00:00
IF ( BUILD_PYBULLET_NUMPY )
2016-09-11 10:35:12 +00:00
#include(FindNumPy)
FIND_PACKAGE ( NumPy )
if ( PYTHON_NUMPY_FOUND )
message ( "NumPy found" )
add_definitions ( -DPYBULLET_USE_NUMPY )
else ( )
message ( "NumPy not found" )
endif ( )
ENDIF ( )
2016-05-10 07:57:54 +00:00
IF ( WIN32 )
SET ( BUILD_SHARED_LIBS OFF CACHE BOOL "Shared Libs" FORCE )
ELSE ( WIN32 )
SET ( BUILD_SHARED_LIBS ON CACHE BOOL "Shared Libs" FORCE )
ENDIF ( WIN32 )
2017-04-11 19:17:08 +00:00
IF ( APPLE )
OPTION ( BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" ON )
IF ( NOT BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK )
add_definitions ( -DB3_NO_PYTHON_FRAMEWORK )
ENDIF ( NOT BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK )
OPTION ( BUILD_PYBULLET_SHOW_PY_VERSION "Set when you want to show the PY_MAJOR_VERSION and PY_MAJOR_VERSION using #pragme message." OFF )
IF ( BUILD_PYBULLET_SHOW_PY_VERSION )
add_definitions ( -DB3_DUMP_PYTHON_VERSION )
ENDIF ( )
ENDIF ( APPLE )
2016-05-04 20:24:06 +00:00
ENDIF ( BUILD_PYBULLET )
2014-08-22 21:41:21 +00:00
2014-05-14 04:52:46 +00:00
IF ( BUILD_BULLET3 )
2014-08-22 21:41:21 +00:00
IF ( APPLE )
2015-12-07 22:08:04 +00:00
MESSAGE ( "Mac OSX Version is ${_CURRENT_OSX_VERSION}" )
IF ( _CURRENT_OSX_VERSION VERSION_LESS 10.9 )
MESSAGE ( "Mac OSX below 10.9 has no OpenGL 3 support so please disable the BUILD_OPENGL3_DEMOS option" )
#unset(BUILD_OPENGL3_DEMOS CACHE)
OPTION ( BUILD_OPENGL3_DEMOS "Set when you want to build the OpenGL3+ demos" OFF )
ELSE ( )
OPTION ( BUILD_OPENGL3_DEMOS "Set when you want to build the OpenGL3+ demos" ON )
ENDIF ( )
ELSE ( )
OPTION ( BUILD_OPENGL3_DEMOS "Set when you want to build Bullet 3 OpenGL3+ demos" ON )
ENDIF ( )
2014-05-14 04:52:46 +00:00
ELSE ( BUILD_BULLET3 )
2014-08-22 21:41:21 +00:00
unset ( BUILD_OPENGL3_DEMOS CACHE )
OPTION ( BUILD_OPENGL3_DEMOS "Set when you want to build Bullet 3 OpenGL3+ demos" OFF )
2014-05-14 04:52:46 +00:00
ENDIF ( BUILD_BULLET3 )
2014-08-22 21:41:21 +00:00
IF ( BUILD_OPENGL3_DEMOS )
2014-03-18 06:58:03 +00:00
IF ( EXISTS ${ BULLET_PHYSICS_SOURCE_DIR } /Demos3 AND IS_DIRECTORY ${ BULLET_PHYSICS_SOURCE_DIR } /Demos3 )
SUBDIRS ( Demos3 )
ENDIF ( )
2015-05-06 17:35:14 +00:00
ELSE ( )
ADD_DEFINITIONS ( -DNO_OPENGL3 )
2014-08-22 21:41:21 +00:00
ENDIF ( BUILD_OPENGL3_DEMOS )
2013-12-19 20:40:59 +00:00
2015-05-06 17:35:14 +00:00
OPTION ( BUILD_BULLET2_DEMOS "Set when you want to build the Bullet 2 demos" ON )
IF ( BUILD_BULLET2_DEMOS )
2015-12-07 22:08:04 +00:00
IF ( EXISTS ${ BULLET_PHYSICS_SOURCE_DIR } /examples AND IS_DIRECTORY ${ BULLET_PHYSICS_SOURCE_DIR } /examples )
SUBDIRS ( examples )
ENDIF ( )
2016-09-27 07:01:45 +00:00
2015-05-06 17:35:14 +00:00
ENDIF ( BUILD_BULLET2_DEMOS )
2014-05-12 23:12:01 +00:00
OPTION ( BUILD_EXTRAS "Set when you want to build the extras" ON )
IF ( BUILD_EXTRAS )
SUBDIRS ( Extras )
ENDIF ( BUILD_EXTRAS )
2013-12-19 20:40:59 +00:00
SUBDIRS ( src )
IF ( "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" )
OPTION ( INSTALL_LIBS "Set when you want to install libraries" ON )
ELSE ( )
IF ( APPLE AND FRAMEWORK )
OPTION ( INSTALL_LIBS "Set when you want to install libraries" ON )
ELSE ( )
#by default, don't enable the 'INSTALL' option for Xcode and MSVC projectfiles
OPTION ( INSTALL_LIBS "Set when you want to install libraries" OFF )
ENDIF ( )
ENDIF ( )
2017-09-06 22:59:34 +00:00
2013-12-19 20:40:59 +00:00
IF ( INSTALL_LIBS )
2017-09-06 22:59:34 +00:00
#INSTALL of other files requires CMake 2.6
IF ( BUILD_EXTRAS )
IF ( ${ CMAKE_MAJOR_VERSION } . ${ CMAKE_MINOR_VERSION } GREATER 2.5 )
OPTION ( INSTALL_EXTRA_LIBS "Set when you want extra libraries installed" ON )
ENDIF ( ${ CMAKE_MAJOR_VERSION } . ${ CMAKE_MINOR_VERSION } GREATER 2.5 )
ENDIF ( BUILD_EXTRAS )
2013-12-19 20:40:59 +00:00
SET ( LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
2014-08-31 19:36:02 +00:00
SET ( LIB_DESTINATION "lib${LIB_SUFFIX}" CACHE STRING "Library directory name" )
2013-12-19 20:40:59 +00:00
## the following are directories where stuff will be installed to
2015-12-07 22:08:04 +00:00
SET ( INCLUDE_INSTALL_DIR "include/bullet/" CACHE PATH "The subdirectory to the header prefix" )
2014-08-31 19:36:02 +00:00
SET ( PKGCONFIG_INSTALL_PREFIX "lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files" )
2014-10-02 02:56:54 +00:00
IF ( NOT MSVC )
2013-12-19 20:40:59 +00:00
CONFIGURE_FILE ( ${ CMAKE_CURRENT_SOURCE_DIR } /bullet.pc.cmake ${ CMAKE_CURRENT_BINARY_DIR } /bullet.pc @ONLY )
INSTALL (
2015-12-07 22:08:04 +00:00
F I L E S
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / b u l l e t . p c
D E S T I N A T I O N
$ { P K G C O N F I G _ I N S T A L L _ P R E F I X } )
2014-10-02 02:56:54 +00:00
ENDIF ( NOT MSVC )
2017-09-06 22:59:34 +00:00
ENDIF ( )
2013-12-19 20:40:59 +00:00
2014-04-08 16:04:32 +00:00
OPTION ( BUILD_UNIT_TESTS "Build Unit Tests" ON )
2013-12-19 20:40:59 +00:00
IF ( BUILD_UNIT_TESTS )
2015-11-25 00:13:21 +00:00
ENABLE_TESTING ( )
2014-04-08 16:04:32 +00:00
SUBDIRS ( test )
2013-12-19 20:40:59 +00:00
ENDIF ( )
set ( BULLET_CONFIG_CMAKE_PATH lib ${ LIB_SUFFIX } /cmake/bullet )
list ( APPEND BULLET_LIBRARIES LinearMath )
2017-09-06 20:18:39 +00:00
list ( APPEND BULLET_LIBRARIES Bullet3Common )
list ( APPEND BULLET_LIBRARIES BulletInverseDynamics )
2014-05-05 15:29:01 +00:00
list ( APPEND BULLET_LIBRARIES BulletCollision )
2013-12-19 20:40:59 +00:00
list ( APPEND BULLET_LIBRARIES BulletDynamics )
list ( APPEND BULLET_LIBRARIES BulletSoftBody )
2014-08-31 19:36:02 +00:00
set ( BULLET_USE_FILE ${ BULLET_CONFIG_CMAKE_PATH } /UseBullet.cmake )
2015-12-07 22:08:04 +00:00
configure_file ( ${ CMAKE_CURRENT_SOURCE_DIR } /BulletConfig.cmake.in
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / B u l l e t C o n f i g . c m a k e
@ O N L Y E S C A P E _ Q U O T E S
)
2017-09-24 17:45:08 +00:00
OPTION ( INSTALL_CMAKE_FILES "Install generated CMake files" ON )
IF ( INSTALL_CMAKE_FILES )
install ( FILES ${ CMAKE_CURRENT_SOURCE_DIR } /UseBullet.cmake
2015-12-07 22:08:04 +00:00
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / B u l l e t C o n f i g . c m a k e
D E S T I N A T I O N $ { B U L L E T _ C O N F I G _ C M A K E _ P A T H }
)
2017-09-24 17:45:08 +00:00
ENDIF ( INSTALL_CMAKE_FILES )