-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
102 lines (88 loc) · 3.68 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
cmake_minimum_required(VERSION 3.14)
# Set up project properties
set(PROJECT_NAMESPACE loco-3d)
set(PROJECT_NAME quadruped-walkgen)
set(PROJECT_DESCRIPTION "MPC Controller using Crocoddyl")
set(PROJECT_URL "https://github.com/${PROJECT_NAMESPACE}/${PROJECT_NAME}")
option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CUSTOM_HEADER_DIR ${PROJECT_NAME})
set(CXX_DISABLE_WERROR TRUE)
set(PROJECT_USE_CMAKE_EXPORT TRUE)
# Check if the submodule cmake have been initialized Check if the submodule
# cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
# Include important cmake modules
include("${JRL_CMAKE_MODULES}/base.cmake")
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})
# ADD_DEFINITIONS(-DWITH_CODEGEN)
add_project_dependency(crocoddyl REQUIRED)
add_project_dependency(example-robot-data)
find_package(Boost REQUIRED COMPONENTS filesystem system)
string(REGEX REPLACE "-" "_" PYTHON_DIR ${PROJECT_NAME})
option(BUILD_WITH_MULTITHREADS
"Build the library with the Multithreading support (required OpenMP)" ON)
if(BUILD_WITH_MULTITHREADS)
set(BUILD_WITH_NTHREADS
"4"
CACHE STRING "Number of threads")
string(REGEX MATCH "^[0-9]+$" BUILD_WITH_NTHREADS ${BUILD_WITH_NTHREADS})
if(NOT BUILD_WITH_NTHREADS MATCHES "^[0-9]+$")
set(BUILD_WITH_NTHREADS 4)
message(
WARNING
"the number of threads have to be an interger value, set to ${BUILD_WITH_NTHREADS}"
)
endif()
endif()
set(${PROJECT_NAME}_HEADERS
include/${CUSTOM_HEADER_DIR}/quadruped_augmented.hpp
include/${CUSTOM_HEADER_DIR}/quadruped_augmented.hxx
include/${CUSTOM_HEADER_DIR}/quadruped_augmented_time.hpp
include/${CUSTOM_HEADER_DIR}/quadruped_augmented_time.hxx
include/${CUSTOM_HEADER_DIR}/quadruped.hpp
include/${CUSTOM_HEADER_DIR}/quadruped.hxx
include/${CUSTOM_HEADER_DIR}/quadruped_nl.hpp
include/${CUSTOM_HEADER_DIR}/quadruped_nl.hxx
include/${CUSTOM_HEADER_DIR}/quadruped_step.hpp
include/${CUSTOM_HEADER_DIR}/quadruped_step.hxx
include/${CUSTOM_HEADER_DIR}/quadruped_step_period.hpp
include/${CUSTOM_HEADER_DIR}/quadruped_step_period.hxx
include/${CUSTOM_HEADER_DIR}/quadruped_step_time.hpp
include/${CUSTOM_HEADER_DIR}/quadruped_step_time.hxx
include/${CUSTOM_HEADER_DIR}/quadruped_time.hpp
include/${CUSTOM_HEADER_DIR}/quadruped_time.hxx)
set(${PROJECT_NAME}_SOURCES
src/quadruped.cpp
src/quadruped_nl.cpp
src/quadruped_augmented.cpp
src/quadruped_step.cpp
src/quadruped_time.cpp
src/quadruped_augmented_time.cpp
src/quadruped_step_time.cpp)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
target_link_libraries(${PROJECT_NAME} PRIVATE Boost::system Boost::filesystem)
target_link_libraries(${PROJECT_NAME} PUBLIC crocoddyl::crocoddyl)
target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
endif()
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
add_subdirectory(python)
# Build benchmark
add_subdirectory(benchmark)
install(FILES package.xml DESTINATION share/${PROJECT_NAME})