Skip to content

Cleanup lv_port_linux#73

Merged
kisvegabor merged 9 commits intolvgl:masterfrom
EDGEMTech:cleanup
Mar 17, 2025
Merged

Cleanup lv_port_linux#73
kisvegabor merged 9 commits intolvgl:masterfrom
EDGEMTech:cleanup

Conversation

@etag4048
Copy link
Contributor

Split backends into separate files, adding the capability of linking to multiple backends at once and select which one to use at runtime. This also avoids EXCESSIVE conditional compilation soup in main.c - it is irritating for a tool that I use daily.

The next step is to find a clean way of configuring CMAKE or GNU make based on the options found
in lv_conf.h

Copy link
Member

@kisvegabor kisvegabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I made a quick review, mainly to find formatting and naming issues.

@etag4048 etag4048 force-pushed the cleanup branch 2 times, most recently from 1898081 to 4e3ad17 Compare February 18, 2025 11:21
@etag4048
Copy link
Contributor Author

@kisvegabor I've adjusted the code.

@etag4048
Copy link
Contributor Author

For the failing CI see this : #74

@shaleh
Copy link

shaleh commented Feb 23, 2025

Parsing lv_conf.h for cmake could be a hassle. What if instead you made lv_conf.h.in and wrote out the desired values based on inputs to the initial cmake setup command? -DUSE_WAYLAND for instance.

Edited. Nevermind. I see EDGEMTech ran into the same thing I did with scripts/backend_conf not being run in the correct place. They fixed it by forcing the path in the script. I posted over in #57 (comment) that the ideal fix is passing in WORKING_DIRECTORY to execute_process.

This same idea could be replicated. Read out the value and update the CMake logic. I thought this could get ugly because I was thinking of running a compiled program with #ifdefs from the header.

@shaleh
Copy link

shaleh commented Feb 24, 2025

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19c08dd..321b0b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,10 @@
 cmake_minimum_required(VERSION 3.10)
 project(lvgl)
 
-
-set(CONF_PATH "${PROJECT_SOURCE_DIR}/lv_conf.h")
-
 foreach(BACKEND_NAME "SDL" "LINUX_DRM" "LINUX_FBDEV" "X11" "WAYLAND" "OPENGLES" "EVDEV")
-    execute_process(COMMAND "${PROJECT_SOURCE_DIR}/scripts/backend_conf.sh" ${BACKEND_NAME} ${CONF_PATH} OUTPUT_VARIABLE IS_BACKEND_ENABLED)
+    execute_process(COMMAND "scripts/backend_conf.sh" ${BACKEND_NAME}
+                    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+                    OUTPUT_VARIABLE IS_BACKEND_ENABLED)
     set("LV_USE_${BACKEND_NAME}" ${IS_BACKEND_ENABLED})
 endforeach()
 
diff --git a/scripts/backend_conf.sh b/scripts/backend_conf.sh
index ce1c721..750a3a3 100755
--- a/scripts/backend_conf.sh
+++ b/scripts/backend_conf.sh
@@ -1,15 +1,2 @@
 #!/bin/sh
-
-# Temporary solution called by CMake to determine what features
-# are enabled in lv_conf.h - This will replaced by a solution that can also
-# be used with GNU make or CMake
-# It also currently doesn't handle an alternate location for lv_conf.h
-# other than the one in repository
-
-if test $# -ne 2
-then
-    echo "usage: backend_conf.sh FEATURE_NAME lv_conf_path"
-    exit 1
-fi
-
-grep "^#define LV_USE_$1" "$2" | sed 's/#define //g' | awk '{ if ($2=="1") { printf "ON" } else { printf "OFF" }}'
+grep "^#define LV_USE_$1" lv_conf.h | sed 's/#define //g' | awk '{ if ($2=="1") { printf "ON" } else { printf "OFF" }}'

Avoid allocating lists of string, but instead move the functions to check if a backend exists
and print supported backends to driver_backends.c
@etag4048
Copy link
Contributor Author

@shaleh
I posted over in #57 (comment) that the ideal fix is passing in WORKING_DIRECTORY to execute_process.

Ok thanks for suggestion

@kisvegabor kisvegabor merged commit f7e469e into lvgl:master Mar 17, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants