Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16.3) # version on Ubuntu Focal

project(behaviortree_cpp VERSION 4.7.2 LANGUAGES C CXX)
project(behaviortree_cpp_picknik VERSION 4.7.2 LANGUAGES C CXX)

# create compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down Expand Up @@ -188,7 +188,7 @@ target_link_libraries(${BTCPP_LIBRARY}
target_include_directories(${BTCPP_LIBRARY}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:${BTCPP_INCLUDE_DESTINATION}>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lexy/include>
Expand All @@ -212,6 +212,15 @@ endif()

add_library(BT::${BTCPP_LIBRARY} ALIAS ${BTCPP_LIBRARY})

# A versioned soname (libbehaviortree_cpp_picknik.so.<major>.<minor>) makes a
# binary built against one ABI fail loudly at load time instead of silently
# binding to an incompatible library. Upstream ships an unversioned soname,
# which is what made the nav2 ABI mismatch in moveit_pro#20928 silently
# reachable. Minor-version bumps of this fork are treated as ABI breaks.
set_target_properties(${BTCPP_LIBRARY} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})

# Add fuzzing targets
if(ENABLE_FUZZING)
add_fuzzing_targets()
Expand Down
8 changes: 6 additions & 2 deletions cmake/ament_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ set( BTCPP_EXTRA_LIBRARIES
ament_export_dependencies(ament_index_cpp)

set( BTCPP_LIB_DESTINATION lib )
set( BTCPP_INCLUDE_DESTINATION include )
# Headers install under a package-scoped root so this fork can coexist with
# upstream behaviortree_cpp on the same system (moveit_pro#20928). The exported
# include dir below points consumers at the scoped root, so source code keeps
# using #include "behaviortree_cpp/..." unchanged.
set( BTCPP_INCLUDE_DESTINATION include/${PROJECT_NAME} )
set( BTCPP_BIN_DESTINATION bin )

mark_as_advanced(
Expand All @@ -35,7 +39,7 @@ mark_as_advanced(
BTCPP_BIN_DESTINATION )

macro(export_btcpp_package)
ament_export_include_directories(include)
ament_export_include_directories(${BTCPP_INCLUDE_DESTINATION})
ament_export_libraries(${BTCPP_LIBRARY})
ament_export_targets(${BTCPP_LIBRARY}Targets)
ament_package()
Expand Down
7 changes: 7 additions & 0 deletions include/behaviortree_cpp/basic_types.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#pragma once

// Marks these headers as the PickNik fork (behaviortree_cpp_picknik). Stock
// upstream behaviortree_cpp coexists in the same image for nav2, and its
// unscoped headers could win include resolution in a misconfigured build —
// compiling fork consumers against the wrong ABI. Downstream code that
// requires the fork checks this macro and fails the compile loudly instead.
#define BTCPP_PICKNIK_FORK 1

#include <algorithm>
#include <cctype>
#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<package format="3">
<name>behaviortree_cpp</name>
<name>behaviortree_cpp_picknik</name>
<version>4.7.2</version>
<description>
This package provides the Behavior Trees core library.
Expand Down
12 changes: 6 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ else()
find_package(GTest REQUIRED)

enable_testing()
add_executable(behaviortree_cpp_test ${BT_TESTS})
add_test(NAME btcpp_test COMMAND behaviortree_cpp_test)
add_executable(${BTCPP_LIBRARY}_test ${BT_TESTS})
add_test(NAME btcpp_test COMMAND ${BTCPP_LIBRARY}_test)

target_link_libraries(behaviortree_cpp_test
target_link_libraries(${BTCPP_LIBRARY}_test
GTest::gtest
GTest::gtest_main
GTest::gmock
)

endif()

target_link_libraries(behaviortree_cpp_test ${BTCPP_LIBRARY} bt_sample_nodes foonathan::lexy)
target_include_directories(behaviortree_cpp_test PRIVATE include ${PROJECT_SOURCE_DIR}/3rdparty)
target_compile_definitions(behaviortree_cpp_test PRIVATE BT_TEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(${BTCPP_LIBRARY}_test ${BTCPP_LIBRARY} bt_sample_nodes foonathan::lexy)
target_include_directories(${BTCPP_LIBRARY}_test PRIVATE include ${PROJECT_SOURCE_DIR}/3rdparty)
target_compile_definitions(${BTCPP_LIBRARY}_test PRIVATE BT_TEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
Loading