runtime/env_manager/CMakeLists.txt
2023-02-08 15:06:48 +00:00

126 lines
2.9 KiB
CMake

cmake_minimum_required(VERSION 3.5)
project(env_manager)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED True)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
set(ENV_MANAGER_CONFIGURATION_FILES_DIRECTORY ${PROJECT_SOURCE_DIR}/config
CACHE PATH ".lua configuration files dir")
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_ros REQUIRED)
find_package(Boost REQUIRED)
find_package(rcl REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rcutils REQUIRED)
find_package(glog 0.4.0 REQUIRED)
find_package(Lua 5.3 REQUIRED)
add_library(env_manager STATIC
src/component_manager/component_manager.cpp
src/config/config_file_resolver.cpp
src/config/lua_file_resolver.cpp
src/config/options.cpp
)
configure_file(
${PROJECT_SOURCE_DIR}/include/config/config.hpp.cmake
${PROJECT_BINARY_DIR}/include/config/config.hpp)
target_include_directories(env_manager PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
env_manager
Boost
rcl
glog
Lua
class_loader
rclcpp
rclcpp_components
)
target_include_directories(env_manager PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(env_manager PRIVATE "COMPONENT_MANAGER_BUILDING_LIBRARY")
if(NOT WIN32)
ament_environment_hooks(
"${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}")
endif()
add_executable(main
src/main.cpp
)
target_link_libraries(main env_manager lua glog)
ament_target_dependencies(
main
Boost
rcl
rclcpp
glog
Lua
)
install(DIRECTORY config DESTINATION config)
install(
DIRECTORY include/
DESTINATION include
)
install(
TARGETS env_manager
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(
TARGETS main
DESTINATION lib/${PROJECT_NAME}
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_export_include_directories(
include
)
ament_export_libraries(
env_manager
)
ament_export_targets(
export_${PROJECT_NAME}
)
ament_export_dependencies(rcutils)
ament_package()