-
-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathCMakeLists.txt
66 lines (54 loc) · 2.38 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
cmake_minimum_required(VERSION 3.5)
execute_process(
COMMAND git describe --always --tags
OUTPUT_VARIABLE PROJECT_VER
OUTPUT_STRIP_TRAILING_WHITESPACE)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(ble2mqtt)
spiffs_create_partition_image(fs_0 data FLASH_IN_PROJECT)
spiffs_create_partition_image(fs_1 data FLASH_IN_PROJECT)
add_dependencies(spiffs_fs_0_bin validate-config)
add_custom_target(check-project-python-requirements
COMMAND ${python} $ENV{IDF_PATH}/tools/check_python_dependencies.py
-r ${PROJECT_DIR}/requirements.txt)
if(CMAKE_HOST_WIN32)
set(NULDEV NUL)
else()
set(NULDEV /dev/null)
endif()
add_custom_target(validate-config
COMMAND ${python} -m json.tool ${PROJECT_DIR}/data/config.json >${NULDEV}
|| (echo "Error: Invalid JSON in configuration file." && exit 1 ))
add_custom_target(upload
COMMAND ${python} ${PROJECT_DIR}/ota.py -f ${build_dir}/${PROJECT_BIN}
-v ${PROJECT_VER} -t $$\{OTA_TARGET:-BLE2MQTT\} -n Firmware
DEPENDS check-project-python-requirements app validate-config
USES_TERMINAL
WORKING_DIRECTORY ${PROJECT_DIR})
add_custom_target(force-upload
COMMAND ${python} ${PROJECT_DIR}/ota.py -f ${build_dir}/${PROJECT_BIN}
-v \"\" -t $$\{OTA_TARGET:-BLE2MQTT\} -n Firmware
DEPENDS check-project-python-requirements app validate-config
USES_TERMINAL
WORKING_DIRECTORY ${PROJECT_DIR})
add_custom_target(upload-config
COMMAND ${python} ${PROJECT_DIR}/ota.py -f ${build_dir}/fs_0.bin
-v $$\(shasum -a 256 ${build_dir}/fs_0.bin | awk '{ print $$1 }'\)
-t $$\{OTA_TARGET:-BLE2MQTT\} -n Config
DEPENDS check-project-python-requirements spiffs_fs_0_bin validate-config
USES_TERMINAL
WORKING_DIRECTORY ${PROJECT_DIR})
add_custom_target(force-upload-config
COMMAND ${python} ${PROJECT_DIR}/ota.py -f ${build_dir}/fs_0.bin -v \"\"
-t $$\{OTA_TARGET:-BLE2MQTT\} -n Config
DEPENDS check-project-python-requirements spiffs_fs_0_bin validate-config
USES_TERMINAL
WORKING_DIRECTORY ${PROJECT_DIR})
add_custom_target(remote-monitor
COMMAND ${python} -u ${PROJECT_DIR}/remote_log.py
DEPENDS validate-config
USES_TERMINAL
WORKING_DIRECTORY ${PROJECT_DIR})
add_custom_target(image
COMMAND esptool.py --chip esp32 merge_bin -o ble2mqtt-full.bin @flash_project_args
DEPENDS bootloader blank_ota_data app spiffs_fs_0_bin spiffs_fs_1_bin)