2018-05-29 09:07:02 -07:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
|
|
|
project(rcl_yaml_param_parser)
|
|
|
|
|
|
|
|
find_package(ament_cmake_ros REQUIRED)
|
|
|
|
find_package(rcutils REQUIRED)
|
|
|
|
find_package(libyaml_vendor REQUIRED)
|
|
|
|
|
|
|
|
# Default to C++14
|
|
|
|
if(NOT CMAKE_CXX_STANDARD)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
|
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(rcl_yaml_parser_sources
|
2020-10-05 18:01:07 -07:00
|
|
|
src/add_to_arrays.c
|
|
|
|
src/namespace.c
|
|
|
|
src/node_params.c
|
|
|
|
src/parse.c
|
2018-05-29 09:07:02 -07:00
|
|
|
src/parser.c
|
2020-10-05 18:01:07 -07:00
|
|
|
src/yaml_variant.c
|
2018-05-29 09:07:02 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
add_library(
|
|
|
|
${PROJECT_NAME}
|
|
|
|
${rcl_yaml_parser_sources})
|
2020-04-20 09:33:04 -07:00
|
|
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
|
|
|
"$<INSTALL_INTERFACE:include>")
|
2020-04-22 15:14:47 -07:00
|
|
|
ament_target_dependencies(${PROJECT_NAME} "libyaml_vendor" "rcutils")
|
2019-07-12 11:01:24 -03:00
|
|
|
|
|
|
|
# Set the visibility to hidden by default if possible
|
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
|
|
# Set the visibility of symbols to hidden by default for gcc and clang
|
|
|
|
# (this is already the default on Windows)
|
|
|
|
set_target_properties(${PROJECT_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "-fvisibility=hidden"
|
|
|
|
)
|
|
|
|
endif()
|
2018-05-29 09:07:02 -07:00
|
|
|
|
|
|
|
# Causes the visibility macros to use dllexport rather than dllimport,
|
|
|
|
# which is appropriate when building the dll but not consuming it.
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE "RCL_YAML_PARAM_PARSER_BUILDING_DLL")
|
|
|
|
|
2020-04-20 09:33:04 -07:00
|
|
|
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
|
2018-05-29 09:07:02 -07:00
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
RUNTIME DESTINATION bin)
|
|
|
|
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
find_package(ament_cmake_gtest REQUIRED)
|
|
|
|
find_package(ament_lint_auto REQUIRED)
|
2019-07-12 15:07:42 -03:00
|
|
|
find_package(osrf_testing_tools_cpp REQUIRED)
|
2018-05-29 09:07:02 -07:00
|
|
|
ament_lint_auto_find_test_dependencies()
|
|
|
|
|
2020-09-25 18:10:06 +02:00
|
|
|
find_package(performance_test_fixture REQUIRED)
|
|
|
|
# Give cppcheck hints about macro definitions coming from outside this package
|
|
|
|
get_target_property(ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS
|
|
|
|
performance_test_fixture::performance_test_fixture INTERFACE_INCLUDE_DIRECTORIES)
|
|
|
|
|
2018-05-29 09:07:02 -07:00
|
|
|
# Gtests
|
2020-09-02 14:25:45 -07:00
|
|
|
ament_add_gtest(test_namespace
|
|
|
|
test/test_namespace.cpp
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
)
|
|
|
|
if(TARGET test_namespace)
|
|
|
|
ament_target_dependencies(test_namespace
|
|
|
|
"rcutils"
|
|
|
|
"osrf_testing_tools_cpp"
|
|
|
|
)
|
2020-09-02 14:35:25 -07:00
|
|
|
target_compile_definitions(test_namespace PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
|
2020-09-02 14:25:45 -07:00
|
|
|
target_link_libraries(test_namespace ${PROJECT_NAME})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ament_add_gtest(test_node_params
|
|
|
|
test/test_node_params.cpp
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
)
|
|
|
|
if(TARGET test_node_params)
|
|
|
|
ament_target_dependencies(test_node_params
|
|
|
|
"rcutils"
|
|
|
|
"osrf_testing_tools_cpp"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_node_params ${PROJECT_NAME})
|
|
|
|
endif()
|
|
|
|
|
2018-05-29 09:07:02 -07:00
|
|
|
ament_add_gtest(test_parse_yaml
|
|
|
|
test/test_parse_yaml.cpp
|
2019-10-23 15:40:43 -05:00
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
2018-05-29 09:07:02 -07:00
|
|
|
)
|
|
|
|
if(TARGET test_parse_yaml)
|
|
|
|
target_link_libraries(test_parse_yaml ${PROJECT_NAME})
|
2019-07-12 15:07:42 -03:00
|
|
|
target_include_directories(test_parse_yaml
|
|
|
|
PRIVATE ${osrf_testing_tools_cpp_INCLUDE_DIRS})
|
2018-05-29 09:07:02 -07:00
|
|
|
endif()
|
|
|
|
|
2020-09-02 14:25:45 -07:00
|
|
|
ament_add_gtest(test_parse
|
|
|
|
test/test_parse.cpp
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
)
|
|
|
|
if(TARGET test_parse)
|
|
|
|
ament_target_dependencies(test_parse
|
|
|
|
"rcutils"
|
|
|
|
"osrf_testing_tools_cpp"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_parse ${PROJECT_NAME})
|
|
|
|
endif()
|
|
|
|
|
2020-05-26 12:45:36 -07:00
|
|
|
ament_add_gtest(test_parser
|
|
|
|
test/test_parser.cpp
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
)
|
|
|
|
if(TARGET test_parser)
|
|
|
|
ament_target_dependencies(test_parser
|
|
|
|
"rcutils"
|
|
|
|
"osrf_testing_tools_cpp"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_parser ${PROJECT_NAME})
|
2020-09-02 14:35:25 -07:00
|
|
|
target_compile_definitions(test_parser PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
|
2020-05-26 12:45:36 -07:00
|
|
|
endif()
|
|
|
|
|
2020-09-25 18:10:06 +02:00
|
|
|
add_performance_test(benchmark_parse_yaml test/benchmark/benchmark_parse_yaml.cpp
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
if(TARGET benchmark_parse_yaml)
|
|
|
|
target_link_libraries(benchmark_parse_yaml ${PROJECT_NAME})
|
|
|
|
ament_target_dependencies(benchmark_parse_yaml
|
|
|
|
"rcpputils"
|
|
|
|
"rcutils"
|
|
|
|
)
|
|
|
|
endif()
|
2020-09-02 14:25:45 -07:00
|
|
|
ament_add_gtest(test_yaml_variant
|
|
|
|
test/test_yaml_variant.cpp
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
)
|
|
|
|
if(TARGET test_yaml_variant)
|
|
|
|
ament_target_dependencies(test_yaml_variant
|
|
|
|
"rcutils"
|
|
|
|
"osrf_testing_tools_cpp"
|
|
|
|
)
|
|
|
|
target_link_libraries(test_yaml_variant ${PROJECT_NAME})
|
|
|
|
endif()
|
2018-05-29 09:07:02 -07:00
|
|
|
endif()
|
|
|
|
|
2020-04-22 15:14:47 -07:00
|
|
|
ament_export_dependencies(ament_cmake libyaml_vendor)
|
2018-05-29 09:07:02 -07:00
|
|
|
ament_export_include_directories(include)
|
|
|
|
install(
|
|
|
|
DIRECTORY include/
|
|
|
|
DESTINATION include
|
|
|
|
)
|
|
|
|
ament_export_libraries(${PROJECT_NAME})
|
2020-04-20 09:33:04 -07:00
|
|
|
ament_export_targets(${PROJECT_NAME})
|
2018-05-29 09:07:02 -07:00
|
|
|
ament_package()
|