-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathCMakeLists.txt
170 lines (158 loc) · 3.74 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Modules common to all chips
set(module_srcs
"adc.c"
"bit.c"
"ble.c"
"bthci.c"
"common.c"
"crypto.c"
"dht.c"
"encoder.c"
"eromfs.c"
"file.c"
"gpio.c"
"heaptrace.c"
"http.c"
"httpd.c"
"i2c.c"
"i2c_hw_master.c"
"i2c_hw_slave.c"
"ledc.c"
"mqtt.c"
"net.c"
"node.c"
"otaupgrade.c"
"ow.c"
"pipe.c"
"rtcmem.c"
"qrcodegen.c"
"sigma_delta.c"
"sjson.c"
"sodium.c"
"spi.c"
"spi_master.c"
"struct.c"
"time.c"
"tmr.c"
"u8g2.c"
"uart.c"
"ucg.c"
"wifi.c"
"wifi_ap.c"
"wifi_common.c"
"wifi_sta.c"
"ws2812.c"
)
# Chip specific modules, per module.
# List source files for each applicable chip.
if(IDF_TARGET STREQUAL "esp32")
list(APPEND module_srcs
"can.c"
"dac.c"
"eth.c"
"i2s.c"
"pulsecnt.c"
"rmt.c"
"sdmmc.c"
"touch.c"
)
elseif(IDF_TARGET STREQUAL "esp32s2")
list(APPEND module_srcs
"dac.c"
"pulsecnt.c"
"rmt.c"
)
elseif(IDF_TARGET STREQUAL "esp32s3")
list(APPEND module_srcs
"pulsecnt.c"
"rmt.c"
"sdmmc.c"
)
elseif(IDF_TARGET STREQUAL "esp32c3")
list(APPEND module_srcs
"rmt.c"
)
endif()
idf_component_register(
SRCS ${module_srcs}
INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}"
PRIV_REQUIRES
"app_update"
"base_nodemcu"
"bt"
"driver_can"
"esp_eth"
"esp_http_client"
"esp_http_server"
"esp_hw_support"
"fatfs"
"libsodium"
"lua"
"mbedtls"
"mqtt"
"platform"
"qrcodegen"
"sdmmc"
"spi_flash"
"sjson"
"soc"
"u8g2"
"ucg"
"vfs"
)
# Match up all the module source files with their corresponding Kconfig
# option in the form NODEMCU_CMODULE_<modname> and if enabled, add a
# "-u <modname>_module_selected1" option to force the linker to include
# the module. See components/core/include/module.h for further details on
# how this works.
set(modules_enabled)
foreach(module_src ${module_srcs})
string(REPLACE ".c" "" module_name ${module_src})
string(TOUPPER ${module_name} module_ucase)
set(mod_opt "CONFIG_NODEMCU_CMODULE_${module_ucase}")
if (${${mod_opt}})
list(APPEND modules_enabled ${module_ucase})
endif()
endforeach()
message("Including the following modules: ${modules_enabled}")
foreach(mod ${modules_enabled})
target_link_libraries(${COMPONENT_LIB} "-u ${mod}_module_selected1")
endforeach()
# Auto-generation of ucg/u8g2 header files, per
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#source-code-generation
add_custom_command(
OUTPUT ucg_config.h
COMMAND perl -w ${PROJECT_DIR}/tools/ucg_config.pl < ${SDKCONFIG_HEADER} > ucg_config.h
DEPENDS ${SDKCONFIG_HEADER}
VERBATIM
)
add_custom_target(ucg_config DEPENDS ucg_config.h)
add_custom_command(
OUTPUT u8g2_fonts.h
COMMAND perl -w ${PROJECT_DIR}/tools/u8g2_config_fonts.pl < ${SDKCONFIG_HEADER} > u8g2_fonts.h
DEPENDS ${SDKCONFIG_HEADER}
VERBATIM
)
add_custom_target(u8g2_fonts DEPENDS u8g2_fonts.h)
add_custom_command(
OUTPUT u8g2_displays.h
COMMAND perl -w ${PROJECT_DIR}/tools/u8g2_config_displays.pl < ${SDKCONFIG_HEADER} > u8g2_displays.h
)
add_custom_target(u8g2_displays DEPENDS u8g2_displays.h)
add_dependencies(${COMPONENT_LIB} ucg_config u8g2_fonts u8g2_displays)
set_property(
DIRECTORY "${COMPONENT_DIR}" APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ucg_config.h u8g2_fonts.h u8g2_displays.h
)
# eromfs generation
add_custom_command(
OUTPUT eromfs.bin
COMMAND ${COMPONENT_DIR}/eromfs.py ${CONFIG_NODEMCU_CMODULE_EROMFS_VOLUMES}
DEPENDS ${SDKCONFIG_HEADER}
)
add_custom_target(eromfs_bin DEPENDS eromfs.bin)
target_add_binary_data(${COMPONENT_LIB} "${CMAKE_CURRENT_BINARY_DIR}/eromfs.bin" BINARY DEPENDS eromfs_bin)
set_property(
DIRECTORY "${COMPONENT_DIR}" APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES eromfs.bin
)