Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Cleanup in mcap_vendor package
Browse files Browse the repository at this point in the history
- Use `${PROJECT_NAME}` instead of confusing `mcap` for library name and
exporting target, to be consistent with all other packages in ROS2.

- Add export for path to the `mcap` includes and export for mcap_vendor
library. It was an issue in downstream packages that `mcap/mcap.hpp` was
not visible since we were not exporting path to it explicitly.

- Removed test section with linters for `mcap_vendor` package. Since
package itself doesn't contain any tests and we shouldn't run linters
on any third party code. Prevent CI failures.

Signed-off-by: Michael Orlov <[email protected]>
  • Loading branch information
MichaelOrlov committed Oct 21, 2022
1 parent fcd2564 commit ad7d88b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
40 changes: 14 additions & 26 deletions mcap_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.5)
project(mcap_vendor LANGUAGES C CXX ASM)

## Dependencies
find_package(ament_cmake REQUIRED)
find_package(zstd_vendor REQUIRED)
find_package(zstd REQUIRED)

## Compile options
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -11,12 +16,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

## Dependencies
find_package(ament_cmake REQUIRED)
find_package(zstd_vendor REQUIRED)
find_package(zstd REQUIRED)


## Define vendor macro
macro(build_mcap_vendor)
include(FetchContent)
Expand All @@ -35,48 +34,37 @@ macro(build_mcap_vendor)
file(GLOB _lz4_srcs
${lz4_SOURCE_DIR}/lib/*.c)

add_library(
mcap SHARED
add_library(${PROJECT_NAME} SHARED
src/main.cpp
${_lz4_srcs}
)

set(_mcap_include_dir ${mcap_SOURCE_DIR}/cpp/mcap/include)

target_include_directories(mcap SYSTEM PRIVATE
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
${lz4_SOURCE_DIR}/lib
)
target_include_directories(mcap SYSTEM PUBLIC
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"$<BUILD_INTERFACE:${_mcap_include_dir}>"
"$<INSTALL_INTERFACE:include>"
)
ament_target_dependencies(mcap zstd)

install(
DIRECTORY
${_mcap_include_dir}/mcap
DESTINATION
${CMAKE_INSTALL_PREFIX}/include
DIRECTORY ${_mcap_include_dir}/mcap
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
)

install(TARGETS mcap EXPORT export_mcap)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME})
endmacro()

## Call vendor macro
build_mcap_vendor()

ament_export_targets(export_mcap HAS_LIBRARY_TARGET)

ament_export_include_directories(${_mcap_include_dir})
ament_export_libraries(${PROJECT_NAME})
ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(zstd_vendor zstd)

## Tests
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
list(APPEND AMENT_LINT_AUTO_EXCLUDE
ament_cmake_uncrustify
)
ament_lint_auto_find_test_dependencies()
endif()

## Package
ament_package()
4 changes: 0 additions & 4 deletions mcap_vendor/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@

<depend>zstd_vendor</depend>

<test_depend>ament_cmake_clang_format</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down

0 comments on commit ad7d88b

Please sign in to comment.