Skip to content

Commit

Permalink
Update RICB and leverage components
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Sep 2, 2023
1 parent 26175ed commit a6b4c01
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 47 deletions.
65 changes: 59 additions & 6 deletions .cmake-format
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,22 @@ with section("parse"):
'configure_package': {
'pargs': {'nargs': 0},
'kwargs': {
'COMPONENT': '?',
'NAMESPACE': '?',
'TARGETS': '*',
'SUPPORTED_COMPONENTS': '*',
'DEPENDENCIES': '*',
'CFG_EXTRAS': '*',
}
},
'configure_component': {
'pargs': {'nargs': 0},
'kwargs': {
'COMPONENT': '?',
'NAMESPACE': '?',
'TARGETS': '*',
'DEPENDENCIES': '*',
'CFG_EXTRAS': '*',
}
},
'add_gtest_discover_tests': {
Expand Down Expand Up @@ -104,18 +118,57 @@ with section("parse"):
'EXCLUDE': '*',
}
},
'tesseract_cpack': {
'cpack': {
'pargs': {'nargs': 0},
'kwargs': {
'VERSION': 1,
'MAINTAINER': 1,
'DESCRIPTION': 1,
'LICENSE_FILE': 1,
'README_FILE': 1,
'VERSION': '?',
'MAINTAINER_NAME': '?',
'MAINTAINER_EMAIL': '?',
'VENDOR': '?',
'DESCRIPTION': '?',
'LICENSE_FILE': '?',
'README_FILE': '?',
'PACKAGE_PREFIX': '?',
'LINUX_DEPENDS': '*',
'WINDOWS_DEPENDS': '*',
}
},
'cpack_component_package': {
'pargs': {'nargs': 0},
'kwargs': {
'VERSION': '?',
'MAINTAINER_NAME': '?',
'MAINTAINER_EMAIL': '?',
'VENDOR': '?',
'DESCRIPTION': '?',
'LICENSE_FILE': '?',
'README_FILE': '?',
'PACKAGE_PREFIX': '?',
'COMPONENT_DEPENDS': '*',
}
},
'cpack_component': {
'pargs': {'nargs': 0},
'kwargs': {
'COMPONENT': '?',
'VERSION': '?',
'DESCRIPTION': '?',
'PACKAGE_PREFIX': '?',
'LINUX_DEPENDS': '*',
'WINDOWS_DEPENDS': '*',
'COMPONENT_DEPENDS': '*',
}
},
'cpack_debian_source_package': {
'pargs': {'nargs': 0},
'kwargs': {
'CHANGLELOG': '?',
'UPLOAD': '?',
'DPUT_HOST': '?',
'DEBIAN_INCREMENT': '?',
'DISTRIBUTIONS': '*',
}
},
}

# Override configurations per-command where available
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_2019.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: vcpkg build
uses: johnwason/vcpkg-action@v4
with:
pkgs: boost-graph eigen3 console-bridge
pkgs: boost-graph eigen3 console-bridge gtest
triplet: x64-windows-release
token: ${{ github.token }}

Expand Down
2 changes: 1 addition & 1 deletion dependencies.rosinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- git:
local-name: ros_industrial_cmake_boilerplate
uri: https://github.com/ros-industrial/ros_industrial_cmake_boilerplate.git
version: 0.2.16
version: 0.5.0
52 changes: 20 additions & 32 deletions descartes_light/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ find_package(ros_industrial_cmake_boilerplate REQUIRED)
extract_package_metadata(pkg)
project(${pkg_extracted_name} VERSION ${pkg_extracted_version} LANGUAGES CXX)

include(cmake/descartes_light_macros.cmake)
include(core/cmake/core-macros.cmake)

descartes_variables()
initialize_code_coverage(ENABLE ${DESCARTES_ENABLE_CODE_COVERAGE})
add_code_coverage_all_targets(ENABLE ${DESCARTES_ENABLE_CODE_COVERAGE})

set(SUPPORTED_COMPONENTS core)
add_subdirectory(core)

option(DESCARTES_BUILD_BGL "Build Boost graph library based components" ON)
if(DESCARTES_BUILD_BGL)
message("Building Boost graph library implementations")
list(APPEND SUPPORTED_COMPONENTS bgl)
add_subdirectory(bgl)
endif()

Expand All @@ -26,38 +28,24 @@ if(DESCARTES_ENABLE_TESTING)
endif()

# Package configuration
install(FILES "${CMAKE_CURRENT_LIST_DIR}/cmake/descartes_light_macros.cmake" DESTINATION lib/cmake/${PROJECT_NAME})
configure_package(NAMESPACE descartes)
configure_package(COMPONENT core SUPPORTED_COMPONENTS ${SUPPORTED_COMPONENTS})

if(DESCARTES_PACKAGE)
set(LINUX_DEPENDS "libconsole-bridge-dev" "libeigen3-dev" "libomp-dev")
set(WINDOWS_DEPENDS
"console_bridge"
"Eigen3"
"boost"
"omp")
if(DESCARTES_BUILD_BGL)
list(APPEND LINUX_DEPENDS "libboost-graph-dev")
list(APPEND WINDOW_DEPENDS "boost_graph")
cpack_component_package(
VERSION ${pkg_extracted_version}
MAINTAINER_NAME ${pkg_extracted_maintainer_name}
MAINTAINER_EMAIL ${pkg_extracted_maintainer_email}
DESCRIPTION ${pkg_extracted_description}
LICENSE_FILE ${CMAKE_CURRENT_LIST_DIR}/../LICENSE.Apache-2.0
README_FILE ${CMAKE_CURRENT_LIST_DIR}/../README.md
COMPONENT_DEPENDS ${SUPPORTED_COMPONENTS})

