|
| 1 | +# Copyright (c) 2025-present WATonomous. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +cmake_minimum_required(VERSION 3.22) |
| 15 | +project(deep_conversions) |
| 16 | + |
| 17 | +if(NOT CMAKE_CXX_STANDARD) |
| 18 | + set(CMAKE_CXX_STANDARD 17) |
| 19 | +endif() |
| 20 | + |
| 21 | +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 22 | + add_compile_options(-Wall -Wextra -Wpedantic) |
| 23 | + add_link_options(-Wl,-no-undefined) |
| 24 | +endif() |
| 25 | + |
| 26 | +find_package(ament_cmake REQUIRED) |
| 27 | +find_package(rclcpp REQUIRED) |
| 28 | +find_package(sensor_msgs REQUIRED) |
| 29 | +find_package(std_msgs REQUIRED) |
| 30 | +find_package(pluginlib REQUIRED) |
| 31 | +find_package(deep_core REQUIRED) |
| 32 | + |
| 33 | +set(include_dir ${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 34 | + |
| 35 | +# deep_conversions library |
| 36 | +set(DEEP_CONVERSIONS_LIB ${PROJECT_NAME}_lib) |
| 37 | +add_library(${DEEP_CONVERSIONS_LIB} SHARED |
| 38 | + src/ros_conversions.cpp |
| 39 | +) |
| 40 | + |
| 41 | +target_include_directories(${DEEP_CONVERSIONS_LIB} PUBLIC |
| 42 | + $<BUILD_INTERFACE:${include_dir}> |
| 43 | + $<INSTALL_INTERFACE:include> |
| 44 | +) |
| 45 | + |
| 46 | +target_link_libraries(${DEEP_CONVERSIONS_LIB} |
| 47 | + PUBLIC |
| 48 | + rclcpp::rclcpp |
| 49 | + deep_core::deep_core_lib |
| 50 | + ${sensor_msgs_TARGETS} |
| 51 | + ${std_msgs_TARGETS} |
| 52 | +) |
| 53 | + |
| 54 | +install(TARGETS |
| 55 | + ${DEEP_CONVERSIONS_LIB} |
| 56 | + EXPORT ${PROJECT_NAME}Targets |
| 57 | + ARCHIVE DESTINATION lib |
| 58 | + LIBRARY DESTINATION lib |
| 59 | + RUNTIME DESTINATION bin |
| 60 | +) |
| 61 | + |
| 62 | +install(EXPORT ${PROJECT_NAME}Targets |
| 63 | + NAMESPACE ${PROJECT_NAME}:: |
| 64 | + DESTINATION share/${PROJECT_NAME}/cmake |
| 65 | +) |
| 66 | + |
| 67 | +install(DIRECTORY include/ |
| 68 | + DESTINATION include |
| 69 | +) |
| 70 | + |
| 71 | +if(BUILD_TESTING) |
| 72 | + find_package(deep_test REQUIRED) |
| 73 | + |
| 74 | + add_deep_test(test_conversions test/test_conversions.cpp |
| 75 | + LIBRARIES ${DEEP_CONVERSIONS_LIB} |
| 76 | + ) |
| 77 | +endif() |
| 78 | + |
| 79 | +ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET) |
| 80 | +ament_package() |
0 commit comments