diff --git a/CMakeLists.txt b/CMakeLists.txt index 99ac98e54f..166ed64641 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/framewor include(CocosBuildHelpers) option(USE_CHIPMUNK "Use chipmunk for physics library" ON) +option(USE_BULLET "Use bullet for physics3d library" ON) option(USE_BOX2D "Use box2d for physics library" OFF) option(DEBUG_MODE "Debug or release?" ON) option(BUILD_EXTENSIONS "Build extension library" ON) @@ -193,6 +194,24 @@ else() add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=0) endif(USE_BOX2D) +# Bullet (not prebuilded, exists as source) +if(USE_BULLET) + if(USE_PREBUILT_LIBS) + add_subdirectory(frameworks/cocos2d-x/external/bullet) + set(BULLET_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x/external/bullet) + set(BULLET_LIBRARIES bullet) + else() + cocos_find_package(bullet BULLET REQUIRED) + set(BULLET_LIBRARIES bullet) + endif() + message(STATUS "Bullet include dirs: ${BULLET_INCLUDE_DIRS}") + add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=1) + add_definitions(-DCC_USE_PHYSICS=1) +else() + add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=0) + add_definitions(-DCC_USE_3D_PHYSICS=0) +endif(USE_BULLET) + # Tinyxml2 (not prebuilded, exists as source) if(USE_PREBUILT_LIBS) add_subdirectory(frameworks/js-bindings/cocos2d-x/external/tinyxml2)