diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d7424fd --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,19 @@ +# +# continuous integration workflow +# +name: build repo + +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + branches: [master] + +jobs: + build_ros2: + uses: ros-misc-utilities/ros_build_scripts/.github/workflows/ros2_recent_ci.yml@master + with: + repo: ${{ github.event.repository.name }} + # vcs_url: https://raw.githubusercontent.com/${{ github.repository }}/master/${{ github.event.repository.name }}.repos diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f4fc73..abb2476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,47 +1,59 @@ -cmake_minimum_required(VERSION 3.5) -project(apriltag_mit) +# +# Copyright 2024 Bernd Pfrommer +# -set(USE_ROS TRUE) -set(CMAKE_CXX_STANDARD 11) +cmake_minimum_required(VERSION 3.16) + +project(apriltag_mit VERSION 1.0.0 LANGUAGES CXX) + +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) + +set(CMAKE_CXX_CLANG_TIDY clang-tidy) find_package(Eigen3 REQUIRED) -find_package(OpenCV REQUIRED) -include_directories(include ${OpenCV_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR}) - -if(USE_ROS) - find_package(catkin REQUIRED COMPONENTS roslib) - catkin_package(DEPENDS - OpenCV - EIGEN3 - INCLUDE_DIRS - include - LIBRARIES - ${PROJECT_NAME}) - - include_directories(${catkin_INCLUDE_DIRS}) - file(GLOB CC_FILES ${PROJECT_SOURCE_DIR}/src/*.cc) - add_library(${PROJECT_NAME} SHARED ${CC_FILES}) - target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) - - if(CATKIN_ENABLE_TESTING) - catkin_add_gtest(test_apriltag_mit test/test_apriltag_mit.cpp) - target_link_libraries(test_apriltag_mit ${catkin_LIBRARIES} ${PROJECT_NAME}) - endif() - - install(TARGETS ${PROJECT_NAME} - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) - install(DIRECTORY include/${PROJECT_NAME}/ - DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) -else() - message(STATUS "Source: " ${PROJECT_SOURCE_DIR}) - message(STATUS "Binary: " ${PROJECT_BINARY_DIR}) - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) - set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) - link_directories(${PROJECT_SOURCE_DIR}/lib) - - file(GLOB CC_FILES ${PROJECT_SOURCE_DIR}/src/*.cc) - add_library(${PROJECT_NAME} SHARED ${CC_FILES}) - target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) -endif() +find_package(OpenCV REQUIRED core calib3d) + +file(GLOB CC_FILES ${PROJECT_SOURCE_DIR}/src/*.cc) +add_library(${PROJECT_NAME} SHARED ${CC_FILES}) +target_link_libraries(${PROJECT_NAME} PUBLIC opencv_core opencv_calib3d Eigen3::Eigen) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) + +target_include_directories( + ${PROJECT_NAME} + PUBLIC + $ + $ +) + +install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION include + ) + + install(DIRECTORY include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +# generate the ConfigVersion.cmake file that will be included by Config.cmake +write_basic_package_version_file( + ${PROJECT_NAME}ConfigVersion.cmake + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion + ) + +# generate the *Config.cmake file +configure_file(cmake/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY) + +# generate Targets.cmake file from exports learned during the installation +install(EXPORT ${PROJECT_NAME}Targets + FILE ${PROJECT_NAME}Targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + ) + +# install the generated version and config files +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + ) diff --git a/cmake/apriltag_mitConfig.cmake.in b/cmake/apriltag_mitConfig.cmake.in new file mode 100644 index 0000000..1b6b62b --- /dev/null +++ b/cmake/apriltag_mitConfig.cmake.in @@ -0,0 +1,7 @@ +include(CMakeFindDependencyMacro) + +find_package(Eigen3 REQUIRED) +find_package(OpenCV REQUIRED core) + +# Add the targets file +include("${CMAKE_CURRENT_LIST_DIR}/apriltag_mitTargets.cmake") \ No newline at end of file diff --git a/package.xml b/package.xml index 867bfcd..fa02dbc 100644 --- a/package.xml +++ b/package.xml @@ -1,13 +1,17 @@ - + + apriltag_mit - 0.3.0 - A C++ Apriltag library + 1.0.0 + ROS2 package wrapper for the MIT apriltag detector Michael Kaess - Chao Qu - GPLv3 + Bernd Pfrommer + GPLv2 + + opencv + eigen + + + cmake + - catkin - roslib - gtest - rosunit