Skip to content

Commit

Permalink
update bullet ver target def
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Dec 4, 2023
1 parent a283778 commit b963af1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
16 changes: 12 additions & 4 deletions test/common_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ set(GZ_PHYSICS_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/resources")
# Get bullet version using pkg_check_modules as it is not available
# through the cmake module
gz_pkg_check_modules_quiet(bullet_version_check "bullet")
if (bullet_version_check_FOUND)
string(REPLACE "." "" GzBullet_VERSION ${bullet_version_check_VERSION})
endif()

foreach(test ${tests})
set(test_executable "${TEST_TYPE}_${test}")
Expand All @@ -71,9 +68,20 @@ foreach(test ${tests})
target_compile_definitions(${test_executable} PRIVATE
"TEST_WORLD_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/worlds/\""
"GZ_PHYSICS_RESOURCE_DIR=\"${GZ_PHYSICS_RESOURCE_DIR}\""
"BT_BULLET_VERSION=${GzBullet_VERSION}"
)

if (bullet_version_check_VERSION VERSION_GREATER_EQUAL 2.89)
target_compile_definitions(${test_executable} PRIVATE
"BT_BULLET_VERSION_GE_289"
)
endif()
if (bullet_version_check_VERSION VERSION_LESS_EQUAL 3.25)
target_compile_definitions(${test_executable} PRIVATE
"BT_BULLET_VERSION_LE_325"
)
endif()


install(TARGETS ${test_executable} DESTINATION ${TEST_INSTALL_DIR})

configure_common_test("bullet" ${test_executable})
Expand Down
4 changes: 2 additions & 2 deletions test/common_test/joint_transmitted_wrench_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ TYPED_TEST(JointTransmittedWrenchFixture, PendulumAtZeroAngle)
TYPED_TEST(JointTransmittedWrenchFixture, PendulumInMotion)
{
// This test requires https://github.com/bulletphysics/bullet3/pull/4462
#if BT_BULLET_VERSION <= 325
#ifdef BT_BULLET_VERSION_LE_325
if (this->engineName == "bullet-featherstone")
GTEST_SKIP();
#endif
Expand Down Expand Up @@ -415,7 +415,7 @@ TYPED_TEST(JointTransmittedWrenchFixture, JointLosses)
TYPED_TEST(JointTransmittedWrenchFixture, ContactForces)
{
// This test requires https://github.com/bulletphysics/bullet3/pull/4462
#if BT_BULLET_VERSION <= 325
#if BT_BULLET_VERSION_LE_325
if (this->engineName == "bullet-featherstone")
GTEST_SKIP();
#endif
Expand Down
6 changes: 5 additions & 1 deletion test/common_test/world_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,15 @@ TEST_F(WorldNestedModelTest, WorldConstructNestedModel)
EXPECT_FALSE(worldModel->ConstructJoint(joint));
joint.SetChildName("parent_model::link1");
if (PhysicsEngineName(name) != "bullet-featherstone")
{
EXPECT_TRUE(worldModel->ConstructJoint(joint));
}
else
#if BT_BULLET_VERSION >= 289
{
#ifdef BT_BULLET_VERSION_GE_289
EXPECT_TRUE(worldModel->ConstructJoint(joint));
#endif
}

gz::physics::ForwardStep::Input input;
gz::physics::ForwardStep::State state;
Expand Down

0 comments on commit b963af1

Please sign in to comment.