-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
144 lines (124 loc) · 3.9 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
cmake_minimum_required(VERSION 3.16)
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0072 NEW)
set(MSVC_INCREMENTAL_DEFAULT ON)
project(
template_arbml
VERSION 2.3.7
DESCRIPTION "MuJoCo Template Repository using ARBML libaray"
)
enable_language(C)
enable_language(CXX)
if(APPLE)
enable_language(OBJC)
enable_language(OBJCXX)
endif()
#################################
# Open Libraries ADD here
#################################
option(MUJOCO_BUILD_EXAMPLES "Build samples for MuJoCo" OFF)
option(MUJOCO_BUILD_SIMULATE "Build simulate library for MuJoCo" ON)
option(MUJOCO_BUILD_TESTS "Build tests for MuJoCo" OFF)
option(MUJOCO_TEST_PYTHON_UTIL "Build and test utility libraries for Python bindings" ON)
add_subdirectory(${PROJECT_SOURCE_DIR}/libraries/mujoco) # Add subdirectory
add_subdirectory(${PROJECT_SOURCE_DIR}/libraries/yaml-cpp)
option(BUILD_SHARED_LIBS "If ON, build shared library instead of static" OFF)
option(QPOASES_BUILD_EXAMPLES "Build examples." OFF)
option(QPOASES_AVOID_LA_NAMING_CONFLICTS "If ON, avoid to re-defined symbols that conflict with Blas/Lapack provided functions." OFF)
add_subdirectory(${PROJECT_SOURCE_DIR}/libraries/qpOASES)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/libraries/mujoco/sample/cmake") # CMake Path append
add_definitions(-DCMAKE_SOURCE_DIR="${CMAKE_SOURCE_DIR}")
#################################
# Open Libraries ENDS here
#################################
# Check if we are building as standalone project.
set(SAMPLE_STANDALONE OFF)
set(_INSTALL_SAMPLES ON)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(SAMPLE_STANDALONE ON)
# If standalone, do not install the samples.
set(_INSTALL_SAMPLES OFF)
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(SAMPLE_STANDALONE)
include(SampleOptions)
else()
enforce_mujoco_macosx_min_version()
endif()
include(SampleDependencies)
set(MUJOCO_SAMPLE_COMPILE_OPTIONS "${AVX_COMPILE_OPTIONS}" "${EXTRA_COMPILE_OPTIONS}")
set(MUJOCO_SAMPLE_LINK_OPTIONS "${EXTRA_LINK_OPTIONS}")
if(MUJOCO_HARDEN)
if(WIN32)
set(MUJOCO_SAMPLE_LINK_OPTIONS "${MUJOCO_SAMPLE_LINK_OPTIONS}" -O3 -Wl,/DYNAMICBASE)
else()
set(MUJOCO_SAMPLE_COMPILE_OPTIONS "${MUJOCO_SAMPLE_COMPILE_OPTIONS}" -O3 -fPIE)
if(APPLE)
set(MUJOCO_SAMPLE_LINK_OPTIONS "${MUJOCO_SAMPLE_LINK_OPTIONS}" -O3 -Wl,-pie)
else()
set(MUJOCO_SAMPLE_LINK_OPTIONS "${MUJOCO_SAMPLE_LINK_OPTIONS}" -O3 -pie)
endif()
endif()
endif()
#################################
# Custom Sources STARTS from here
#################################
find_package(Eigen3 REQUIRED)
include(FetchContent)
FetchContent_Declare(csvpp
GIT_REPOSITORY https://github.com/andreacasalino/csvcpp
GIT_TAG main
)
set(BUILD_CSV_READER_SAMPLES OFF)
set(BUILD_CSV_READER_TESTS OFF)
FetchContent_MakeAvailable(csvpp)
include_directories(
include
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/libraries/qpoases/include
${EIGEN3_INCLUDE_DIR}
DEPENDS system_lib
)
set(ARBML_SRC
include/ARBMLlib/ARBML.cpp
include/ARBMLlib/RigidBody.cpp
)
set(SIM_SRC
include/Simulator/Robot_Simulate.cpp
)
set(CONTRL_SRC
include/NullControl/NullControl.cpp
)
add_executable(template
src/main.cpp
src/Robot_Control.cpp
${SIMULATE_RESOURCE_FILES}
${SIM_SRC}
${ARBML_SRC}
${CONTRL_SRC}
)
target_include_directories(template PUBLIC
${CMAKE_SOURCE_DIR}/include
)
target_link_libraries(template
libsimulate
mujoco::mujoco
glfw
Threads::Threads
lodepng
csvpp
yaml-cpp
qpOASES
)
target_compile_options(template PUBLIC ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
#################################
# Custom Sources ENDS here
#################################
if(APPLE AND MUJOCO_BUILD_MACOS_FRAMEWORKS)
embed_in_bundle(template)
endif()
# Do not install if macOS Bundles are created as RPATH is managed manually there.
if(APPLE AND MUJOCO_BUILD_MACOS_FRAMEWORKS)
set(_INSTALL_SAMPLES OFF)
endif()