You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/18 19:46:41 UTC

(nuttx-apps) 02/02: lvgl/Makefile: support multiple options for LV_OPTLEVEL

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit c0d8a070420d9cc72256e5efd7e05af99dc0f670
Author: pengyiqiang <pe...@xiaomi.com>
AuthorDate: Thu Sep 12 15:56:11 2024 +0800

    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 <pe...@xiaomi.com>
---
 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),)