forked from mavlink/MAVSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (74 loc) · 2.57 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
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 11)
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_BINARY_DIR}/third_party)
cmake_policy(SET CMP0025 NEW)
project(dronecode_sdk)
option(BUILD_TESTS "Build tests" ON)
include(cmake/compiler_flags.cmake)
include(cmake/curl.cmake)
include(cmake/tinyxml2.cmake)
include(cmake/zlib.cmake)
if(NOT MSVC)
cmake_policy(SET CMP0058 NEW)
include(third_party/cpp_rsc/cmake/modules/cpp_resource.cmake)
if(NOT ANDROID AND NOT IOS)
# If not cross-compiling, we can build cpp_rsc.
add_subdirectory(third_party/cpp_rsc/src EXCLUDE_FROM_ALL)
else()
# For cross-compilation, re-use the binary from default.
set_property(GLOBAL PROPERTY CPPRSC_CMD ${CMAKE_CURRENT_BINARY_DIR}/../default/third_party/cpp_rsc/src/cpp_rsc)
endif()
endif()
if(BUILD_TESTS AND (IOS OR ANDROID))
message(STATUS "Building for iOS or Android: forcing BUILD_TESTS to FALSE...")
set(BUILD_TESTS OFF)
endif()
if(ANDROID)
set(lib_path "lib/android/${ANDROID_ABI}")
elseif(IOS)
set(lib_path "lib/ios")
else()
set(lib_path "lib")
endif()
set(dronecode_sdk_install_include_dir "include/dronecode_sdk")
set(dronecode_sdk_install_lib_dir ${lib_path})
execute_process(
COMMAND git describe --abbrev=8 --dirty --always --tags
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_STR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Version: ${VERSION_STR}")
add_definitions(-DDRONECODE_SDK_VERSION="${VERSION_STR}")
add_subdirectory(core)
add_subdirectory(plugins)
if (DEFINED EXTERNAL_DIR AND NOT EXTERNAL_DIR STREQUAL "")
add_subdirectory(${EXTERNAL_DIR}/plugins
${CMAKE_CURRENT_BINARY_DIR}/${EXTERNAL_DIR}/plugins)
include_directories(${EXTERNAL_DIR})
endif()
if(BUILD_TESTS)
enable_testing()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/gtest EXCLUDE_FROM_ALL)
add_subdirectory(integration_tests)
if (DEFINED EXTERNAL_DIR AND NOT EXTERNAL_DIR STREQUAL "")
add_subdirectory(${EXTERNAL_DIR}/integration_tests
${CMAKE_CURRENT_BINARY_DIR}/${EXTERNAL_DIR}/integration_tests)
endif()
include(cmake/unit_tests.cmake)
endif()
if (CMAKE_BUILD_BACKEND)
message(STATUS "Building dronecode_sdk server")
add_subdirectory(backend)
else()
message(STATUS "BUILD_BACKEND not set: not building grpc backend")
endif()
if (DROP_DEBUG EQUAL 1)
add_definitions(-DDROP_DEBUG=${DROP_DEBUG})
add_executable(drop_debug
debug_helpers/drop_debug_main.cpp
)
target_link_libraries(drop_debug
dronecode_sdk
)
endif()