Skip to content
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
35 changes: 35 additions & 0 deletions 3rdparty/mcap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
include(FetchContent)
FetchContent_Declare(mcap
GIT_REPOSITORY https://github.com/foxglove/mcap.git
GIT_TAG releases/cpp/v1.4.0 # pin a real tag
)
FetchContent_MakeAvailable(mcap)

add_library(mcap INTERFACE)
target_include_directories(mcap INTERFACE ${mcap_SOURCE_DIR}/cpp/mcap/include)

# mcap's reader/writer .inl always compile in LZ4/ZSTD (de)compression paths,
# even for callers that only ever write Compression::None -- so the symbols
# must be linked unconditionally, not just when compression is actually used.
#
# On Windows there's no system package manager providing liblz4/libzstd dev
# packages (unlike apt on Linux / Homebrew on macOS), and no vendored/prebuilt
# copy of them here yet -- see 3rdpartyBinary/Proj for that pattern if this
# ever needs revisiting. Until then, disable mcap's LZ4/ZSTD code paths on
# Windows via its own escape hatch: reading uncompressed/other-codec mcaps
# still works, only Compression::Lz4/Zstd at write time become unavailable --
# fine since this repo's writer (rosbags/McapWriter) only ever writes
# Compression::None.
if(WIN32)
target_compile_definitions(mcap INTERFACE MCAP_COMPRESSION_NO_LZ4 MCAP_COMPRESSION_NO_ZSTD)
else()
find_library(MCAP_LZ4_LIBRARY NAMES lz4)
find_library(MCAP_ZSTD_LIBRARY NAMES zstd)
find_path(MCAP_LZ4_INCLUDE_DIR NAMES lz4frame.h)
find_path(MCAP_ZSTD_INCLUDE_DIR NAMES zstd.h)
if(NOT MCAP_LZ4_LIBRARY OR NOT MCAP_ZSTD_LIBRARY OR NOT MCAP_LZ4_INCLUDE_DIR OR NOT MCAP_ZSTD_INCLUDE_DIR)
message(FATAL_ERROR "mcap requires liblz4 and libzstd (dev packages) to build against")
endif()
target_link_libraries(mcap INTERFACE ${MCAP_LZ4_LIBRARY} ${MCAP_ZSTD_LIBRARY})
target_include_directories(mcap INTERFACE ${MCAP_LZ4_INCLUDE_DIR} ${MCAP_ZSTD_INCLUDE_DIR})
endif()
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ if(BUILD_TESTING)
enable_testing()
add_subdirectory(shared/tests)
add_subdirectory(apps/lidar_odometry_step_1/tests)
add_subdirectory(rosbags/tests)
endif()

set(CORE_LIBRARIES core)
Expand Down
44 changes: 43 additions & 1 deletion apps/console_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,46 @@ target_include_directories(pcd_to_laz PRIVATE ${LASZIP_INCLUDE_DIR}/LASzip/inclu

add_executable(laz_to_txt laz_to_txt.cpp)
target_link_libraries(laz_to_txt PRIVATE ${PLATFORM_LASZIP_LIB} spdlog::spdlog)
target_include_directories(laz_to_txt PRIVATE ${LASZIP_INCLUDE_DIR}/LASzip/include ${PROJECT_BINARY_DIR}/include)
target_include_directories(laz_to_txt PRIVATE ${LASZIP_INCLUDE_DIR}/LASzip/include ${PROJECT_BINARY_DIR}/include)

# laz_to_mcap: LAZ (+ optional IMU csv, or a whole mandeye session directory)
# -> MCAP/ROS2 bag exporter. Reuses load_point_cloud()/load_imu() from
# lidar_odometry_step_1/lidar_odometry_utils.cpp (not load_data(), which
# additionally drops the first LAZ file's points as part of that app's own
# odometry preprocessing -- wrong for a lossless exporter), so it needs
# TBB/spdlog/laszip/core plus that file's own header-only dependencies
# (glm/toml++/json/observation_equations/vqf), but none of the GUI libs.
add_executable(
laz_to_mcap laz_to_mcap.cpp
${REPOSITORY_DIRECTORY}/apps/lidar_odometry_step_1/lidar_odometry_utils.h
${REPOSITORY_DIRECTORY}/apps/lidar_odometry_step_1/lidar_odometry_utils.cpp
${REPOSITORY_DIRECTORY}/rosbags/McapWriter.h ${REPOSITORY_DIRECTORY}/rosbags/McapWriter.cpp
)

target_include_directories(
laz_to_mcap
PRIVATE ${REPOSITORY_DIRECTORY}/apps/lidar_odometry_step_1
${REPOSITORY_DIRECTORY}/core/include
${REPOSITORY_DIRECTORY}/rosbags
${THIRDPARTY_DIRECTORY} # csv.hpp (used by load_imu)
${THIRDPARTY_DIRECTORY}/glm
${EIGEN3_INCLUDE_DIR}
${THIRDPARTY_DIRECTORY}/tomlplusplus/include
${THIRDPARTY_DIRECTORY}/json/include
${LASZIP_INCLUDE_DIR}/LASzip/include
${THIRDPARTY_DIRECTORY}/observation_equations/codes
${THIRDPARTY_DIRECTORY}/vqf/vqf/cpp)

target_link_libraries(
laz_to_mcap
PRIVATE
mcap
unordered_dense::unordered_dense
spdlog::spdlog
${PLATFORM_LASZIP_LIB}
${PLATFORM_MISCELLANEOUS_LIBS}
${CORE_LIBRARIES})

if (MSVC)
target_compile_options(laz_to_mcap PRIVATE /bigobj)
endif()
Loading
Loading