Skip to content

Commit

Permalink
Update to use RICB (#109)
Browse files Browse the repository at this point in the history
* Updated to use RICB

* Updated CI

* Dropped Bionic build
  • Loading branch information
marip8 authored Feb 14, 2024
1 parent b50693e commit c6e67f8
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 171 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ name: CI
on: [push, pull_request]

jobs:
industrial_ci:
ci:
strategy:
fail-fast: false
matrix:
distro: [melodic, noetic]
distro: [noetic]

runs-on: ubuntu-latest
name: ${{ matrix.distro }}
steps:
- uses: actions/checkout@v1
- uses: 'ros-industrial/industrial_ci@master'
- name: Checkout
uses: actions/checkout@v1
- name: Build
uses: 'ros-industrial/industrial_ci@master'
env:
BADGE: ${{ matrix.distro }}
ROS_DISTRO: ${{ matrix.distro }}
ROS_REPO: main
UPSTREAM_WORKSPACE: dependencies.repos
VERBOSE_TESTS: true
ADDITIONAL_DEBS: "git"
TARGET_CMAKE_ARGS: "-DRCT_BUILD_TESTS=ON"
TARGET_CMAKE_ARGS: "-DRCT_BUILD_TESTS=ON -DRCT_ENABLE_RUN_TESTS=OFF"
CTEST_OUTPUT_ON_FAILURE: true
AFTER_SCRIPT: "cd $target_ws/build/rct_optimizations && ctest -V && cd $target_ws/build/rct_image_tools && ctest -V"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Platform | CI Status
---------------------- |:---------
Linux (Focal & Bionic) | [![Build Status](https://github.com/Jmeyer1292/robot_cal_tools/workflows/CI/badge.svg)](https://github.com/Jmeyer1292/robot_cal_tools/actions)
Ubuntu (Focal) | [![Build Status](https://github.com/Jmeyer1292/robot_cal_tools/workflows/CI/badge.svg)](https://github.com/Jmeyer1292/robot_cal_tools/actions)
Lint (Clang-Format) | [![Build Status](https://github.com/Jmeyer1292/robot_cal_tools/workflows/Clang-Format/badge.svg)](https://github.com/Jmeyer1292/robot_cal_tools/actions)
Lint (CMake-Format) | [![Build Status](https://github.com/Jmeyer1292/robot_cal_tools/workflows/CMake-Format/badge.svg)](https://github.com/Jmeyer1292/robot_cal_tools/actions)

Expand Down
5 changes: 5 additions & 0 deletions dependencies.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositories:
ros_industrial_cmake_boilerplate:
type: git
url: https://github.com/ros-industrial/ros_industrial_cmake_boilerplate.git
version: 0.5.4
51 changes: 6 additions & 45 deletions rct_common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.5.0)
project(rct_common VERSION 0.1.0)

include(cmake/rct_macros.cmake)
# Extract package name and version from package.xml
find_package(ros_industrial_cmake_boilerplate REQUIRED)
extract_package_metadata(pkg)
project(${pkg_extracted_name} VERSION ${pkg_extracted_version} LANGUAGES CXX)

find_package(Eigen3 REQUIRED)
if(NOT EIGEN3_INCLUDE_DIRS)
Expand All @@ -14,55 +16,14 @@ if(NOT TARGET Eigen3::Eigen)
set_property(TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIRS})
endif()

if(RCT_BUILD_TESTS)
find_package(GTest QUIET)
if(NOT GTest_FOUND)

include(ExternalProject)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(GTEST_CXX_FLAGS "-w -std=c++14")
set(GTEST_C_FLAGS "-w")

ExternalProject_Add(
GTest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
SOURCE_DIR ${CMAKE_BINARY_DIR}/../rct_common/googletest-src
BINARY_DIR ${CMAKE_BINARY_DIR}/../rct_common/googletest-build
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_CXX_FLAGS:STRING=${GTEST_CXX_FLAGS}
-DCMAKE_C_FLAGS:STRING=${GTEST_C_FLAGS}
-DBUILD_GMOCK:BOOL=OFF
-DBUILD_GTEST:BOOL=ON
-DBUILD_SHARED_LIBS:BOOL=ON)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
ExternalProject_Add(
GTest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
SOURCE_DIR ${CMAKE_BINARY_DIR}/../rct_common/googletest-src
BINARY_DIR ${CMAKE_BINARY_DIR}/../rct_common/googletest-build
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_GMOCK:BOOL=OFF
-DBUILD_GTEST:BOOL=ON
-DBUILD_SHARED_LIBS:BOOL=ON)
endif()
endif()
endif()
find_gtest()

add_library(${PROJECT_NAME} INTERFACE)
target_compile_options(${PROJECT_NAME} INTERFACE -std=c++11)
target_include_directories(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
target_link_libraries(${PROJECT_NAME} INTERFACE Eigen3::Eigen)

rct_configure_package(${PROJECT_NAME})
configure_package(TARGETS ${PROJECT_NAME} NAMESPACE rct DEPENDENCIES Eigen3)

install(DIRECTORY include/${PROJECT_NAME} DESTINATION include)

install(FILES "${CMAKE_CURRENT_LIST_DIR}/cmake/rct_macros.cmake" DESTINATION lib/cmake/${PROJECT_NAME})
11 changes: 0 additions & 11 deletions rct_common/cmake/rct_common-config.cmake.in

This file was deleted.

52 changes: 0 additions & 52 deletions rct_common/cmake/rct_macros.cmake

This file was deleted.

6 changes: 5 additions & 1 deletion rct_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.5.0)
project(rct_examples)

# Extract package name and version from package.xml
find_package(ros_industrial_cmake_boilerplate REQUIRED)
extract_package_metadata(pkg)
project(${pkg_extracted_name} VERSION ${pkg_extracted_version} LANGUAGES CXX)

add_compile_options(-std=c++11 -Wall -Wextra)

Expand Down
25 changes: 18 additions & 7 deletions rct_image_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
cmake_minimum_required(VERSION 3.5.0)
project(rct_image_tools VERSION 0.1.0 LANGUAGES CXX)

find_package(Boost REQUIRED)
# Extract package name and version from package.xml
find_package(ros_industrial_cmake_boilerplate REQUIRED)
extract_package_metadata(pkg)
project(${pkg_extracted_name} VERSION ${pkg_extracted_version} LANGUAGES CXX)

find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(OpenCV REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(rct_common REQUIRED)
find_package(rct_optimizations REQUIRED)

find_package(Eigen3 REQUIRED)
Expand All @@ -31,10 +34,10 @@ target_compile_options(${PROJECT_NAME} PUBLIC -std=c++11)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
target_link_libraries(
${PROJECT_NAME}
PUBLIC ${Boost_LIBRARIES}
PUBLIC Boost::boost
Boost::filesystem
opencv_core
opencv_aruco
opencv_features2d
Expand All @@ -54,10 +57,18 @@ target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME} rct::rct_optimization

if(RCT_BUILD_TESTS)
enable_testing()
rct_add_run_tests_target()
add_run_tests_target(ENABLE ${RCT_ENABLE_RUN_TESTS})
add_subdirectory(test)
endif()

rct_configure_package(${PROJECT_NAME})
configure_package(
NAMESPACE rct
TARGETS ${PROJECT_NAME}
${PROJECT_NAME}_test
DEPENDENCIES
"Boost REQUIRED COMPONENTS filesystem"
OpenCV
rct_optimizations
yaml-cpp)

install(DIRECTORY include/${PROJECT_NAME} DESTINATION include)
15 changes: 0 additions & 15 deletions rct_image_tools/cmake/rct_image_tools-config.cmake.in

This file was deleted.

1 change: 1 addition & 0 deletions rct_image_tools/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<depend>yaml-cpp</depend>
<depend>libopencv-dev</depend>
<depend>eigen</depend>

<export>
<build_type>cmake</build_type>
</export>
Expand Down
2 changes: 1 addition & 1 deletion rct_image_tools/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ find_package(GTest REQUIRED)

add_executable(${PROJECT_NAME}_target_finder_test target_finder_utest.cpp)
target_link_libraries(${PROJECT_NAME}_target_finder_test PRIVATE ${PROJECT_NAME} GTest::GTest GTest::Main)
rct_gtest_discover_tests(${PROJECT_NAME}_target_finder_test)
add_gtest_discover_tests(${PROJECT_NAME}_target_finder_test)
add_dependencies(${PROJECT_NAME}_target_finder_test ${PROJECT_NAME})
add_dependencies(run_tests ${PROJECT_NAME}_target_finder_test)
target_compile_definitions(${PROJECT_NAME}_target_finder_test
Expand Down
26 changes: 21 additions & 5 deletions rct_optimizations/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.5.0)
project(rct_optimizations VERSION 0.1.0 LANGUAGES CXX)

# Extract package name and version from package.xml
find_package(ros_industrial_cmake_boilerplate REQUIRED)
extract_package_metadata(pkg)
project(${pkg_extracted_name} VERSION ${pkg_extracted_version} LANGUAGES CXX)

find_package(rct_common REQUIRED)
find_package(Boost REQUIRED)
Expand Down Expand Up @@ -38,15 +42,27 @@ target_compile_options(${PROJECT_NAME} PUBLIC -std=c++11)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${Boost_INCLUDE_DIRS} ${CERES_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES} ${CERES_LIBRARIES} yaml-cpp)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${CERES_INCLUDE_DIRS})
target_link_libraries(
${PROJECT_NAME}
PUBLIC ${CERES_LIBRARIES}
rct::rct_common
Boost::boost
yaml-cpp)

if(RCT_BUILD_TESTS)
enable_testing()
rct_add_run_tests_target()
add_run_tests_target(ENABLE ${RCT_ENABLE_RUN_TESTS})
add_subdirectory(test)
endif()

rct_configure_package(${PROJECT_NAME})
configure_package(
NAMESPACE rct
TARGETS ${PROJECT_NAME}
DEPENDENCIES
Boost
rct_common
yaml-cpp
Ceres)

install(DIRECTORY include/${PROJECT_NAME} DESTINATION include)
13 changes: 0 additions & 13 deletions rct_optimizations/cmake/rct_optimizations-config.cmake.in

This file was deleted.

Loading

0 comments on commit c6e67f8

Please sign in to comment.