From c8299de8960fbe920cc12d6a7930b1334d612570 Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Fri, 16 Jun 2023 23:48:55 +0300 Subject: [PATCH] Move unix specific build rules --- extmod/extmod.mk | 37 ------------------------------------- ports/unix/Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/extmod/extmod.mk b/extmod/extmod.mk index 4d6971af7c16..0cc12052f867 100644 --- a/extmod/extmod.mk +++ b/extmod/extmod.mk @@ -368,43 +368,6 @@ endif endif ################################################################################ -# LVGL - -# Additional optional libraries - -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 = $(TOP)/lib/lv_bindings diff --git a/ports/unix/Makefile b/ports/unix/Makefile index a4ea5bca2515..7e4c50ebd41e 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -193,6 +193,46 @@ ifeq ($(MICROPY_PY_JNI),1) CFLAGS += -I/usr/lib/jvm/java-7-openjdk-amd64/include -DMICROPY_PY_JNI=1 endif +################################################################################ +# 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 + +################################################################################ + # source files SRC_C += \ main.c \