forked from hd-zero/hdzero-goggle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
121 lines (103 loc) · 2.94 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
cmake_minimum_required(VERSION 3.10)
project(HDZGOGGLE VERSION 1.1)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_FLAGS "-mfpu=neon -mfloat-abi=hard -Wno-unused-function -Wno-unused-variable -ffunction-sections -fdata-sections -Wl,-gc-sections -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64")
set(CMAKE_CXX_FLAGS "-mfpu=neon -mfloat-abi=hard -Wno-unused-function -Wno-unused-variable -ffunction-sections -fdata-sections -Wl,-gc-sections -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(OS_APP_PATH ${PROJECT_SOURCE_DIR}/mkapp/app/app)
set(RECORD_APP_PATH ${PROJECT_SOURCE_DIR}/mkapp/app/app/record)
# common build settings
set(STANDARD_LIBRARIES
c
crypt
dl
m
pthread
rt
stdc++
)
add_definitions(
-DAWCHIP=AW_V5
-D_GNU_SOURCE
-DUSE_LOG_LIB_GLOG
)
# dependencies
add_subdirectory(lib/lvgl)
add_subdirectory(lib/minIni)
add_subdirectory(lib/log)
add_subdirectory(lib/esp-loader)
add_subdirectory(lib/softwinner)
add_subdirectory(lib/ffmpeg)
# main application
file(GLOB SRC_FILES_CORE "src/core/*.c" "src/core/*.h")
file(GLOB SRC_FILES_DRIVER "src/driver/*.c" "src/driver/*.h")
file(GLOB SRC_FILES_IMAGE "src/image/*.c" "src/image/*.h")
file(GLOB SRC_FILES_UI "src/ui/*.c" "src/ui/*.h")
file(GLOB SRC_FILES_BMI "src/bmi270/*.c" "src/bmi270/*.h")
file(GLOB SRC_FILES_WINDOW "src/window/*.c" "src/window/*.h")
file(GLOB SRC_FILES_PLAYER "src/player/*.c" "src/player/*.h")
file(GLOB SRC_FILES_UTIL "src/util/*.c" "src/util/*.h")
add_executable(${PROJECT_NAME}
${SRC_FILES_CORE}
${SRC_FILES_DRIVER}
${SRC_FILES_IMAGE}
${SRC_FILES_UI}
${SRC_FILES_BMI}
${SRC_FILES_WINDOW}
${SRC_FILES_PLAYER}
${SRC_FILES_UTIL}
)
target_include_directories(${PROJECT_NAME} PRIVATE
src/
src/core
src/driver
src/player
src/player/media/app
src/window
lib/linux/include
lib/linux/include/video
)
target_link_libraries(${PROJECT_NAME} PRIVATE
${STANDARD_LIBRARIES}
log
lvgl
minIni
esp-loader
softwinner
)
# record application
file(GLOB SRC_FILES_RECORD "src/record/*.c" "src/record/*.h")
add_executable(record
${SRC_FILES_RECORD}
)
target_include_directories(record PRIVATE
src/record
lib/linux/include
lib/linux/include/video
lib/linux/include/media
)
target_link_libraries(record PRIVATE
${STANDARD_LIBRARIES}
log
ffmpeg
minIni
softwinner
)
# image build
add_custom_command(
OUTPUT ${PROJECT_SOURCE_DIR}/out/${PROJECT_NAME}
COMMAND size -A ${PROJECT_NAME}
COMMAND mkdir -p ${PROJECT_SOURCE_DIR}/out/
COMMAND cp ${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/out/
COMMAND cp record ${PROJECT_SOURCE_DIR}/out/
COMMAND cp ${PROJECT_NAME} ${OS_APP_PATH}
COMMAND cp record ${RECORD_APP_PATH}
COMMAND cd ${PROJECT_SOURCE_DIR} && ./mkapp/mkapp_ota.sh
DEPENDS ${PROJECT_NAME} record
)
add_custom_target(${PROJECT_NAME}-OTA ALL
DEPENDS ${PROJECT_SOURCE_DIR}/out/${PROJECT_NAME}
)