Skip to content

Commit

Permalink
Fix library anchors on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwason committed Nov 30, 2024
1 parent 3f2f818 commit 475e99b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 17 deletions.
45 changes: 42 additions & 3 deletions tesseract_python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,55 @@ include(FindSWIG)
find_package(SWIG 4.1.1 REQUIRED)
include(UseSWIG)

macro(tesseract_python_find_target lib_name search_target)
# Find install directory of search_target

get_target_property(search_target_location ${search_target} LOCATION)
if (NOT WIN32)
get_filename_component(search_target_location_dir ${search_target_location} DIRECTORY)
else()
get_filename_component(search_target_location_dir1 ${search_target_location} DIRECTORY)
get_filename_component(search_target_location_dir2 ${search_target_location_dir1} DIRECTORY)
set(search_target_location_dir "${search_target_location_dir2}/lib")
endif()
# Find library lib_name
unset(lib_name_location)
find_library(lib_name_location ${lib_name} HINTS ${search_target_location_dir} NO_CACHE)
if (NOT lib_name_location)
message(FATAL_ERROR "Could not find library ${lib_name}")
endif()
# Create import target
add_library(tesseract::${lib_name} SHARED IMPORTED)
if (WIN32)
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_IMPLIB_RELWITHDEBINFO ${lib_name_location})
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_IMPLIB ${lib_name_location})
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_LOCATION ${lib_name_location})
else()
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_LOCATION ${lib_name_location})
endif()
endmacro()

tesseract_python_find_target(tesseract_collision_fcl_factories tesseract::tesseract_collision_core)
tesseract_python_find_target(tesseract_collision_bullet_factories tesseract::tesseract_collision_core)
tesseract_python_find_target(tesseract_kinematics_kdl_factories tesseract::tesseract_kinematics_core)
tesseract_python_find_target(tesseract_kinematics_ur_factory tesseract::tesseract_kinematics_core)
tesseract_python_find_target(tesseract_kinematics_opw_factory tesseract::tesseract_kinematics_core)
#tesseract_python_find_target(tesseract_kinematics_core_factories tesseract::tesseract_kinematics_core)
tesseract_python_find_target(tesseract_task_composer_factories tesseract::tesseract_task_composer)
tesseract_python_find_target(tesseract_task_composer_planning_factories tesseract::tesseract_task_composer)
# tesseract_python_find_target(tesseract_task_composer_planning_nodes tesseract::tesseract_task_composer)
tesseract_python_find_target(tesseract_task_composer_taskflow_factories tesseract::tesseract_task_composer)

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tesseract_python_module.cmake)