if(UNIX AND DESCARTES_PACKAGE_SOURCE)
cpack_debian_source_package(
CHANGLELOG ${CMAKE_CURRENT_LIST_DIR}/CHANGELOG.rst
UPLOAD ${DESCARTES_PACKAGE_SOURCE_UPLOAD}
DPUT_HOST ${DESCARTES_PACKAGE_SOURCE_DPUT_HOST}
DEBIAN_INCREMENT ${DESCARTES_PACKAGE_SOURCE_DEBIAN_INCREMENT}
DISTRIBUTIONS ${DESCARTES_PACKAGE_SOURCE_DISTRIBUTIONS})
endif()

cpack(
VERSION
${pkg_extracted_version}
MAINTAINER
<https://github.com/ros-industrial-consortium/tesseract>
VENDOR
"Southwest Research Institute"
DESCRIPTION
${pkg_extracted_description}
LICENSE_FILE
${CMAKE_CURRENT_LIST_DIR}/../LICENSE.Apache-2.0
README_FILE
${CMAKE_CURRENT_LIST_DIR}/../README.md
PACKAGE_PREFIX
${DESCARTES_PACKAGE_PREFIX}
LINUX_DEPENDS
${LINUX_DEPENDS}
WINDOWS_DEPENDS
${WINDOWS_DEPENDS})
endif()
16 changes: 16 additions & 0 deletions descartes_light/bgl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ install(

# Install headers
install(DIRECTORY include/ DESTINATION include/)

configure_component(
COMPONENT bgl
NAMESPACE descartes
TARGETS ${PROJECT_NAME}_bgl
DEPENDENCIES "descartes_light COMPONENTS core" "Boost COMPONENTS graph")

if(DESCARTES_PACKAGE)
cpack_component(
COMPONENT kdl
VERSION ${pkg_extracted_version}
DESCRIPTION "Descrates Light boost graph implementation"
COMPONENT_DEPENDS core
LINUX_DEPENDS "libboost-graph-dev"
WINDOWS_DEPENDS "boost_graph")
endif()
24 changes: 17 additions & 7 deletions descartes_light/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,22 @@ target_code_coverage(
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

# Install headers
install(DIRECTORY include/ DESTINATION include/)

# Package component configuration
configure_component(
COMPONENT core
NAMESPACE descartes
TARGETS ${PROJECT_NAME}
DEPENDENCIES Eigen3 console_bridge OpenMP
CFG_EXTRAS cmake/core-macros.cmake cmake/core-extras.cmake)

if(DESCARTES_PACKAGE)
cpack_component(
COMPONENT core
VERSION ${pkg_extracted_version}
DESCRIPTION "Descartes Light core component"
LINUX_DEPENDS "libconsole-bridge-dev" "libeigen3-dev" "libomp-dev"
WINDOWS_DEPENDS "console_bridge" "Eigen3" "omp")
endif()
28 changes: 28 additions & 0 deletions descartes_light/core/cmake/core-extras.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Create targets if necessary
if(NOT TARGET OpenMP::OpenMP_CXX)
find_package(Threads REQUIRED)
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
# Only works if the same flag is passed to the linker; use CMake 3.9+ otherwise (Intel, AppleClang)
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
endif()

if(NOT TARGET console_bridge::console_bridge)
add_library(console_bridge::console_bridge INTERFACE IMPORTED)
set_target_properties(console_bridge::console_bridge PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
${console_bridge_INCLUDE_DIRS})
set_target_properties(console_bridge::console_bridge PROPERTIES INTERFACE_LINK_LIBRARIES ${console_bridge_LIBRARIES})
else()
get_target_property(CHECK_INCLUDE_DIRECTORIES console_bridge::console_bridge INTERFACE_INCLUDE_DIRECTORIES)
if(NOT ${CHECK_INCLUDE_DIRECTORIES})
set_target_properties(console_bridge::console_bridge PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
${console_bridge_INCLUDE_DIRS})
endif()
endif()

if(NOT TARGET Eigen3::Eigen)
find_package(Threads REQUIRED)
add_library(Eigen3::Eigen IMPORTED INTERFACE)
set_property(TARGET Eigen3::Eigen PROPERTY INTERFACE_COMPILE_DEFINITIONS ${EIGEN3_DEFINITIONS})
set_property(TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIRS})
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ macro(descartes_variables)
set(BUILD_SHARED_LIBS ON)
endif()

if(NOT DEFINED DESCARTES_PACKAGE_SOURCE_UPLOAD)
set(DESCARTES_PACKAGE_SOURCE_UPLOAD OFF)
endif()

if(NOT DEFINED DESCARTES_PACKAGE_SOURCE_DISTRIBUTIONS)
set(DESCARTES_PACKAGE_SOURCE_DISTRIBUTIONS focal jammy)
endif()

if(NOT DEFINED DESCARTES_PACKAGE_SOURCE_DPUT_HOST)
set(DESCARTES_PACKAGE_SOURCE_DPUT_HOST ppa:levi-armstrong/tesseract-robotics)
endif()

if(NOT DEFINED DESCARTES_PACKAGE_SOURCE_DEBIAN_INCREMENT)
set(DESCARTES_PACKAGE_SOURCE_DEBIAN_INCREMENT 0)
endif()

if(NOT DEFINED DESCARTES_ENABLE_CLANG_TIDY)
set(DESCARTES_ENABLE_CLANG_TIDY OFF)
endif()
Expand Down

0 comments on commit a6b4c01

Please sign in to comment.