Skip to content

Commit a0281b8

Browse files
committed
the cmake build system can use the JSON now too
1 parent 490cc15 commit a0281b8

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

mkrules.cmake

+35-1
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,48 @@ function(lv_bindings)
6666
set(LV_PP_FILTERED ${LV_PP})
6767
endif()
6868

69+
set(LV_JSON ${CMAKE_BINARY_DIR}/lvgl_all.json)
70+
71+
if (EXISTS ${LVGL_DIR}/scripts/gen_json/gen_json.py)
72+
set(LVGL_ALL_H ${CMAKE_BINARY_DIR}/lvgl_all.h)
73+
add_custom_command(
74+
OUTPUT
75+
${LVGL_ALL_H}
76+
COMMAND
77+
echo "\"#include\"" "\"\\\"${LVGL_DIR}/lvgl.h\\\"\"" > ${LVGL_ALL_H}
78+
COMMAND
79+
echo "\"#include\"" "\"\\\"${LVGL_DIR}/src/lvgl_private.h\\\"\"" >> ${LVGL_ALL_H}
80+
COMMAND_EXPAND_LISTS
81+
)
82+
add_custom_command(
83+
OUTPUT
84+
${LV_JSON}
85+
COMMAND
86+
${Python3_EXECUTABLE} ${LVGL_DIR}/scripts/gen_json/gen_json.py --target-header ${LVGL_ALL_H} > ${LV_JSON}
87+
DEPENDS
88+
${LVGL_DIR}/scripts/gen_json/gen_json.py
89+
${LVGL_ALL_H}
90+
COMMAND_EXPAND_LISTS
91+
)
92+
else()
93+
add_custom_command(
94+
OUTPUT
95+
${LV_JSON}
96+
COMMAND
97+
echo "{}" > ${LV_JSON}
98+
COMMAND_EXPAND_LISTS
99+
)
100+
endif()
101+
69102
add_custom_command(
70103
OUTPUT
71104
${LV_OUTPUT}
72105
COMMAND
73-
${Python3_EXECUTABLE} ${LV_BINDINGS_DIR}/gen/gen_mpy.py ${LV_GEN_OPTIONS} -MD ${LV_MPY_METADATA} -E ${LV_PP_FILTERED} ${LV_INPUT} > ${LV_OUTPUT} || (rm -f ${LV_OUTPUT} && /bin/false)
106+
${Python3_EXECUTABLE} ${LV_BINDINGS_DIR}/gen/gen_mpy.py ${LV_GEN_OPTIONS} -MD ${LV_MPY_METADATA} -E ${LV_PP_FILTERED} -J ${LV_JSON} ${LV_INPUT} > ${LV_OUTPUT} || (rm -f ${LV_OUTPUT} && /bin/false)
74107
DEPENDS
75108
${LV_BINDINGS_DIR}/gen/gen_mpy.py
76109
${LV_PP_FILTERED}
110+
${LV_JSON}
77111
COMMAND_EXPAND_LISTS
78112
)
79113

0 commit comments

Comments
 (0)