tesseract_python_module(tesseract_common_python SWIG_SRCS swig/tesseract_common_python.i PACKAGE tesseract_common LIBS tesseract::tesseract_common )
tesseract_python_module(tesseract_geometry_python SWIG_SRCS swig/tesseract_geometry_python.i PACKAGE tesseract_geometry LIBS tesseract::tesseract_geometry )
tesseract_python_module(tesseract_collision_python SWIG_SRCS swig/tesseract_collision_python.i PACKAGE tesseract_collision LIBS tesseract::tesseract_collision_core Bullet3::Bullet ) # tesseract::tesseract_collision_bullet_factories tesseract::tesseract_collision_fcl_factories )
tesseract_python_module(tesseract_collision_python SWIG_SRCS swig/tesseract_collision_python.i PACKAGE tesseract_collision LIBS tesseract::tesseract_collision_core Bullet3::Bullet tesseract::tesseract_collision_bullet_factories tesseract::tesseract_collision_fcl_factories )
tesseract_python_module(tesseract_scene_graph_python SWIG_SRCS swig/tesseract_scene_graph_python.i PACKAGE tesseract_scene_graph LIBS tesseract::tesseract_scene_graph )
tesseract_python_module(tesseract_srdf_python SWIG_SRCS swig/tesseract_srdf_python.i PACKAGE tesseract_srdf LIBS tesseract::tesseract_srdf )
tesseract_python_module(tesseract_urdf_python SWIG_SRCS swig/tesseract_urdf_python.i PACKAGE tesseract_urdf LIBS tesseract::tesseract_urdf )
tesseract_python_module(tesseract_state_solver_python SWIG_SRCS swig/tesseract_state_solver_python.i PACKAGE tesseract_state_solver LIBS tesseract::tesseract_state_solver_core tesseract::tesseract_state_solver_ofkt tesseract::tesseract_state_solver_kdl)
tesseract_python_module(tesseract_kinematics_python SWIG_SRCS swig/tesseract_kinematics_python.i PACKAGE tesseract_kinematics LIBS tesseract::tesseract_kinematics_core )# tesseract::tesseract_kinematics_kdl_factories tesseract::tesseract_kinematics_ur_factory tesseract::tesseract_kinematics_opw_factory tesseract::tesseract_kinematics_core_factories )
tesseract_python_module(tesseract_kinematics_python SWIG_SRCS swig/tesseract_kinematics_python.i PACKAGE tesseract_kinematics LIBS tesseract::tesseract_kinematics_core tesseract::tesseract_kinematics_kdl_factories tesseract::tesseract_kinematics_ur_factory tesseract::tesseract_kinematics_opw_factory tesseract::tesseract_kinematics_core_factories )
tesseract_python_module(tesseract_environment_python SWIG_SRCS swig/tesseract_environment_python.i PACKAGE tesseract_environment LIBS tesseract::tesseract_environment )
tesseract_python_module(tesseract_visualization_python SWIG_SRCS swig/tesseract_visualization_python.i PACKAGE tesseract_visualization LIBS tesseract::tesseract_visualization)
tesseract_python_module(tesseract_command_language_python SWIG_SRCS swig/tesseract_command_language_python.i PACKAGE tesseract_command_language LIBS tesseract::tesseract_command_language)
Expand All @@ -149,7 +188,7 @@ tesseract_python_module(tesseract_motion_planners_trajopt_python SWIG_SRCS swig/
tesseract_python_module(tesseract_motion_planners_ompl_python SWIG_SRCS swig/tesseract_motion_planners_ompl_python.i PACKAGE tesseract_motion_planners_ompl LIBS tesseract::tesseract_motion_planners_ompl )
tesseract_python_module(tesseract_motion_planners_descartes_python SWIG_SRCS swig/tesseract_motion_planners_descartes_python.i PACKAGE tesseract_motion_planners_descartes LIBS tesseract::tesseract_motion_planners_descartes )
tesseract_python_module(tesseract_time_parameterization_python SWIG_SRCS swig/tesseract_time_parameterization_python.i PACKAGE tesseract_time_parameterization LIBS tesseract::tesseract_time_parameterization_core tesseract::tesseract_time_parameterization_isp tesseract::tesseract_time_parameterization_totg tesseract::tesseract_time_parameterization_ruckig)
tesseract_python_module(tesseract_task_composer_python SWIG_SRCS swig/tesseract_task_composer_python.i PACKAGE tesseract_task_composer LIBS tesseract::tesseract_task_composer tesseract::tesseract_task_composer_nodes tesseract::tesseract_task_composer_taskflow tesseract::tesseract_collision_core ) # tesseract::tesseract_task_composer_factories tesseract::tesseract_task_composer_planning_factories tesseract::tesseract_task_composer_planning tesseract::tesseract_task_composer_taskflow_factories )
tesseract_python_module(tesseract_task_composer_python SWIG_SRCS swig/tesseract_task_composer_python.i PACKAGE tesseract_task_composer LIBS tesseract::tesseract_task_composer tesseract::tesseract_task_composer_nodes tesseract::tesseract_task_composer_taskflow tesseract::tesseract_collision_core tesseract::tesseract_task_composer_factories tesseract::tesseract_task_composer_planning_factories tesseract::tesseract_task_composer_planning_nodes tesseract::tesseract_task_composer_taskflow_factories )

set(TESSERACT_PYTHON_MODULE_TARGETS
_tesseract_common_python
Expand Down
4 changes: 2 additions & 2 deletions tesseract_python/swig/tesseract_collision_python.i
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ class ContactResult;

%init %{
// TODO: fix anchors
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_bullet::BulletFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_fcl::FCLFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_bullet::BulletFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_fcl::FCLFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
%}
10 changes: 5 additions & 5 deletions tesseract_python/swig/tesseract_kinematics_python.i
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ struct KinGroupIKInput;

%init %{
// TODO: fix anchors
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::REPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::ROPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::KDLFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::OPWFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::URFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::REPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::ROPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::KDLFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::OPWFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::URFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");



Expand Down
13 changes: 6 additions & 7 deletions tesseract_python/swig/tesseract_task_composer_python.i
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,9 @@ enum class future_status {
%arg(env, profiles, name));*/

// contact_check_profile
// TODO: Fix library linking
// %shared_ptr(tesseract_planning::ContactCheckProfile)
// %include "tesseract_task_composer/planning/profiles/contact_check_profile.h"
// %tesseract_command_language_add_profile_type(ContactCheckProfile);
%shared_ptr(tesseract_planning::ContactCheckProfile)
%include "tesseract_task_composer/planning/profiles/contact_check_profile.h"
%tesseract_command_language_add_profile_type(ContactCheckProfile);

// fix_state_bounds_profile
%shared_ptr(tesseract_planning::FixStateBoundsProfile)
Expand Down Expand Up @@ -348,9 +347,9 @@ enum class future_status {

%init %{
// TODO: fix anchors
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerPlanningFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskflowFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskFactoryAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerPlanningFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskflowFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskFactoryAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");

%}

Expand Down

0 comments on commit 475e99b

Please sign in to comment.