forked from kercre123/victor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
239 lines (189 loc) · 6.66 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
cmake_minimum_required(VERSION 3.6)
# uncomment this to display internal cmake state for targets, useful for debugging
# set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1)
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_CURRENT_SOURCE_DIR}/victor-clad/cmake
${CMAKE_CURRENT_SOURCE_DIR}/lib/audio/cmake
${CMAKE_CURRENT_SOURCE_DIR}/lib/util/cmake
${CMAKE_CURRENT_SOURCE_DIR}/tools/build/cmake
)
project(victor)
# Build options
option(USE_DAS "Enable DAS reporting" OFF)
# Use ccache if it is installed
include(ccache)
include(import)
include(clean_clad_targets)
include(license)
# These are used by some android cmake toolchains
# They appear to be ignored by the android-sdk toolchain that works with gradle/Android Studio
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 99)
#
# Special settings for xcode.
# Set DEPLOY_WITH_CMAKE OFF to prevent anki_build_copy_assets from generating giant dependency lists.
# Ninja manages these lists efficiently but xcode build takes forever.
#
if (CMAKE_GENERATOR MATCHES "Xcode")
option(CMAKE_XCODE_GENERATE_SCHEME "Generate xcode schema files" ON)
option(DEPLOY_WITH_CMAKE "Use cmake instead of python3 for deploying assets" OFF)
endif()
# LTTNG based userspace tracing
option(USE_ANKITRACE "Enable ANKITRACE tracing" ON)
include(ankitrace)
# Set up custom property for file locations for custom targets
define_property(TARGET PROPERTY ANKI_OUT_PATH
BRIEF_DOCS "The output path for this custom target"
FULL_DOCS "The output path for this custom target")
set(SYMBOL_VISIBILITY_FLAGS "")
set(ANKI_PLATFORM_NAME "unknown")
if(MACOSX)
set(ANKI_PLATFORM_NAME "mac")
elseif(VICOS)
set(ANKI_PLATFORM_NAME "vicos")
set(SYMBOL_VISIBILITY_FLAGS "-fvisibility=hidden")
else()
message(FATAL_ERROR "unsupported platform: ${ANKI_PLATFORM_NAME}")
endif()
message(STATUS "ANKI_PLATFORM_NAME: ${ANKI_PLATFORM_NAME}")
add_compile_options(
$<$<CONFIG:Debug>:-O0>
$<$<CONFIG:Release>:-O2>
)
# RPATH options
if (VICOS)
set(CMAKE_INSTALL_RPATH "/anki/lib")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()
#
# Factory build options
#
option(FACTORY_TEST "Enable factory test features" OFF)
option(FACTORY_TEST_DEV "Enable factory test development features" OFF)
if (FACTORY_TEST)
add_definitions(-DFACTORY_TEST=1)
else()
add_definitions(-DFACTORY_TEST=0)
endif()
if (FACTORY_TEST_DEV)
add_definitions(-DFACTORY_TEST_DEV=1)
else()
add_definitions(-DFACTORY_TEST_DEV=0)
endif()
add_definitions(-DANKI_BUILD_SHA="${ANKI_BUILD_SHA}")
#
# Pass ANKI defines from the command-line to all targets
#
get_cmake_property(opts CACHE_VARIABLES)
foreach(opt ${opts})
if(opt STREQUAL "ANKI_BUILD_SHA")
# ignore, set previously
# we whitelist which defines are allowed to be added to prevent hidden, unexpected defines from sneaking in
elseif((opt MATCHES "ANKI_") OR (opt MATCHES "REMOTE_CONSOLE_ENABLED") OR (opt MATCHES "DO_DEV_POSE_CHECKS"))
get_property(helpstring CACHE ${opt} PROPERTY HELPSTRING)
if(${helpstring} MATCHES "cached value")
# value was set from a previous run, but not this run, turn off
# Note: remove_definitions #defines the value as OFF (which itself is undefined)
unset(${opt} CACHE)
add_definitions(-U${opt})
else()
# value was set this run, from the command-line
add_definitions(-D${opt}=${${opt}})
set_property(CACHE ${opt} PROPERTY HELPSTRING "cached value from a previous command-line")
endif()
endif()
endforeach()
set(LINK_FLAGS "${LINK_FLAGS} -Wl,--threads")
if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
endif()
if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
endif()
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif()
set(ANKI_EXTERNAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/EXTERNALS")
set(ANKI_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rd")
set(OKAO_VISION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/okaoVision")
set(ANKI_SRCLIST_DIR "${CMAKE_SOURCE_DIR}/generated/cmake")
set(CLAD_BASE_DIR "${CMAKE_SOURCE_DIR}/victor-clad/tools/message-buffers")
set(CLAD_VICTOR_EMITTER_DIR "${CMAKE_SOURCE_DIR}/victor-clad/victorEmitters")
add_subdirectory("victor-clad") # includes clad via message-buffers
# Current DEFAULT (android or mac platforms)
set(CLEAN_CLAD_TARGETS TRUE)
include(audio) # See ./cmake/audio.cmake for definitions and lib
include(wwise) # for Wwise targets
include(protobuf) # for protobuf target
include(breakpad) # for breakpad targets
include(avs-device-sdk)
include(speexdsp)
include(pffft)
include(mpg123)
import(util "lib/util")
import(DAS "lib/das-client")
# BRC-TODO: Make this top-level include into an "interface"
# lib so that other target can depend on it, instead of manually injecting
# include dirs
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
import(coretech "coretech")
add_subdirectory("lib/anki-ble")
add_subdirectory("lib/crash-reporting-vicos")
add_subdirectory("lib/micData")
add_subdirectory("lib/signalEssence")
add_subdirectory("platform")
add_subdirectory("clad")
add_subdirectory("cloud")
add_subdirectory("cubeBleClient")
add_subdirectory("osState")
add_subdirectory("cannedAnimLib")
add_subdirectory("animProcess")
add_subdirectory("webServerProcess")
add_subdirectory("testCrash")
add_subdirectory("dasmgr")
target_include_directories(victor_anim PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/anki/cozmo>
)
target_include_directories(victor_web_library PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/anki/cozmo>
)
add_subdirectory("robot")
import(cozmo_engine "engine")
target_include_directories(cozmo_engine PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/anki/cozmo>
)
if (VICOS)
include(vicos-sdk-stl-config)
include(gen-version)
endif()
if (VICOS)
add_subdirectory("auto-test")
endif()
add_subdirectory("resources")
if (MACOSX)
add_subdirectory("test")
add_subdirectory("simulator") # webots
enable_testing()
endif()
# VICOS/STAGING note: Platforms that generate clad should set this variable
# This avoids nuking CLAD output when no targets were built for a platform
if (CLEAN_CLAD_TARGETS)
clean_clad_targets()
endif()
# Note: if these dependencies are not included in this top-level cmake
# file then their targets are local and we can't query them
# for licenses here
#
# Recommend moving for leaf CMakeLists.txt to this file
include(opencv)
include(okao)
include(flatbuffers)
include(sodium)
include(aubio)
include(signalessence)
include(pryon_lite)
write_license_html()
check_licenses()