Skip to content

Commit

Permalink
Switch to upstream bullet
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Jun 22, 2017
1 parent e268193 commit 2e8d721
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
url = https://github.com/gflags/gflags.git
[submodule "externals/bullet"]
path = externals/bullet
url = https://github.com/RobotLocomotion/bullet3.git
url = https://github.com/bulletphysics/bullet3.git
[submodule "externals/ccd"]
path = externals/ccd
url = https://github.com/danfis/libccd.git
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ github_archive(

github_archive(
name = "bullet",
repository = "RobotLocomotion/bullet3",
commit = "ae2c4ca0618d55c6a29900aed75b958604149fdb",
repository = "bulletphysics/bullet3",
commit = "2.85.1",
build_file = "tools/bullet.BUILD",
sha256 = "2121dc8b0d33f50adbad8fc9ac5e007141df5cf5738fce72200c5bac4ffc589b",
sha256 = "6e157c0b50373bc0e860de27f06397827bb28a4205bc568ae79d76a0f919ed62",
)

github_archive(
Expand Down
5 changes: 5 additions & 0 deletions drake/matlab/systems/trajectories/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ if(Matlab_FOUND)
endif()

if(Bullet_FOUND AND Matlab_FOUND)
# TODO(jamiesnape): Create imported target for Bullet.
if(BLAS_FOUND AND snopt_FOUND)
drake_add_mex(replanFunnels_mex replanFunnels_mex.cpp)
target_include_directories(replanFunnels_mex PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(replanFunnels_mex drakeMexUtil snopt_c
${BLAS_LIBRARIES} ${BULLET_LIBRARIES})
target_compile_definitions(replanFunnels_mex PRIVATE BT_USE_DOUBLE_PRECISION)

drake_add_mex(shiftFunnel_snopt_mex shiftFunnel_snopt_mex.cpp)
target_include_directories(shiftFunnel_snopt_mex PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(shiftFunnel_snopt_mex drakeMexUtil snopt_c
${BLAS_LIBRARIES} ${BULLET_LIBRARIES})
target_compile_definitions(shiftFunnel_snopt_mex PRIVATE BT_USE_DOUBLE_PRECISION)

# Some platforms require extra link flags. On those that do not, the
# BLAS_LINKER_FLAGS variable is undefined.
Expand All @@ -34,10 +37,12 @@ if(Bullet_FOUND AND Matlab_FOUND)
drake_add_mex(isCollisionFree_mex isCollisionFree_mex.cpp)
target_include_directories(isCollisionFree_mex PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(isCollisionFree_mex drakeMexUtil ${BULLET_LIBRARIES})
target_compile_definitions(isCollisionFree_mex PRIVATE BT_USE_DOUBLE_PRECISION)

drake_add_mex(ptToPolyBullet_mex ptToPolyBullet_mex.cpp)
target_include_directories(ptToPolyBullet_mex PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(ptToPolyBullet_mex drakeMexUtil ${BULLET_LIBRARIES})
target_compile_definitions(ptToPolyBullet_mex PRIVATE BT_USE_DOUBLE_PRECISION)
endif()

if(BUILD_TESTING)
Expand Down
3 changes: 2 additions & 1 deletion drake/multibody/collision/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ add_library_with_exports(LIB_NAME drakeCollision SOURCE_FILES ${drakeCollision_S

set(bullet_dependent_requires)
if(Bullet_FOUND)
target_compile_definitions(drakeCollision PUBLIC BULLET_COLLISION)
target_compile_definitions(drakeCollision PUBLIC
BT_USE_DOUBLE_PRECISION BULLET_COLLISION)
target_include_directories(drakeCollision PUBLIC ${BULLET_INCLUDE_DIRS})
target_link_libraries(drakeCollision ${BULLET_LIBRARIES})
set(bullet_dependent_requires bullet)
Expand Down
2 changes: 1 addition & 1 deletion externals/bullet
Submodule bullet updated 586 files
24 changes: 23 additions & 1 deletion tools/bullet-create-cps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,41 @@
"Description": "Real-time collision detection and multi-physics simulation",
"License": "Zlib",
"Version": "%s",
"Default-Components": [":BulletCollision"],
"Default-Components": [
":BulletCollision",
":BulletDynamics"
],
"Components": {
"BulletCollision": {
"Type": "dylib",
"Location": "@prefix@/lib/libBulletCollision.so",
"Includes": ["@prefix@/include/bullet"],
"Requires": [":LinearMath"]
},
"BulletDynamics": {
"Type": "dylib",
"Location": "@prefix@/lib/libBulletDynamics.so",
"Includes": ["@prefix@/include/bullet"],
"Requires": [
":BulletCollision",
":LinearMath"
]
},
"LinearMath": {
"Type": "dylib",
"Location": "@prefix@/lib/libLinearMath.so",
"Definitions": ["BT_USE_DOUBLE_PRECISION"],
"Includes": ["@prefix@/include/bullet"]
},
"BulletSoftBody": {
"Type": "dylib",
"Location": "@prefix@/lib/libBulletSoftBody.so",
"Includes": ["@prefix@/include/bullet"],
"Requires": [
":BulletCollision",
":BulletDynamics",
":LinearMath"
]
}
}
}
Expand Down
49 changes: 37 additions & 12 deletions tools/bullet.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ package(default_visibility = ["//visibility:public"])

# Note that this is only a portion of Bullet.

BULLET_COPTS = ["-Wno-all"]

BULLET_INCLUDES = ["src"]

# Keep defines in sync with Components.LinearMath.Definitions in
# bullet-create-cps.py.
cc_library(
name = "LinearMath",
srcs = glob(["src/LinearMath/**/*.cpp"]),
hdrs = glob(["src/LinearMath/**/*.h"]),
copts = ["-Wno-all"],
copts = BULLET_COPTS,
defines = ["BT_USE_DOUBLE_PRECISION"],
includes = ["src"],
includes = BULLET_INCLUDES,
)

cc_library(
Expand All @@ -30,17 +34,36 @@ cc_library(
hdrs = glob(["src/BulletCollision/**/*.h"]) + [
"src/btBulletCollisionCommon.h",
],
copts = ["-Wno-all"],
includes = ["src"],
copts = BULLET_COPTS,
includes = BULLET_INCLUDES,
deps = [":LinearMath"],
)

pkg_tar(
name = "license",
extension = "tar.gz",
files = ["LICENSE.txt"],
mode = "0644",
package_dir = "bullet",
cc_library(
name = "BulletDynamics",
srcs = glob(["src/BulletDynamics/**/*.cpp"]),
hdrs = glob(["src/BulletDynamics/**/*.h"]) + [
"src/btBulletDynamicsCommon.h",
],
copts = BULLET_COPTS,
includes = BULLET_INCLUDES,
deps = [
":BulletCollision",
":LinearMath",
],
)

cc_library(
name = "BulletSoftBody",
srcs = glob(["src/BulletSoftBody/**/*.cpp"]),
hdrs = glob(["src/BulletSoftBody/**/*.h"]),
copts = BULLET_COPTS,
includes = BULLET_INCLUDES,
deps = [
":BulletCollision",
":BulletDynamics",
":LinearMath",
],
)

cmake_config(
Expand All @@ -49,18 +72,20 @@ cmake_config(
version_file = "VERSION",
)

install_cmake_config(package = "Bullet") # Creates rule :install_cmake_config.
install_cmake_config(package = "Bullet")

install(
name = "install",
doc_dest = "share/doc/bullet",
docs = ["AUTHORS.txt"],
guess_hdrs = "PACKAGE",
hdr_dest = "include/bullet",
hdr_strip_prefix = ["src"],
hdr_strip_prefix = BULLET_INCLUDES,
license_docs = ["LICENSE.txt"],
targets = [
":BulletCollision",
":BulletDynamics",
":BulletSoftBody",
":LinearMath",
],
deps = [":install_cmake_config"],
Expand Down

0 comments on commit 2e8d721

Please sign in to comment.