diff --git a/nav2_smac_planner/CMakeLists.txt b/nav2_smac_planner/CMakeLists.txt index 4ae1a98ad9e..24317d4d693 100644 --- a/nav2_smac_planner/CMakeLists.txt +++ b/nav2_smac_planner/CMakeLists.txt @@ -42,9 +42,17 @@ add_library(${library_name}_common SHARED src/node_lattice.cpp src/smoother.cpp ) +# Add GenerateExportHeader support for symbol visibility, as we are using +# static members we need to explicitly export them on Windows, as +# CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS does not work with static members. +include(GenerateExportHeader) +generate_export_header(${library_name}_common + EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/${library_name}_common_visibility_control.hpp" +) target_include_directories(${library_name}_common PUBLIC "$" + "$" "$" ${OMPL_INCLUDE_DIRS} ) @@ -167,6 +175,10 @@ install(TARGETS ${library_name}_common ${library_name} ${library_name}_2d ${libr install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME} ) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/${library_name}_common_visibility_control.hpp" + DESTINATION include/${PROJECT_NAME} +) install(DIRECTORY lattice_primitives/sample_primitives DESTINATION share/${PROJECT_NAME}) diff --git a/nav2_smac_planner/include/nav2_smac_planner/node_hybrid.hpp b/nav2_smac_planner/include/nav2_smac_planner/node_hybrid.hpp index cc3650563a8..6b897611526 100644 --- a/nav2_smac_planner/include/nav2_smac_planner/node_hybrid.hpp +++ b/nav2_smac_planner/include/nav2_smac_planner/node_hybrid.hpp @@ -26,6 +26,7 @@ #include "nav2_smac_planner/types.hpp" #include "nav2_smac_planner/collision_checker.hpp" #include "nav2_smac_planner/costmap_downsampler.hpp" +#include "nav2_smac_planner/nav2_smac_planner_common_visibility_control.hpp" #include "nav2_costmap_2d/costmap_2d_ros.hpp" #include "nav2_costmap_2d/inflation_layer.hpp" @@ -473,16 +474,16 @@ class NodeHybrid Coordinates pose; // Constants required across all nodes but don't want to allocate more than once - static float travel_distance_cost; - static HybridMotionTable motion_table; + NAV2_SMAC_PLANNER_COMMON_EXPORT static float travel_distance_cost; + NAV2_SMAC_PLANNER_COMMON_EXPORT static HybridMotionTable motion_table; // Wavefront lookup and queue for continuing to expand as needed - static LookupTable obstacle_heuristic_lookup_table; - static ObstacleHeuristicQueue obstacle_heuristic_queue; + NAV2_SMAC_PLANNER_COMMON_EXPORT static LookupTable obstacle_heuristic_lookup_table; + NAV2_SMAC_PLANNER_COMMON_EXPORT static ObstacleHeuristicQueue obstacle_heuristic_queue; - static std::shared_ptr costmap_ros; + NAV2_SMAC_PLANNER_COMMON_EXPORT static std::shared_ptr costmap_ros; // Dubin / Reeds-Shepp lookup and size for dereferencing - static LookupTable dist_heuristic_lookup_table; - static float size_lookup; + NAV2_SMAC_PLANNER_COMMON_EXPORT static LookupTable dist_heuristic_lookup_table; + NAV2_SMAC_PLANNER_COMMON_EXPORT static float size_lookup; private: float _cell_cost; diff --git a/nav2_smac_planner/include/nav2_smac_planner/node_lattice.hpp b/nav2_smac_planner/include/nav2_smac_planner/node_lattice.hpp index 5b07e5453bf..6f330727bee 100644 --- a/nav2_smac_planner/include/nav2_smac_planner/node_lattice.hpp +++ b/nav2_smac_planner/include/nav2_smac_planner/node_lattice.hpp @@ -27,6 +27,7 @@ #include "nav2_smac_planner/collision_checker.hpp" #include "nav2_smac_planner/node_hybrid.hpp" #include "nav2_smac_planner/utils.hpp" +#include "nav2_smac_planner/nav2_smac_planner_common_visibility_control.hpp" namespace nav2_smac_planner { @@ -415,10 +416,10 @@ class NodeLattice NodeLattice * parent; Coordinates pose; - static LatticeMotionTable motion_table; + NAV2_SMAC_PLANNER_COMMON_EXPORT static LatticeMotionTable motion_table; // Dubin / Reeds-Shepp lookup and size for dereferencing - static LookupTable dist_heuristic_lookup_table; - static float size_lookup; + NAV2_SMAC_PLANNER_COMMON_EXPORT static LookupTable dist_heuristic_lookup_table; + NAV2_SMAC_PLANNER_COMMON_EXPORT static float size_lookup; private: float _cell_cost;