Skip to content

Commit 46fe516

Browse files
Fix Windows build issues (#762, #869, #836) (#1089)
* Fix Windows build issues (#762, #869, #836) - Add export.h with BTCPP_API macro for proper DLL symbol visibility, replacing fragile CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS approach (#762) - Apply BTCPP_API to all public API classes (TreeNode, BehaviorTreeFactory, Tree, Blackboard, ControlNode, DecoratorNode, action/condition nodes) - Remove redundant TINYXML2_DEBUG definition that caused Debug mode crashes on VS 2022 (#869) - Add MSVC runtime propagation in conanfile.py (#836) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Keep CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS alongside explicit BTCPP_API macros The BTCPP_API export macro was only applied to a few key classes, but many free functions and other class members still need to be exported. Restore CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS as a catch-all while keeping the explicit export macros for forward compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove BTCPP_API export macros — redundant with CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS The selective BTCPP_API approach only covered a few classes while the library exports many more free functions and class members. Since CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS already handles all symbol exports, the partial BTCPP_API annotations were dead code. Remove export.h and all BTCPP_API annotations to keep the diff minimal. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e2460ae commit 46fe516

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ target_include_directories(${BTCPP_LIBRARY}
260260
${BTCPP_EXTRA_INCLUDE_DIRS}
261261
)
262262

263-
target_compile_definitions(${BTCPP_LIBRARY} PRIVATE $<$<CONFIG:Debug>:TINYXML2_DEBUG>)
264263
target_compile_definitions(${BTCPP_LIBRARY} PUBLIC BTCPP_LIBRARY_VERSION="${CMAKE_PROJECT_VERSION}")
265264

266265
target_compile_features(${BTCPP_LIBRARY} PUBLIC cxx_std_17)

conanfile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ def generate(self):
3333
tc.cache_variables["USE_VENDORED_MINICORO"] = False
3434
tc.cache_variables["USE_VENDORED_MINITRACE"] = False
3535
tc.cache_variables["USE_VENDORED_TINYXML2"] = False
36+
37+
# Ensure MSVC runtime is correctly propagated
38+
if self.settings.os == "Windows":
39+
tc.cache_variables["CMAKE_MSVC_RUNTIME_LIBRARY"] = \
40+
"MultiThreadedDebugDLL" if self.settings.build_type == "Debug" \
41+
else "MultiThreadedDLL"
42+
3643
tc.generate()
3744

3845
deps = CMakeDeps(self)

0 commit comments

Comments
 (0)