-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
81 lines (62 loc) · 2.14 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
# Copyright (c) Orbbec Inc. All Rights Reserved.
# Licensed under the MIT License.
cmake_minimum_required(VERSION 3.5)
project(OrbbecSDK VERSION 2.1.1 LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# check if current project is a sub project of other project
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(OB_IS_MAIN_PROJECT TRUE)
else()
set(OB_IS_MAIN_PROJECT FALSE)
endif()
# load project options
include(cmake/options.cmake)
# load macros
include(cmake/macro.cmake)
# set compiler flags
include(cmake/compiler_flags.cmake)
# configure platform-specific settings(contains platform-specific compiler flags)
if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
include(cmake/android_config.cmake)
elseif(WIN32)
include(cmake/windows_config.cmake)
elseif(APPLE)
include(cmake/macos_config.cmake)
elseif(UNIX)
include(cmake/linux_config.cmake)
endif()
# configure global settings: install rules, output directories, global variables, clang-tidy, etc.
include(cmake/global_config.cmake)
# configure global directories variables
set(OB_PUBLIC_HEADERS_DIR ${CMAKE_CURRENT_LIST_DIR}/include/)
set(OB_3RDPARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/3rdparty)
set(OB_PROJECT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
add_subdirectory(extensions)
add_subdirectory(src)
if(OB_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(OB_INSTALL_EXAMPLES_SOURCE AND OB_IS_MAIN_PROJECT)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/examples/ DESTINATION examples/src PATTERN "*publish_files*" EXCLUDE )
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/examples/publish_files)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/examples/publish_files/CMakeLists.txt DESTINATION examples)
if(APPLE)
install(TARGETS OrbbecSDK DESTINATION ./bin)
endif()
if(UNIX)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/examples/publish_files/build_examples.sh DESTINATION ./)
endif()
endif()
endif()
if(OB_BUILD_TESTS)
add_subdirectory(tests)
endif()
if(OB_BUILD_DOCS)
add_subdirectory(docs)
endif()
if(OB_BUILD_TOOLS)
add_subdirectory(tools)
endif()
add_subdirectory(scripts)
ob_print_summary()