From c0d8a070420d9cc72256e5efd7e05af99dc0f670 Mon Sep 17 00:00:00 2001 From: pengyiqiang Date: Thu, 12 Sep 2024 15:56:11 +0800 Subject: [PATCH] lvgl/Makefile: support multiple options for LV_OPTLEVEL This configuration is added to put LVGL into PSRAM for execution, and the lv_*.o file needs to be matched in the link script. Since LTO optimization will cause the file name to be modified, resulting in a matching failure, it will only take effect if LTO optimization is removed during compilation. Signed-off-by: pengyiqiang --- graphics/lvgl/CMakeLists.txt | 4 ++++ graphics/lvgl/Makefile | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/graphics/lvgl/CMakeLists.txt b/graphics/lvgl/CMakeLists.txt index 9ce3298f8..a55533409 100644 --- a/graphics/lvgl/CMakeLists.txt +++ b/graphics/lvgl/CMakeLists.txt @@ -117,6 +117,10 @@ if(CONFIG_GRAPHICS_LVGL) nuttx_add_dependencies(TARGET lvgl DEPENDS turbojpeg-static) endif() + if(NOT ${CONFIG_LV_OPTLEVEL} STREQUAL "") + add_compile_options(${CONFIG_LV_OPTLEVEL}) + endif() + set_property( TARGET nuttx APPEND diff --git a/graphics/lvgl/Makefile b/graphics/lvgl/Makefile index de23da9f0..03fdbe279 100644 --- a/graphics/lvgl/Makefile +++ b/graphics/lvgl/Makefile @@ -43,6 +43,13 @@ CFLAGS += "-DLV_PROFILER_BEGIN_TAG(str)=sched_note_beginex(NOTE_TAG_GRAPHICS, st CFLAGS += "-DLV_PROFILER_END_TAG(str)=sched_note_endex(NOTE_TAG_GRAPHICS, str)" endif +ifneq ($(CONFIG_LV_OPTLEVEL), "") +# Since multiple options need to be supported, subst needs to be used here to remove +# the redundant double quotes, otherwise it will cause command parsing errors. +CFLAGS += $(subst ",, $(CONFIG_LV_OPTLEVEL)) +CXXFLAGS += $(subst ",, $(CONFIG_LV_OPTLEVEL)) +endif + # Set up build configuration and environment WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'} @@ -78,11 +85,6 @@ ifeq ($(wildcard $(LVGL_UNPACKNAME)/.git),) context:: $(LVGL_UNPACKNAME) endif -ifneq ($(CONFIG_LV_OPTLEVEL), "") -CFLAGS += $(CONFIG_LV_OPTLEVEL) -CXXFLAGS += $(CONFIG_LV_OPTLEVEL) -endif - include $(APPDIR)/Application.mk ifeq ($(wildcard $(LVGL_UNPACKNAME)/.git),)