From 3256b183d05cf03837711dd224dfb0b3bbabcd2b Mon Sep 17 00:00:00 2001 From: MonicaLiu <110024546+MonicaLiu0311@users.noreply.github.com> Date: Fri, 12 May 2023 01:32:00 +0800 Subject: [PATCH] [behaviortree-cpp] Update to 4.1.1 (#31287) * update behaviortree-cpp * update version --------- Co-authored-by: Monica --- ports/behaviortree-cpp/001_port_fixes.patch | 13 ------- .../002_fix_dependencies.patch | 34 ------------------ ports/behaviortree-cpp/fix-x86_build.patch | 35 +++++++++++++++++++ ports/behaviortree-cpp/portfile.cmake | 35 ++++++++++--------- ports/behaviortree-cpp/vcpkg.json | 3 +- versions/b-/behaviortree-cpp.json | 5 +++ versions/baseline.json | 4 +-- 7 files changed, 61 insertions(+), 68 deletions(-) delete mode 100644 ports/behaviortree-cpp/001_port_fixes.patch delete mode 100644 ports/behaviortree-cpp/002_fix_dependencies.patch create mode 100644 ports/behaviortree-cpp/fix-x86_build.patch diff --git a/ports/behaviortree-cpp/001_port_fixes.patch b/ports/behaviortree-cpp/001_port_fixes.patch deleted file mode 100644 index 9897caa1881e74..00000000000000 --- a/ports/behaviortree-cpp/001_port_fixes.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a390aed..658f994 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -233,7 +233,7 @@ if( ZMQ_FOUND ) - endif() - - if(MSVC) -- target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE /W3 /WX) -+ target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE /W3 /wd4702) - else() - target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE - -Wall -Wextra -Werror=return-type) diff --git a/ports/behaviortree-cpp/002_fix_dependencies.patch b/ports/behaviortree-cpp/002_fix_dependencies.patch deleted file mode 100644 index d554e37ce549ff..00000000000000 --- a/ports/behaviortree-cpp/002_fix_dependencies.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 658f994..a04cf27 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -14,7 +14,7 @@ if(MSVC) - endif() - - #---- Include boost to add coroutines ---- --find_package(Boost COMPONENTS coroutine QUIET) -+find_package(Boost REQUIRED) # coroutine2 is header-only - - if(Boost_FOUND) - string(REPLACE "." "0" Boost_VERSION_NODOT ${Boost_VERSION}) -@@ -46,17 +46,18 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON) - - #---- Find other packages ---- - find_package(Threads) --find_package(ZMQ) -+find_package(cppzmq) - - list(APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES - ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_DL_LIBS} - ) - --if( ZMQ_FOUND ) -+if( ZMQ_FOUND OR ON ) - message(STATUS "ZeroMQ found.") - add_definitions( -DZMQ_FOUND ) - list(APPEND BT_SOURCE src/loggers/bt_zmq_publisher.cpp) -+ list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES cppzmq) - else() - message(WARNING "ZeroMQ NOT found. Skipping the build of [PublisherZMQ] and [bt_recorder].") - endif() diff --git a/ports/behaviortree-cpp/fix-x86_build.patch b/ports/behaviortree-cpp/fix-x86_build.patch new file mode 100644 index 00000000000000..164e9dff03d166 --- /dev/null +++ b/ports/behaviortree-cpp/fix-x86_build.patch @@ -0,0 +1,35 @@ +diff --git a/3rdparty/lexy/include/lexy/_detail/swar.hpp b/3rdparty/lexy/include/lexy/_detail/swar.hpp +index a268abb..d31bdaa 100644 +--- a/3rdparty/lexy/include/lexy/_detail/swar.hpp ++++ b/3rdparty/lexy/include/lexy/_detail/swar.hpp +@@ -141,8 +141,13 @@ constexpr std::size_t swar_find_difference(swar_int lhs, swar_int rhs) + auto bit_idx = __builtin_ctzll(mask); + #elif defined(_MSC_VER) + unsigned long bit_idx; +- if (!_BitScanForward64(&bit_idx, mask)) +- bit_idx = 64; ++ #if defined(_WIN64) ++ if (!_BitScanForward64(&bit_idx, mask)) ++ bit_idx = 64; ++ #elif defined(_WIN32) ++ if (!_BitScanForward(&bit_idx, mask)) ++ bit_idx = 32; ++ #endif + #else + # error "unsupported compiler; please file an issue" + #endif +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 295b317..0f1cd5c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -154,6 +154,10 @@ else() + add_library(${BTCPP_LIBRARY} STATIC ${BT_SOURCE}) + endif() + ++if (MSVC) ++ target_compile_definitions(${BTCPP_LIBRARY} PRIVATE NOMINMAX) ++endif () ++ + message(STATUS "BTCPP_EXTRA_LIBRARIES: ${BTCPP_EXTRA_LIBRARIES}") + + target_link_libraries(${BTCPP_LIBRARY} diff --git a/ports/behaviortree-cpp/portfile.cmake b/ports/behaviortree-cpp/portfile.cmake index 7b77e10c52bd5f..a15d5c9c1937c9 100644 --- a/ports/behaviortree-cpp/portfile.cmake +++ b/ports/behaviortree-cpp/portfile.cmake @@ -1,17 +1,14 @@ -vcpkg_check_linkage(ONLY_STATIC_LIBRARY) - vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/3.5.6.tar.gz" - FILENAME "BehaviorTree.CPP.3.5.6.tar.gz" - SHA512 cd3b15eb7c5bab68239b697da166220b4df8dd7e6cf5e831f316d411e24be56c9ed74e54a3e3dd332164d740159eaf9ce62d005601fd65133809dab29430c9b7 + URLS "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/${VERSION}.tar.gz" + FILENAME "BehaviorTree.CPP.${VERSION}.tar.gz" + SHA512 4505c4c8798ccbbc02f58320810eb86e791fb6ef57d8c85882e62bd2b509b41e0549dc311ed61926a873b5b956eda979efda488f01d00746e1e8db559f60253c ) vcpkg_extract_source_archive( SOURCE_PATH ARCHIVE "${ARCHIVE}" PATCHES - 001_port_fixes.patch - 002_fix_dependencies.patch + fix-x86_build.patch ) vcpkg_cmake_configure( @@ -19,19 +16,23 @@ vcpkg_cmake_configure( OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_ament_cmake=1 -DCMAKE_DISABLE_FIND_PACKAGE_Curses=1 - -DBUILD_EXAMPLES=OFF - -DBUILD_UNIT_TESTS=OFF - -DBUILD_TOOLS=OFF + -DBTCPP_EXAMPLES=OFF + -DBTCPP_UNIT_TESTS=OFF + -DBTCPP_BUILD_TOOLS=OFF + -DBTCPP_GROOT_INTERFACE=OFF + -DBTCPP_SQLITE_LOGGING=OFF + MAYBE_UNUSED_VARIABLES + CMAKE_DISABLE_FIND_PACKAGE_Curses ) vcpkg_cmake_install() -vcpkg_cmake_config_fixup(CONFIG_PATH lib/BehaviorTreeV3/cmake PACKAGE_NAME behaviortreev3) +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/behaviortree_cpp PACKAGE_NAME behaviortree_cpp) vcpkg_copy_pdbs() -file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") -file(REMOVE_RECURSE - "${CURRENT_PACKAGES_DIR}/debug/include" - "${CURRENT_PACKAGES_DIR}/lib/BehaviorTreeV3" - "${CURRENT_PACKAGES_DIR}/debug/lib/BehaviorTreeV3" -) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() diff --git a/ports/behaviortree-cpp/vcpkg.json b/ports/behaviortree-cpp/vcpkg.json index d99f0e5215fab6..7305ae8c9ef05d 100644 --- a/ports/behaviortree-cpp/vcpkg.json +++ b/ports/behaviortree-cpp/vcpkg.json @@ -1,7 +1,6 @@ { "name": "behaviortree-cpp", - "version": "3.5.6", - "port-version": 3, + "version": "4.1.1", "description": "Behavior Trees Library in C++.", "homepage": "https://www.behaviortree.dev", "supports": "!uwp", diff --git a/versions/b-/behaviortree-cpp.json b/versions/b-/behaviortree-cpp.json index bc7a1610b60ca4..b434fa52ae2982 100644 --- a/versions/b-/behaviortree-cpp.json +++ b/versions/b-/behaviortree-cpp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "66a97129b31a5e70e45a40c767ea96b1e0477a93", + "version": "4.1.1", + "port-version": 0 + }, { "git-tree": "7518e59f9f1e994e3af289b8de87115834dcb758", "version": "3.5.6", diff --git a/versions/baseline.json b/versions/baseline.json index 685681762af31f..34d46a369964aa 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -501,8 +501,8 @@ "port-version": 2 }, "behaviortree-cpp": { - "baseline": "3.5.6", - "port-version": 3 + "baseline": "4.1.1", + "port-version": 0 }, "benchmark": { "baseline": "1.8.0",