Skip to content

Commit 475e99b

Browse files
committed
Fix library anchors on Windows
1 parent 3f2f818 commit 475e99b

File tree

4 files changed

+55
-17
lines changed

4 files changed

+55
-17
lines changed

tesseract_python/CMakeLists.txt

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,55 @@ include(FindSWIG)
130130
find_package(SWIG 4.1.1 REQUIRED)
131131
include(UseSWIG)
132132

133+
macro(tesseract_python_find_target lib_name search_target)
134+
# Find install directory of search_target
135+
136+
get_target_property(search_target_location ${search_target} LOCATION)
137+
if (NOT WIN32)
138+
get_filename_component(search_target_location_dir ${search_target_location} DIRECTORY)
139+
else()
140+
get_filename_component(search_target_location_dir1 ${search_target_location} DIRECTORY)
141+
get_filename_component(search_target_location_dir2 ${search_target_location_dir1} DIRECTORY)
142+
set(search_target_location_dir "${search_target_location_dir2}/lib")
143+
endif()
144+
# Find library lib_name
145+
unset(lib_name_location)
146+
find_library(lib_name_location ${lib_name} HINTS ${search_target_location_dir} NO_CACHE)
147+
if (NOT lib_name_location)
148+
message(FATAL_ERROR "Could not find library ${lib_name}")
149+
endif()
150+
# Create import target
151+
add_library(tesseract::${lib_name} SHARED IMPORTED)
152+
if (WIN32)
153+
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_IMPLIB_RELWITHDEBINFO ${lib_name_location})
154+
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_IMPLIB ${lib_name_location})
155+
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_LOCATION ${lib_name_location})
156+
else()
157+
set_target_properties(tesseract::${lib_name} PROPERTIES IMPORTED_LOCATION ${lib_name_location})
158+
endif()
159+
endmacro()
160+
161+
tesseract_python_find_target(tesseract_collision_fcl_factories tesseract::tesseract_collision_core)
162+
tesseract_python_find_target(tesseract_collision_bullet_factories tesseract::tesseract_collision_core)
163+
tesseract_python_find_target(tesseract_kinematics_kdl_factories tesseract::tesseract_kinematics_core)
164+
tesseract_python_find_target(tesseract_kinematics_ur_factory tesseract::tesseract_kinematics_core)
165+
tesseract_python_find_target(tesseract_kinematics_opw_factory tesseract::tesseract_kinematics_core)
166+
#tesseract_python_find_target(tesseract_kinematics_core_factories tesseract::tesseract_kinematics_core)
167+
tesseract_python_find_target(tesseract_task_composer_factories tesseract::tesseract_task_composer)
168+
tesseract_python_find_target(tesseract_task_composer_planning_factories tesseract::tesseract_task_composer)
169+
# tesseract_python_find_target(tesseract_task_composer_planning_nodes tesseract::tesseract_task_composer)
170+
tesseract_python_find_target(tesseract_task_composer_taskflow_factories tesseract::tesseract_task_composer)
171+
133172
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tesseract_python_module.cmake)
134173

135174
tesseract_python_module(tesseract_common_python SWIG_SRCS swig/tesseract_common_python.i PACKAGE tesseract_common LIBS tesseract::tesseract_common )
136175
tesseract_python_module(tesseract_geometry_python SWIG_SRCS swig/tesseract_geometry_python.i PACKAGE tesseract_geometry LIBS tesseract::tesseract_geometry )
137-
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 )
176+
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 )
138177
tesseract_python_module(tesseract_scene_graph_python SWIG_SRCS swig/tesseract_scene_graph_python.i PACKAGE tesseract_scene_graph LIBS tesseract::tesseract_scene_graph )
139178
tesseract_python_module(tesseract_srdf_python SWIG_SRCS swig/tesseract_srdf_python.i PACKAGE tesseract_srdf LIBS tesseract::tesseract_srdf )
140179
tesseract_python_module(tesseract_urdf_python SWIG_SRCS swig/tesseract_urdf_python.i PACKAGE tesseract_urdf LIBS tesseract::tesseract_urdf )
141180
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)
142-
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 )
181+
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 )
143182
tesseract_python_module(tesseract_environment_python SWIG_SRCS swig/tesseract_environment_python.i PACKAGE tesseract_environment LIBS tesseract::tesseract_environment )
144183
tesseract_python_module(tesseract_visualization_python SWIG_SRCS swig/tesseract_visualization_python.i PACKAGE tesseract_visualization LIBS tesseract::tesseract_visualization)
145184
tesseract_python_module(tesseract_command_language_python SWIG_SRCS swig/tesseract_command_language_python.i PACKAGE tesseract_command_language LIBS tesseract::tesseract_command_language)
@@ -149,7 +188,7 @@ tesseract_python_module(tesseract_motion_planners_trajopt_python SWIG_SRCS swig/
149188
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 )
150189
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 )
151190
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)
152-
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 )
191+
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 )
153192

154193
set(TESSERACT_PYTHON_MODULE_TARGETS
155194
_tesseract_common_python

tesseract_python/swig/tesseract_collision_python.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ class ContactResult;
102102

103103
%init %{
104104
// TODO: fix anchors
105-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_bullet::BulletFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
106-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_fcl::FCLFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
105+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_bullet::BulletFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
106+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_collision::tesseract_collision_fcl::FCLFactoriesAnchor(), "TESSERACT_CONTACT_MANAGERS_PLUGINS");
107107
%}

tesseract_python/swig/tesseract_kinematics_python.i

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ struct KinGroupIKInput;
132132

133133
%init %{
134134
// TODO: fix anchors
135-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::REPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
136-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::ROPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
137-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::KDLFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
138-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::OPWFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
139-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::URFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
135+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::REPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
136+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::ROPInvKinFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
137+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::KDLFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
138+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::OPWFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
139+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_kinematics::URFactoriesAnchor(), "TESSERACT_KINEMATICS_PLUGINS");
140140

141141

142142

tesseract_python/swig/tesseract_task_composer_python.i

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,9 @@ enum class future_status {
299299
%arg(env, profiles, name));*/
300300

301301
// contact_check_profile
302-
// TODO: Fix library linking
303-
// %shared_ptr(tesseract_planning::ContactCheckProfile)
304-
// %include "tesseract_task_composer/planning/profiles/contact_check_profile.h"
305-
// %tesseract_command_language_add_profile_type(ContactCheckProfile);
302+
%shared_ptr(tesseract_planning::ContactCheckProfile)
303+
%include "tesseract_task_composer/planning/profiles/contact_check_profile.h"
304+
%tesseract_command_language_add_profile_type(ContactCheckProfile);
306305

307306
// fix_state_bounds_profile
308307
%shared_ptr(tesseract_planning::FixStateBoundsProfile)
@@ -348,9 +347,9 @@ enum class future_status {
348347

349348
%init %{
350349
// TODO: fix anchors
351-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerPlanningFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
352-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskflowFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
353-
// tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskFactoryAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
350+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerPlanningFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
351+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskflowFactoriesAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
352+
tesseract_common::PluginLoader::addSymbolLibraryToSearchLibrariesEnv(tesseract_planning::TaskComposerTaskFactoryAnchor(), "TESSERACT_TASK_COMPOSER_PLUGINS");
354353

355354
%}
356355

0 commit comments

Comments
 (0)