74 lines
1.8 KiB
CMake
74 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.8)
|
|
project(j7s-optimization)
|
|
|
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
|
|
|
# find dependencies
|
|
find_package(ament_cmake REQUIRED)
|
|
find_package(ament_cmake_ros REQUIRED)
|
|
find_package(rclcpp REQUIRED)
|
|
|
|
add_library(cost_function
|
|
src/CostFunction.cpp)
|
|
target_compile_features(cost_function PUBLIC cxx_std_17)
|
|
target_include_directories(cost_function PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>)
|
|
|
|
add_library(simplex_solver
|
|
src/SimplexSolver.cpp)
|
|
target_link_libraries(simplex_solver cost_function)
|
|
target_compile_features(simplex_solver PUBLIC cxx_std_17)
|
|
target_include_directories(simplex_solver PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>)
|
|
|
|
add_library(nelder_mead
|
|
src/NelderMead.cpp)
|
|
target_link_libraries(nelder_mead cost_function)
|
|
target_compile_features(nelder_mead PUBLIC cxx_std_17)
|
|
target_include_directories(nelder_mead PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>)
|
|
|
|
add_executable(main src/main.cpp)
|
|
target_compile_features(main PUBLIC cxx_std_17)
|
|
target_link_libraries(main cost_function simplex_solver nelder_mead)
|
|
target_include_directories(main PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>)
|
|
ament_target_dependencies(main rclcpp)
|
|
|
|
install(
|
|
DIRECTORY include/
|
|
DESTINATION include
|
|
)
|
|
install(
|
|
TARGETS
|
|
cost_function
|
|
simplex_solver
|
|
nelder_mead
|
|
EXPORT export_${PROJECT_NAME}
|
|
ARCHIVE DESTINATION lib
|
|
LIBRARY DESTINATION lib
|
|
RUNTIME DESTINATION bin
|
|
)
|
|
install(
|
|
TARGETS
|
|
main
|
|
DESTINATION lib/${PROJECT_NAME})
|
|
|
|
ament_export_include_directories(
|
|
include
|
|
)
|
|
ament_export_libraries(
|
|
cost_function
|
|
simplex_solver
|
|
nelder_mead
|
|
)
|
|
ament_export_targets(
|
|
export_${PROJECT_NAME}
|
|
)
|
|
|
|
ament_package()
|