Skip to content

Commit 421fc6b

Browse files
author
Emerson Knapp
committed
Builds, can use same CMake package names with workaround
Signed-off-by: Emerson Knapp <[email protected]>
1 parent 051efc7 commit 421fc6b

File tree

16 files changed

+62
-6
lines changed

16 files changed

+62
-6
lines changed

rosbag2/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ cmake_minimum_required(VERSION 3.5)
22
project(rosbag2)
33

44
find_package(ament_cmake REQUIRED)
5+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
6+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
7+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
58
ament_package()

rosbag2_compression/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ find_package(rcpputils REQUIRED)
2626
find_package(rcutils REQUIRED)
2727
find_package(rosbag2_cpp)
2828
find_package(rosbag2_storage REQUIRED)
29+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
30+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
31+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
2932

3033
add_library(${PROJECT_NAME}
3134
SHARED

rosbag2_compression_zstd/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ find_package(rcpputils REQUIRED)
2626
find_package(rosbag2_compression REQUIRED)
2727
find_package(zstd_vendor REQUIRED)
2828
find_package(zstd REQUIRED)
29+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
30+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
31+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
2932

3033
add_library(${PROJECT_NAME} SHARED
3134
src/rosbag2_compression_zstd/compression_utils.cpp

rosbag2_cpp/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ find_package(rosidl_runtime_c REQUIRED)
4545
find_package(rosidl_runtime_cpp REQUIRED)
4646
find_package(rosidl_typesupport_cpp REQUIRED)
4747
find_package(rosidl_typesupport_introspection_cpp REQUIRED)
48+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
49+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
50+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
4851

4952
add_library(${PROJECT_NAME} SHARED
5053
src/rosbag2_cpp/cache/cache_consumer.cpp

rosbag2_performance/rosbag2_performance_benchmarking/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1111
endif()
1212

1313
find_package(ament_cmake REQUIRED)
14+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
15+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
16+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
1417

1518
if(BUILD_ROSBAG2_BENCHMARKS)
1619
find_package(rclcpp REQUIRED)

rosbag2_py/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ find_package(ament_cmake_ros REQUIRED)
2121
find_package(rosbag2_compression REQUIRED)
2222
find_package(rosbag2_cpp REQUIRED)
2323
find_package(rosbag2_storage REQUIRED)
24+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
25+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
26+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
2427

2528
# Find python before pybind11
2629
find_package(python_cmake_module REQUIRED)

rosbag2_storage/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ find_package(pluginlib REQUIRED)
2525
find_package(rcpputils REQUIRED)
2626
find_package(rcutils REQUIRED)
2727
find_package(yaml_cpp_vendor REQUIRED)
28+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
29+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
30+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
2831

2932
add_library(
3033
${PROJECT_NAME}

rosbag2_storage_default_plugins/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ find_package(rosbag2_storage REQUIRED)
2828
find_package(sqlite3_vendor REQUIRED)
2929
find_package(SQLite3 REQUIRED) # provided by sqlite3_vendor
3030
find_package(yaml_cpp_vendor REQUIRED)
31+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
32+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
33+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
3134

3235
add_library(${PROJECT_NAME} SHARED
3336
src/rosbag2_storage_default_plugins/sqlite/sqlite_wrapper.cpp

rosbag2_test_common/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ find_package(ament_cmake REQUIRED)
2424
find_package(rclcpp REQUIRED)
2525
find_package(rcutils REQUIRED)
2626

27+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
28+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
29+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
30+
2731
add_library(${PROJECT_NAME} INTERFACE)
2832
target_include_directories(${PROJECT_NAME} INTERFACE
2933
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
@@ -46,4 +50,5 @@ ament_export_dependencies(rclcpp rcutils)
4650

4751
ament_export_include_directories(include)
4852
ament_export_targets(export_${PROJECT_NAME})
53+
4954
ament_package()

rosbag2_test_common/include/rosbag2_test_common/temporary_directory_fixture.hpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,18 @@ class TemporaryDirectoryFixture : public Test
3131
public:
3232
TemporaryDirectoryFixture()
3333
{
34-
temporary_dir_path_ = rcpputils::fs::create_temp_directory("tmp_test_dir_").string();
34+
// Foxy compatibility. Adapt for lack of https://github.com/ros2/rcpputils/pull/126
35+
char template_char[] = "tmp_test_dir.XXXXXX";
36+
#ifdef _WIN32
37+
char temp_path[255];
38+
GetTempPathA(255, temp_path);
39+
_mktemp_s(template_char, strnlen(template_char, 20) + 1);
40+
temporary_dir_path_ = std::string(temp_path) + std::string(template_char);
41+
_mkdir(temporary_dir_path_.c_str());
42+
#else
43+
char * dir_name = mkdtemp(template_char);
44+
temporary_dir_path_ = dir_name;
45+
#endif
3546
}
3647

3748
~TemporaryDirectoryFixture() override

rosbag2_tests/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ endif()
2424

2525
find_package(ament_cmake REQUIRED)
2626
find_package(ament_index_cpp REQUIRED)
27+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
28+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
29+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
2730

2831
if(BUILD_TESTING)
2932
find_package(ament_cmake_gmock REQUIRED)

rosbag2_transport/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ find_package(rosbag2_storage REQUIRED)
3232
find_package(rmw_implementation_cmake REQUIRED)
3333
find_package(shared_queues_vendor REQUIRED)
3434
find_package(yaml_cpp_vendor REQUIRED)
35+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
36+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
37+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
3538

3639
add_library(${PROJECT_NAME} SHARED
3740
src/rosbag2_transport/player.cpp

rosbag2_transport/package.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414

1515
<depend>python_cmake_module</depend>
1616
<depend>rclcpp</depend>
17-
<depend>rosbag2_compression</depend>
18-
<depend>rosbag2_cpp</depend>
19-
<depend>rosbag2_storage</depend>
17+
<depend>rosbag2_compression_future</depend>
18+
<depend>rosbag2_cpp_future</depend>
19+
<depend>rosbag2_storage_future</depend>
2020
<depend>rmw</depend>
2121
<depend>rpyutils</depend>
22-
<depend>shared_queues_vendor</depend>
22+
<depend>shared_queues_vendor_future</depend>
2323
<depend>yaml_cpp_vendor</depend>
2424

2525
<test_depend>ament_cmake_gmock</test_depend>
2626
<test_depend>ament_index_cpp</test_depend>
2727
<test_depend>ament_lint_auto</test_depend>
2828
<test_depend>ament_lint_common</test_depend>
2929
<test_depend>rmw_implementation_cmake</test_depend>
30-
<test_depend>rosbag2_test_common</test_depend>
30+
<test_depend>rosbag2_test_common_future</test_depend>
3131
<test_depend>test_msgs</test_depend>
3232

3333
<export>

shared_queues_vendor/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.5)
22
project(shared_queues_vendor)
33

44
find_package(ament_cmake REQUIRED)
5+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
6+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
7+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
58

69
include(ExternalProject)
710
# Single producer single consumer queue by moodycamel - header only, don't build, install
@@ -54,4 +57,5 @@ install(
5457

5558
ament_export_include_directories(include)
5659
ament_export_targets(export_${PROJECT_NAME})
60+
5761
ament_package()

sqlite3_vendor/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.5)
22
project(sqlite3_vendor)
33

44
find_package(ament_cmake REQUIRED)
5+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
6+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
7+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
58

69
option(FORCE_BUILD_VENDOR_PKG
710
"Build SQLite3 from source, even if system-installed package is available"

zstd_vendor/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.7)
33
project(zstd_vendor)
44

55
find_package(ament_cmake REQUIRED)
6+
# workaround so that package.xml can use _future, but other projects can find this without the suffix
7+
_ament_package_xml(${CMAKE_CURRENT_BINARY_DIR}/ament_cmake_core)
8+
set(_AMENT_PACKAGE_NAME ${PROJECT_NAME})
69

710
option(FORCE_BUILD_VENDOR_PKG
811
"Build zstd from source, even if system-installed package is available"

0 commit comments

Comments
 (0)