Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize gz vendor use and modernize CMake #232

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions irobot_create_common/irobot_create_toolbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,46 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

find_package(ament_cmake REQUIRED)
find_package(gz-math7 REQUIRED)
find_package(gz_math_vendor REQUIRED)
find_package(gz-math REQUIRED)
find_package(rclcpp REQUIRED)

#### Libraries

set(dependencies
gz-math7
rclcpp
)

add_library(irobot_create_toolbox SHARED)
target_sources(
irobot_create_toolbox
PRIVATE
src/polar_coordinates.cpp
)
target_include_directories(irobot_create_toolbox PUBLIC include)
ament_target_dependencies(irobot_create_toolbox
${dependencies}
target_include_directories(irobot_create_toolbox PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")

target_link_libraries(irobot_create_toolbox
PUBLIC
gz-math::gz-math
${rclcpp_TARGETS}
)

#### Install

install(TARGETS irobot_create_toolbox
install(TARGETS
${PROJECT_NAME} EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(DIRECTORY include/
DESTINATION include
DESTINATION include/${PROJECT_NAME}
)
ament_export_targets(export_${PROJECT_NAME})
ament_export_dependencies(
gz_math_vendor
gz-math
rclcpp
)

ament_export_include_directories(include)
ament_export_libraries(irobot_create_toolbox)
ament_export_dependencies(${dependencies})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion irobot_create_gz/irobot_create_gz_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ find_package(ament_cmake REQUIRED)
set(OpenGL_GL_PREFERENCE LEGACY)

# Find the Ignition gui library
find_package(gz-gui8 REQUIRED)
find_package(gz_gui_vendor REQUIRED)
add_subdirectory(Create3Hmi)

if(BUILD_TESTING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ endif()

set(CMAKE_AUTOMOC ON)

# Find Qt5
find_package(gz_gui_vendor REQUIRED)
find_package(gz-gui REQUIRED)
find_package(Qt5
COMPONENTS
Core
Expand All @@ -15,8 +16,6 @@ find_package(Qt5
REQUIRED
)

find_package(gz-gui8 REQUIRED)

qt5_add_resources(resources_rcc Create3Hmi.qrc)

add_library(
Expand All @@ -32,16 +31,17 @@ include_directories(
${Qt5Quick_INCLUDE_DIRS}
${Qt5QuickControls2_INCLUDE_DIRS}
)
target_link_libraries(
Create3Hmi
target_link_libraries(Create3Hmi
PUBLIC
gz-gui::gz-gui
${Qt5Core_LIBRARIES}
${Qt5Qml_LIBRARIES}
${Qt5Quick_LIBRARIES}
${Qt5QuickControls2_LIBRARIES}
)
ament_target_dependencies(
Create3Hmi
gz-gui8
ament_target_dependencies(Create3Hmi
gz_gui_vendor
gz-gui
)

install(
Expand Down
Loading