vcpkg/ports/behaviortree-cpp/fix-x86_build.patch
MonicaLiu 3256b183d0
[behaviortree-cpp] Update to 4.1.1 (#31287)
* update behaviortree-cpp

* update version

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
2023-05-11 10:32:00 -07:00

36 lines
1.2 KiB
Diff

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}