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

feat(cmake): make colcon build fast again #146

Merged
merged 6 commits into from
Jun 7, 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
40 changes: 25 additions & 15 deletions nebula_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ cmake_minimum_required(VERSION 3.14)
project(nebula_common)

find_package(ament_cmake_auto REQUIRED)
find_package(PCL REQUIRED)
find_package(PCL REQUIRED COMPONENTS common)
find_package(pcl_conversions REQUIRED)
find_package(yaml-cpp REQUIRED)

ament_auto_find_build_dependencies()

# Default to C++17
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -28,21 +24,35 @@ if(BUILD_TESTING)
endif()

include_directories(
include
SYSTEM
${YAML_CPP_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${PCL_COMMON_INCLUDE_DIRS}
include
SYSTEM
${YAML_CPP_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)

link_libraries(
${PCL_LIBRARIES}
${YAML_CPP_LIBRARIES}
)

add_library(nebula_common SHARED
src/nebula_common.cpp
src/velodyne/velodyne_calibration_decoder.cpp
)

ament_auto_add_library(nebula_common SHARED
src/nebula_common.cpp
src/velodyne/velodyne_calibration_decoder.cpp
)
install(TARGETS nebula_common EXPORT export_nebula_common)
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})

ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_targets(export_nebula_common)

ament_export_dependencies(
PCL
yaml-cpp
)

target_link_libraries(nebula_common yaml-cpp)
ament_package()

ament_auto_package()

# Set ROS_DISTRO macros
set(ROS_DISTRO $ENV{ROS_DISTRO})
Expand Down
1 change: 0 additions & 1 deletion nebula_common/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<buildtool_depend>ros_environment</buildtool_depend>

<depend>libpcl-all-dev</depend>
<depend>pcl_conversions</depend>
<depend>yaml-cpp</depend>

<test_depend>ament_cmake_gtest</test_depend>
Expand Down
159 changes: 124 additions & 35 deletions nebula_decoders/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
cmake_minimum_required(VERSION 3.14)
project(nebula_decoders)

find_package(ament_cmake_auto REQUIRED)

ament_auto_find_build_dependencies()

# Default to C++17
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -14,58 +10,151 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wunused-function)
endif ()


