Skip to content

Commit

Permalink
Fix overriding of install
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
  • Loading branch information
tylerjw committed Jan 25, 2023
1 parent 01a2cda commit 8dc3417
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 72 deletions.
1 change: 0 additions & 1 deletion kinematics_interface/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ Changelog for package kinematics_interface
* updated README and cleaned up code
* added KDL plugin for kinematics interface
* Contributors: Paul Gesel, Andy Zelenak, Bence Magyar, Denis Štogl

57 changes: 30 additions & 27 deletions kinematics_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
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()
86 changes: 42 additions & 44 deletions kinematics_interface_kdl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,72 +1,70 @@
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_assets'
# 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()

0 comments on commit 8dc3417

Please sign in to comment.