-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
116 lines (95 loc) · 3.6 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# --------------------------------------------
# Project setting
# --------------------------------------------
INCLUDE(cmake/messagecolor.cmake)
INCLUDE(cmake/utils.cmake)
FLOWENGINE_APP_EXTRACT_VERSION()
PROJECT(FlowEngine VERSION ${FLOWENGINE_APP_VERSION} LANGUAGES C CXX)
OPTION(BUILD_TESTS "Build with tests" ON)
OPTION(BUILD_APP "Build with application" ON)
OPTION(BUILD_SERVER "Build with server" ON)
MESSAGE(INFO "--------------------------------")
MESSAGE(STATUS "Build FlowEngine: ${FLOWENGINE_APP_VERSION}")
MESSAGE(STATUS "Build with tests: ${BUILD_TESTS}")
MESSAGE(STATUS "Build with application: ${BUILD_APP}")
MESSAGE(STATUS "Build with server: ${BUILD_SERVER}")
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
IF(CMAKE_TOOLCHAIN_FILE)
MESSAGE(STATUS "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}")
ENDIF()
# --------------------------------------------
# Set default build to debug
# --------------------------------------------
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose Release, Debug, RelWithDeblnfo or MinSizeRel" FORCE)
ENDIF()
IF(NOT TARGET_OS)
SET(TARGET_OS linux)
ENDIF()
IF(NOT TARGET_ARCH)
SET(TARGET_ARCH aarch64)
ENDIF()
IF(NOT TARGET_HARDWARE)
SET(TARGET_HARDWARE generic) # [generic/x3/jetson]
ENDIF()
SET(PROJECT_OUTPUT_DIR ${PROJECT_BINARY_DIR}/${TARGET_ARCH})
SET(PROJECT_INCLUDE_DIR ${PROJECT_OUTPUT_DIR}/include)
FILE(MAKE_DIRECTORY ${PROJECT_INCLUDE_DIR})
FILE(MAKE_DIRECTORY ${PROJECT_OUTPUT_DIR}/bin)
MESSAGE("-- system arch: ${CMAKE_SYSTEM_PROCESSOR}")
MESSAGE("-- output path: ${PROJECT_OUTPUT_DIR}")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_OUTPUT_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_OUTPUT_DIR}/lib)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_OUTPUT_DIR}/lib)
MESSAGE(STATUS "Your target os : ${TARGET_OS}")
MESSAGE(STATUS "Your target arch : ${TARGET_ARCH}")
MESSAGE(STATUS "Your target hardware : ${TARGET_HARDWARE}")
MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# --------------------------------------------
# Set compilation options
# --------------------------------------------
MESSAGE(INFO "--------------------------------")
INCLUDE(cmake/toolchain_options.cmake)
INCLUDE(cmake/load_3rdparty.cmake)
MESSAGE(INFO "Loading 3rdparty libraries")
IF(TARGET_HARDWARE STREQUAL "x3")
MESSAGE(STATUS "Loading X3 dependent libraries")
LOAD_X3()
ADD_DEFINITIONS(-DDECODER_POOL_SIZE=6)
ELSEIF(TARGET_HARDWARE STREQUAL "jetson")
MESSAGE(STATUS "Loading Jetson dependent libraries")
LOAD_Jetson()
ADD_DEFINITIONS(-DDECODER_POOL_SIZE=10)
ELSEIF(TARGET_HARDWARE STREQUAL "rockchip")
MESSAGE(STATUS "Loading Rockchip dependent libraries")
LOAD_ROCKCHIP()
ELSE()
MESSAGE(STATUS "Loading Generic dependent libraries")
LOAD_GENERIC()
ADD_DEFINITIONS(-DDECODER_POOL_SIZE=2)
ENDIF()
MESSAGE(INFO "3rdparty libraries has loaded.")
# --------------------------------------------
# Build 3rdparty
# --------------------------------------------
MESSAGE(INFO "--------------------------------")
# --------------------------------------------
ADD_SUBDIRECTORY(3rdparty)
# Build application
# --------------------------------------------
MESSAGE(INFO "--------------------------------")
ADD_SUBDIRECTORY(src)
IF(BUILD_TESTS)
MESSAGE(INFO "--------------------------------")
ADD_SUBDIRECTORY(tests)
ENDIF()
IF(BUILD_APP)
MESSAGE(INFO "--------------------------------")
ADD_SUBDIRECTORY(app)
ENDIF()
IF(BUILD_SERVER)
MESSAGE(INFO "--------------------------------")
ADD_SUBDIRECTORY(server)
ENDIF()