find_package(ament_cmake_auto REQUIRED)
find_package(PCL REQUIRED COMPONENTS common)
find_package(angles REQUIRED)
find_package(PCL REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(continental_msgs REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(nebula_common REQUIRED)
find_package(nebula_msgs REQUIRED)
find_package(pandar_msgs REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(rclcpp REQUIRED)
find_package(robosense_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(velodyne_msgs REQUIRED)
find_package(yaml-cpp REQUIRED)

include_directories(
include
SYSTEM
${YAML_CPP_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${PCL_COMMON_INCLUDE_DIRS}
include_directories(PUBLIC
include
SYSTEM
${nebula_common_INCLUDE_DIRS}
${YAML_CPP_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${pcl_conversions_INCLUDE_DIRS}
${rclcpp_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
)

link_libraries(
${nebula_common_TARGETS}
${PCL_LIBRARIES}
${pcl_conversions_LIBRARIES}
${rclcpp_TARGETS}
${sensor_msgs_TARGETS}
)

# Lidar Decoders
# Hesai
ament_auto_add_library(nebula_decoders_hesai SHARED
src/nebula_decoders_hesai/hesai_driver.cpp
)
add_library(nebula_decoders_hesai SHARED
src/nebula_decoders_hesai/hesai_driver.cpp
)
target_link_libraries(nebula_decoders_hesai PUBLIC
${pandar_msgs_TARGETS}
)

target_include_directories(nebula_decoders_hesai PUBLIC
${pandar_msgs_INCLUDE_DIRS}
)

# Velodyne
ament_auto_add_library(nebula_decoders_velodyne SHARED
src/nebula_decoders_velodyne/velodyne_driver.cpp
src/nebula_decoders_velodyne/decoders/vls128_decoder.cpp
src/nebula_decoders_velodyne/decoders/vlp16_decoder.cpp
src/nebula_decoders_velodyne/decoders/vlp32_decoder.cpp
)
add_library(nebula_decoders_velodyne SHARED
src/nebula_decoders_velodyne/velodyne_driver.cpp
src/nebula_decoders_velodyne/decoders/vls128_decoder.cpp
src/nebula_decoders_velodyne/decoders/vlp16_decoder.cpp
src/nebula_decoders_velodyne/decoders/vlp32_decoder.cpp
)
target_link_libraries(nebula_decoders_velodyne PUBLIC
${angles_msgs_TARGETS}
${velodyne_msgs_TARGETS}
)
target_include_directories(nebula_decoders_velodyne PUBLIC
${angles_INCLUDE_DIRS}
${velodyne_msgs_INCLUDE_DIRS}
)

# Robosense
ament_auto_add_library(nebula_decoders_robosense SHARED
src/nebula_decoders_robosense/robosense_driver.cpp
)
add_library(nebula_decoders_robosense SHARED
src/nebula_decoders_robosense/robosense_driver.cpp
)
target_link_libraries(nebula_decoders_robosense PUBLIC
${robosense_msgs_TARGETS}
)
target_include_directories(nebula_decoders_robosense PUBLIC
${robosense_msgs_INCLUDE_DIRS}
)

ament_auto_add_library(nebula_decoders_robosense_info SHARED
src/nebula_decoders_robosense/robosense_info_driver.cpp
)
add_library(nebula_decoders_robosense_info SHARED
src/nebula_decoders_robosense/robosense_info_driver.cpp
)
target_link_libraries(nebula_decoders_robosense_info PUBLIC
${robosense_msgs_TARGETS}
)
target_include_directories(nebula_decoders_robosense_info PUBLIC
${robosense_msgs_INCLUDE_DIRS}
)

# Continental
ament_auto_add_library(nebula_decoders_continental SHARED
src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp
)
add_library(nebula_decoders_continental SHARED
src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp
)
target_link_libraries(nebula_decoders_continental PUBLIC
${continental_msgs_TARGETS}
${diagnostic_msgs_TARGETS}
${boost_udp_driver_TARGETS}
${nebula_common_TARGETS}
${nebula_msgs_TARGETS}
)
target_include_directories(nebula_decoders_continental PUBLIC
${continental_msgs_INCLUDE_DIRS}
${diagnostic_msgs_INCLUDE_DIRS}
${boost_udp_driver_INCLUDE_DIRS}
${nebula_common_INCLUDE_DIRS}
${nebula_msgs_INCLUDE_DIRS}
)

install(TARGETS nebula_decoders_hesai EXPORT export_nebula_decoders_hesai)
install(TARGETS nebula_decoders_velodyne EXPORT export_nebula_decoders_velodyne)
install(TARGETS nebula_decoders_robosense EXPORT export_nebula_decoders_robosense)
install(TARGETS nebula_decoders_robosense_info EXPORT export_nebula_decoders_robosense_info)
install(TARGETS nebula_decoders_continental EXPORT export_nebula_decoders_continental)
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package(
INSTALL_TO_SHARE
calibration
)
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_targets(export_nebula_decoders_hesai)
ament_export_targets(export_nebula_decoders_velodyne)
ament_export_targets(export_nebula_decoders_robosense)
ament_export_targets(export_nebula_decoders_robosense_info)
ament_export_targets(export_nebula_decoders_continental)

install(
DIRECTORY calibration
DESTINATION share/${PROJECT_NAME}
)

ament_export_dependencies(
PCL
pcl_conversions
angles
continental_msgs
diagnostic_msgs
nebula_common
nebula_msgs
pandar_msgs
rclcpp
robosense_msgs
sensor_msgs
velodyne_msgs
yaml-cpp
)

ament_package()

# Set ROS_DISTRO macros
set(ROS_DISTRO $ENV{ROS_DISTRO})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
#include "nebula_decoders/nebula_decoders_robosense/decoders/robosense_info_decoder.hpp"
#include "nebula_decoders/nebula_decoders_robosense/decoders/robosense_info_decoder_base.hpp"

#include "pandar_msgs/msg/pandar_packet.hpp"
#include "pandar_msgs/msg/pandar_scan.hpp"

#include <pcl_conversions/pcl_conversions.h>

#include <iostream>
#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>

namespace nebula
{
Expand Down
2 changes: 1 addition & 1 deletion nebula_decoders/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<depend>nebula_msgs</depend>
<depend>pandar_msgs</depend>
<depend>pcl_conversions</depend>
<depend>radar_msgs</depend>
<depend>rclcpp</depend>
<depend>robosense_msgs</depend>
<depend>sensor_msgs</depend>
<depend>velodyne_msgs</depend>
Expand Down
Loading
Loading