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

Cleanup in mcap_vendor package #62

Merged
merged 6 commits into from
Oct 27, 2022
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
47 changes: 20 additions & 27 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,42 @@ macro(build_mcap_vendor)
file(GLOB _lz4_srcs
${lz4_SOURCE_DIR}/lib/*.c)

add_library(
mcap SHARED
add_library(mcap 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(mcap PRIVATE
${lz4_SOURCE_DIR}/lib
)
target_include_directories(mcap SYSTEM PUBLIC
target_include_directories(mcap PUBLIC
"$<BUILD_INTERFACE:${_mcap_include_dir}>"
"$<INSTALL_INTERFACE:include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)
ament_target_dependencies(mcap zstd)

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

install(TARGETS mcap EXPORT export_mcap)
install(
TARGETS mcap
EXPORT mcap
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
endmacro()

## Call vendor macro
build_mcap_vendor()

ament_export_targets(export_mcap HAS_LIBRARY_TARGET)

ament_export_include_directories(include/${PROJECT_NAME})
ament_export_targets(mcap 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