Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gen): generate LVGL API JSON and pass it to gen_mpy.py #84

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions extmod/extmod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,34 @@ LVGL_DIR = $(LVGL_BINDING_DIR)/lvgl
LVGL_GENERIC_DRV_DIR = $(LVGL_BINDING_DIR)/driver/generic
INC += -I$(LVGL_BINDING_DIR)
ALL_LVGL_SRC = $(shell find $(LVGL_DIR) -type f -name '*.h') $(LVGL_BINDING_DIR)/lv_conf.h
LVGL_ALL_H = $(BUILD)/lvgl/lvgl_all.h
LVGL_ALL_JSON = $(BUILD)/lvgl/lvgl_all.json
LVGL_PP = $(BUILD)/lvgl/lvgl.pp.c
LVGL_MPY = $(BUILD)/lvgl/lv_mpy.c
LVGL_MPY_METADATA = $(BUILD)/lvgl/lv_mpy.json
CFLAGS_EXTMOD += $(LV_CFLAGS)

$(LVGL_MPY): $(ALL_LVGL_SRC) $(LVGL_BINDING_DIR)/gen/gen_mpy.py
ifneq (,$(wildcard $(LVGL_DIR)/scripts/gen_json/gen_json.py))
$(LVGL_ALL_JSON): $(ALL_LVGL_SRC) $(LVGL_DIR)/scripts/gen_json/gen_json.py
$(ECHO) "LVGL-JSON-GEN $@"
$(Q)mkdir -p $(dir $@)
$(ECHO) "#include \"$(LVGL_DIR)/lvgl.h\"\n#include \"$(LVGL_DIR)/src/lvgl_private.h\"" > $(LVGL_ALL_H)
$(Q)$(PYTHON) $(LVGL_DIR)/scripts/gen_json/gen_json.py --target-header $(LVGL_ALL_H) > $(LVGL_ALL_JSON)
else
$(LVGL_ALL_JSON):
$(ECHO) "LVGL-JSON-GEN $@"
$(Q)mkdir -p $(dir $@)
$(ECHO) "{}" > $(LVGL_ALL_JSON)
endif

$(LVGL_MPY): $(ALL_LVGL_SRC) $(LVGL_BINDING_DIR)/gen/gen_mpy.py $(LVGL_ALL_JSON)
$(ECHO) "LVGL-GEN $@"
$(Q)mkdir -p $(dir $@)
$(Q)$(CPP) $(CFLAGS_EXTMOD) -DPYCPARSER -x c -I $(LVGL_BINDING_DIR)/pycparser/utils/fake_libc_include $(INC) $(LVGL_DIR)/lvgl.h > $(LVGL_PP)
$(Q)$(PYTHON) $(LVGL_BINDING_DIR)/gen/gen_mpy.py -M lvgl -MP lv -MD $(LVGL_MPY_METADATA) -E $(LVGL_PP) $(LVGL_DIR)/lvgl.h > $@
$(Q)$(PYTHON) $(LVGL_BINDING_DIR)/gen/gen_mpy.py -M lvgl -MP lv -MD $(LVGL_MPY_METADATA) -E $(LVGL_PP) -J $(LVGL_ALL_JSON) $(LVGL_DIR)/lvgl.h > $@

.PHONY: LVGL_MPY
LVGL_ALL_JSON: $(LVGL_ALL_JSON)
LVGL_MPY: $(LVGL_MPY)

CFLAGS_EXTMOD += -Wno-unused-function
Expand Down
2 changes: 1 addition & 1 deletion lib/lv_bindings
Submodule lv_bindings updated 1 files
+15 −2 gen/gen_mpy.py
Loading