-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
executable file
·110 lines (96 loc) · 3.07 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
##
# @file CMakeLists.txt
# @brief
#/
# MODULE_PATH
set(MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
# MODULE_NAME
get_filename_component(MODULE_NAME ${MODULE_PATH} NAME)
# Arduino Board (t2/t3)
if(NOT DEFINED CONFIG_ARDUINO_BOARD)
message(FATAL_ERROR "Use [menuconfig] choice [ARDUINO_BOARD].")
endif()
if(${CONFIG_ARDUINO_BOARD} STREQUAL "ARDUINO_T3")
set(ARDUINO_BOARD "t3")
elseif(${CONFIG_ARDUINO_BOARD} STREQUAL "ARDUINO_T5")
set(ARDUINO_BOARD "t5")
elseif(${CONFIG_ARDUINO_BOARD} STREQUAL "ARDUINO_LN882H")
set(ARDUINO_BOARD "ln882h")
else()
set(CONFIG_ARDUINO_BOARD "ARDUINO_T2")
set(ARDUINO_BOARD "t2")
endif()
# LIB_SRCS
file(GLOB_RECURSE
LIB_SRCS_CORE
"${MODULE_PATH}/cores/tuya_open/*.cpp"
"${MODULE_PATH}/cores/tuya_open/*.c"
"${MODULE_PATH}/cores/tuya_open/api/*.cpp"
)
file(GLOB_RECURSE
LIB_SRCS_LIB
"${MODULE_PATH}/libraries/BLE/src/*.cpp"
"${MODULE_PATH}/libraries/BLE/src/*.c"
"${MODULE_PATH}/libraries/FS/src/*.cpp"
"${MODULE_PATH}/libraries/FS/src/*.c"
"${MODULE_PATH}/libraries/HTTPClient/src/*.cpp"
"${MODULE_PATH}/libraries/HTTPClient/src/*.c"
"${MODULE_PATH}/libraries/LittleFS/src/*.cpp"
"${MODULE_PATH}/libraries/LittleFS/src/*.c"
"${MODULE_PATH}/libraries/Log/src/*.cpp"
"${MODULE_PATH}/libraries/Log/src/*.c"
"${MODULE_PATH}/libraries/MQTTClient/src/*.cpp"
"${MODULE_PATH}/libraries/MQTTClient/src/*.c"
"${MODULE_PATH}/libraries/SPI/src/*.cpp"
"${MODULE_PATH}/libraries/SPI/src/*.c"
"${MODULE_PATH}/libraries/Ticker/src/*.cpp"
"${MODULE_PATH}/libraries/Ticker/src/*.c"
"${MODULE_PATH}/libraries/TuyaIoT/src/*.cpp"
"${MODULE_PATH}/libraries/TuyaIoT/src/*.c"
)
file(GLOB_RECURSE
LIB_SRCS_VAR
"${MODULE_PATH}/variants/${ARDUINO_BOARD}/*.c"
)
list(APPEND LIB_SRCS ${LIB_SRCS_CORE})
list(APPEND LIB_SRCS ${LIB_SRCS_LIB})
list(APPEND LIB_SRCS ${LIB_SRCS_VAR})
set(LIBRARIES_INC
"${MODULE_PATH}/libraries/BLE/src/"
"${MODULE_PATH}/libraries/FS/src/"
"${MODULE_PATH}/libraries/HTTPClient/src/"
"${MODULE_PATH}/libraries/LittleFS/src/"
"${MODULE_PATH}/libraries/Log/src/"
"${MODULE_PATH}/libraries/MQTTClient/src/"
"${MODULE_PATH}/libraries/SPI/src/"
"${MODULE_PATH}/libraries/Ticker/src/"
"${MODULE_PATH}/libraries/TuyaIoT/src/"
)
set(LIB_PUBLIC_INC
"${MODULE_PATH}/cores/tuya_open"
"${LIBRARIES_INC}"
"${MODULE_PATH}/variants/${ARDUINO_BOARD}"
)
########################################
# Target Configure
########################################
add_library(${MODULE_NAME})
target_sources(${MODULE_NAME}
PRIVATE
${LIB_SRCS}
)
target_include_directories(${MODULE_NAME}
PUBLIC
${LIB_PUBLIC_INC}
)
target_compile_options(${MODULE_NAME}
PRIVATE
-D${CONFIG_ARDUINO_BOARD}
)
########################################
# Layer Configure
########################################
list(APPEND COMPONENT_LIBS ${MODULE_NAME})
# set(COMPONENT_LIBS "${COMPONENT_LIBS}" PARENT_SCOPE)
list(APPEND COMPONENT_PUBINC ${LIB_PUBLIC_INC})
# set(COMPONENT_PUBINC "${COMPONENT_PUBINC}" PARENT_SCOPE)