-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
- Loading branch information
Showing
3 changed files
with
72 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(kinematics_interface) | ||
cmake_minimum_required(VERSION 3.16) | ||
project(kinematics_interface LANGUAGES CXX) | ||
|
||
if(NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 14) | ||
endif() | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() | ||
|
||
set(THIS_PACKAGE_INCLUDE_DEPENDS | ||
Eigen3 | ||
rclcpp | ||
rclcpp_lifecycle | ||
) | ||
|
||
# find dependencies | ||
find_package(ament_cmake REQUIRED) | ||
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) | ||
find_package(${Dependency} REQUIRED) | ||
endforeach() | ||
find_package(Eigen3 REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(rclcpp_lifecycle REQUIRED) | ||
|
||
# Create interface library for kinematics base class | ||
add_library(kinematics_interface INTERFACE) | ||
target_include_directories(kinematics_interface INTERFACE include) | ||
ament_target_dependencies(kinematics_interface INTERFACE ${THIS_PACKAGE_INCLUDE_DEPENDS}) | ||
target_compile_features(kinematics_interface INTERFACE cxx_std_17) | ||
target_include_directories(kinematics_interface INTERFACE | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include/kinematics_interface> | ||
) | ||
target_link_libraries(kinematics_interface INTERFACE | ||
Eigen3::Eigen | ||
rclcpp::rclcpp | ||
rclcpp_lifecycle::rclcpp_lifecycle | ||
) | ||
|
||
# Causes the visibility macros to use dllexport rather than dllimport, | ||
# which is appropriate when building the dll but not consuming it. | ||
target_compile_definitions(kinematics_interface INTERFACE "KINEMATICS_INTERFACE_BUILDING_DLL") | ||
|
||
install(DIRECTORY include/ | ||
DESTINATION include | ||
install( | ||
DIRECTORY include/ | ||
DESTINATION include/kinematics_interface | ||
) | ||
|
||
ament_export_dependencies( | ||
${THIS_PACKAGE_INCLUDE_DEPENDS} | ||
install( | ||
TARGETS kinematics_interface | ||
EXPORT export_kinematics_interface | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
) | ||
|
||
ament_export_include_directories( | ||
include | ||
ament_export_targets(export_kinematics_interface HAS_LIBRARY_TARGET) | ||
ament_export_dependencies( | ||
Eigen3 | ||
rclcpp | ||
rclcpp_lifecycle | ||
) | ||
|
||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,69 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(kinematics_interface_kdl) | ||
cmake_minimum_required(VERSION 3.16) | ||
project(kinematics_interface_kdl LANGUAGES CXX) | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() | ||
|
||
set(THIS_PACKAGE_INCLUDE_DEPENDS | ||
Eigen3 | ||
kdl_parser | ||
kinematics_interface | ||
pluginlib | ||
tf2_eigen_kdl | ||
) | ||
|
||
# find dependencies | ||
find_package(ament_cmake REQUIRED) | ||
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) | ||
find_package(${Dependency} REQUIRED) | ||
endforeach() | ||
|
||
find_package(Eigen3 REQUIRED) | ||
find_package(kdl_parser REQUIRED) | ||
find_package(kinematics_interface REQUIRED) | ||
find_package(pluginlib REQUIRED) | ||
find_package(tf2_eigen_kdl REQUIRED) | ||
|
||
add_library( | ||
${PROJECT_NAME} | ||
kinematics_interface_kdl | ||
SHARED | ||
src/kinematics_interface_kdl.cpp | ||
) | ||
target_include_directories(${PROJECT_NAME} PRIVATE include) | ||
ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_INCLUDE_DEPENDS}) | ||
|
||
pluginlib_export_plugin_description_file(kinematics_interface kinematics_interface_kdl.xml) | ||
|
||
install( | ||
TARGETS ${PROJECT_NAME} | ||
RUNTIME DESTINATION bin | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
target_include_directories(kinematics_interface_kdl PUBLIC | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include/kinematics_interface_kdl> | ||
) | ||
|
||
install( | ||
DIRECTORY include/ | ||
DESTINATION include | ||
target_compile_features(kinematics_interface_kdl PUBLIC cxx_std_17) | ||
target_link_libraries(kinematics_interface_kdl PUBLIC | ||
Eigen3::Eigen | ||
kdl_parser::kdl_parser | ||
kinematics_interface::kinematics_interface | ||
pluginlib::pluginlib | ||
tf2_eigen_kdl::tf2_eigen_kdl | ||
) | ||
|
||
pluginlib_export_plugin_description_file(kinematics_interface kinematics_interface_kdl.xml) | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_cmake_gmock REQUIRED) | ||
find_package(ros2_control_test_assets REQUIRED) | ||
|
||
ament_add_gmock( | ||
test_${PROJECT_NAME} | ||
test_kinematics_interface_kdl | ||
test/test_kinematics_interface_kdl.cpp | ||
) | ||
target_include_directories(test_${PROJECT_NAME} PRIVATE include) | ||
target_link_libraries(test_${PROJECT_NAME} ${PROJECT_NAME}) | ||
ament_target_dependencies(test_${PROJECT_NAME} | ||
${THIS_PACKAGE_INCLUDE_DEPENDS} | ||
ros2_control_test_assets | ||
) | ||
target_link_libraries(test_kinematics_interface_kdl kinematics_interface_kdl) | ||
|
||
# TODO: Use target_link_libraries once ros2_control_test_assests | ||
# CMake include export is fixed | ||
ament_target_dependencies(test_kinematics_interface_kdl ros2_control_test_assets) | ||
endif() | ||
|
||
ament_export_libraries( | ||
${PROJECT_NAME} | ||
install( | ||
DIRECTORY include/ | ||
DESTINATION include/kinematics_interface_kdl | ||
) | ||
ament_export_include_directories( | ||
include | ||
install( | ||
TARGETS kinematics_interface_kdl | ||
EXPORT export_kinematics_interface_kdl | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
) | ||
|
||
ament_export_targets(export_kinematics_interface_kdl HAS_LIBRARY_TARGET) | ||
ament_export_dependencies( | ||
${THIS_PACKAGE_INCLUDE_DEPENDS} | ||
Eigen3 | ||
kdl_parser | ||
kinematics_interface | ||
pluginlib | ||
tf2_eigen_kdl | ||
) | ||
|
||
ament_package() |