Skip to content

Commit

Permalink
Merge pull request #350 from liamHowatt/fix/cmake-json-and-stm32-indev
Browse files Browse the repository at this point in the history
fix(gen): Use LVGL JSON in CMake based builds too - RP2040 and ESP32
  • Loading branch information
kisvegabor authored Jul 22, 2024
2 parents 6dff116 + a0281b8 commit d582e85
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion driver/stm32/STM32F7DISC/modrk043fn48h.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc) {
lv_display_flush_ready(dma2d_disp_drv);
}

STATIC void mp_rk043fn48h_ts_read(struct _lv_indev_t *indev_drv, lv_indev_data_t *data) {
STATIC void mp_rk043fn48h_ts_read(lv_indev_t *indev_drv, lv_indev_data_t *data) {
static TS_StateTypeDef ts_state = {0};
static int32_t lastX = 0;
static int32_t lastY = 0;
Expand Down
36 changes: 35 additions & 1 deletion mkrules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,48 @@ function(lv_bindings)
set(LV_PP_FILTERED ${LV_PP})
endif()

set(LV_JSON ${CMAKE_BINARY_DIR}/lvgl_all.json)

if (EXISTS ${LVGL_DIR}/scripts/gen_json/gen_json.py)
set(LVGL_ALL_H ${CMAKE_BINARY_DIR}/lvgl_all.h)
add_custom_command(
OUTPUT
${LVGL_ALL_H}
COMMAND
echo "\"#include\"" "\"\\\"${LVGL_DIR}/lvgl.h\\\"\"" > ${LVGL_ALL_H}
COMMAND
echo "\"#include\"" "\"\\\"${LVGL_DIR}/src/lvgl_private.h\\\"\"" >> ${LVGL_ALL_H}
COMMAND_EXPAND_LISTS
)
add_custom_command(
OUTPUT
${LV_JSON}
COMMAND
${Python3_EXECUTABLE} ${LVGL_DIR}/scripts/gen_json/gen_json.py --target-header ${LVGL_ALL_H} > ${LV_JSON}
DEPENDS
${LVGL_DIR}/scripts/gen_json/gen_json.py
${LVGL_ALL_H}
COMMAND_EXPAND_LISTS
)
else()
add_custom_command(
OUTPUT
${LV_JSON}
COMMAND
echo "{}" > ${LV_JSON}
COMMAND_EXPAND_LISTS
)
endif()

add_custom_command(
OUTPUT
${LV_OUTPUT}
COMMAND
${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)
${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)
DEPENDS
${LV_BINDINGS_DIR}/gen/gen_mpy.py
${LV_PP_FILTERED}
${LV_JSON}
COMMAND_EXPAND_LISTS
)

Expand Down

0 comments on commit d582e85

Please sign in to comment.