forked from lvgl/lv_binding_micropython
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unix: Enable lv_binding_micropython as user C mod.
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
################################################################################ | ||
# LVGL unix optional libraries | ||
# Update CFLAGS_EXTMOD and LDFLAGS_EXTMOD for LVGL extenral library, | ||
# but do that only on the unix port, for unix specific dependencies | ||
|
||
ifneq ($(UNAME_S),Darwin) | ||
CFLAGS_EXTMOD += -DMICROPY_FB=1 | ||
endif | ||
|
||
SDL_CFLAGS_EXTMOD := $(shell pkg-config --silence-errors --cflags sdl2) | ||
SDL_LDFLAGS_EXTMOD := $(shell pkg-config --silence-errors --libs sdl2) | ||
ifneq ($(SDL_LDFLAGS_EXTMOD),) | ||
CFLAGS_EXTMOD += $(SDL_CFLAGS_EXTMOD) -DMICROPY_SDL=1 | ||
LDFLAGS_EXTMOD += $(SDL_LDFLAGS_EXTMOD) | ||
endif | ||
|
||
RLOTTIE_CFLAGS_EXTMOD := $(shell pkg-config --silence-errors --cflags rlottie) | ||
RLOTTIE_LDFLAGS_EXTMOD := $(shell pkg-config --silence-errors --libs rlottie) | ||
ifneq ($(RLOTTIE_LDFLAGS_EXTMOD),) | ||
CFLAGS_EXTMOD += $(RLOTTIE_CFLAGS_EXTMOD) -DMICROPY_RLOTTIE=1 | ||
LDFLAGS_EXTMOD += $(RLOTTIE_LDFLAGS_EXTMOD) | ||
endif | ||
|
||
FREETYPE_CFLAGS_EXTMOD := $(shell pkg-config --silence-errors --cflags freetype2) | ||
FREETYPE_LDFLAGS_EXTMOD := $(shell pkg-config --silence-errors --libs freetype2) | ||
ifneq ($(FREETYPE_LDFLAGS_EXTMOD),) | ||
CFLAGS_EXTMOD += $(FREETYPE_CFLAGS_EXTMOD) -DMICROPY_FREETYPE=1 | ||
LDFLAGS_EXTMOD += $(FREETYPE_LDFLAGS_EXTMOD) | ||
endif | ||
|
||
FFMPEG_LIBS := libavformat libavcodec libswscale libavutil | ||
FFMPEG_CFLAGS_EXTMOD := $(shell pkg-config --silence-errors --cflags $(FFMPEG_LIBS)) | ||
FFMPEG_LDFLAGS_EXTMOD := $(shell pkg-config --silence-errors --libs $(FFMPEG_LIBS)) | ||
ifneq ($(FFMPEG_LDFLAGS_EXTMOD),) | ||
CFLAGS_EXTMOD += $(FFMPEG_CFLAGS_EXTMOD) -DMICROPY_FFMPEG=1 | ||
LDFLAGS_EXTMOD += $(FFMPEG_LDFLAGS_EXTMOD) | ||
endif | ||
|
||
################################################################################ | ||
|
||
# LVGL build rules | ||
|
||
|
||
LVGL_BINDING_DIR := $(USERMOD_DIR) | ||
|
||
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_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 | ||
$(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 > $@ | ||
|
||
.PHONY: LVGL_MPY | ||
LVGL_MPY: $(LVGL_MPY) | ||
|
||
CFLAGS_EXTMOD += -Wno-unused-function | ||
CFLAGS_EXTRA += -Wno-unused-function | ||
SRC_THIRDPARTY_C += $(subst $(TOP)/,,$(shell find $(LVGL_DIR)/src $(LVGL_DIR)/examples $(LVGL_GENERIC_DRV_DIR) -type f -name "*.c")) | ||
SRC_EXTMOD_C += $(LVGL_MPY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module("evdev.py", base_path="../../driver/linux") | ||
module("lv_timer.py", base_path="../../driver/linux") | ||
module("display_driver_utils.py", base_path="../../lib") | ||
module("display_driver.py", base_path="../../lib") | ||
module("fs_driver.py", base_path="../../lib") | ||
module("lv_utils.py", base_path="../../lib") |