build(cmake): fix installation when using private API (#10067)

This commit is contained in:
André Costa
2026-05-12 09:36:32 +02:00
committed by GitHub
parent fc4c7cee6a
commit 93bcda9271
5 changed files with 78 additions and 98 deletions
+56 -26
View File
@@ -13,36 +13,66 @@ concurrency:
jobs:
build-examples:
runs-on: ubuntu-24.04
strategy:
matrix:
api: [public, private]
steps:
- uses: actions/checkout@v6
- name: Generate lv_conf.h
run: |
python3 ./scripts/generate_lv_conf.py \
--template lv_conf_template.h \
--config lv_conf.h \
--defaults configs/ci/install/lv_conf.defaults
with:
fetch-depth: 0
- name: Install kconfig
run: pip install kconfiglib
- name: Build LVGL
run: |
cmake -B build -DCMAKE_INSTALL_PREFIX=$(pwd)/lvgl-install
cmake --build build -j$(nproc)
- name: Install LVGL
run: cmake --install build
defconfig configs/ci/install/${{ matrix.api }}_api_config
cmake -B build -GNinja -DLV_BUILD_USE_KCONFIG=ON
cmake --build build
cmake --install build --prefix lvgl-${{ matrix.api }}-install
- name: Build an application with the installed version of LVGL
- name: Generate Compilation Test Code
run: |
echo "#include <lvgl/lvgl.h>
#include <lvgl/lvgl.h>
#include <lvgl/demos/lv_demos.h>
#include <lvgl/examples/lv_examples.h>
int main(void) {
lv_init();
lv_example_label_1();
lv_demo_widgets();
while(1) {
lv_timer_handler();
}
return 0;
}" >> main.c
# We link with `g++` as thorvg (ThorVG library) contains C++ code that requires C++ runtime symbols
g++ main.c -o main -I$(pwd)/lvgl-install/include -L$(pwd)/lvgl-install/lib -llvgl_examples -llvgl_demos -llvgl -llvgl_thorvg -lm
if [ "${{ matrix.api }}" = "public" ]; then
echo "#include <lvgl/lvgl.h>
#include <lvgl/lvgl.h>
#include <lvgl/demos/lv_demos.h>
#include <lvgl/examples/lv_examples.h>
int main(void) {
lv_init();
lv_example_label_1();
lv_demo_widgets();
while(1) {
lv_timer_handler();
}
return 0;
}" >> main_${{ matrix.api }}.c
else
echo "#include <lvgl/lvgl.h>
#include <lvgl/lvgl.h>
#include <lvgl/demos/lv_demos.h>
#include <lvgl/examples/lv_examples.h>
#include <lvgl_private/lvgl_private.h>
int main(void) {
lv_init();
lv_example_label_1();
lv_demo_widgets();
lv_obj_destruct(lv_screen_active()); /*private*/
while(1) {
lv_timer_handler();
}
return 0;
}" >> main_${{ matrix.api }}.c
fi
- name: Compile Test Code
run: |
g++ main_${{ matrix.api }}.c -o main \
-I$(pwd)/lvgl-${{ matrix.api }}-install/include \
-L$(pwd)/lvgl-${{ matrix.api }}-install/lib \
-llvgl_examples \
-llvgl_demos \
-llvgl \
-llvgl_thorvg \
-lm
-68
View File
@@ -1,68 +0,0 @@
LV_COLOR_DEPTH 16
LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB
LV_USE_STDLIB_STRING LV_STDLIB_CLIB
LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB
# LV_USE_OS LV_OS_PTHREAD
# LV_DRAW_SW_DRAW_UNIT_CNT 2
# LV_DRAW_THREAD_STACK_SIZE (32 * 1024)
LV_USE_SYSMON 0
LV_USE_PERF_MONITOR 0
LV_USE_DRAW_SW_COMPLEX_GRADIENTS 1
LV_OBJ_STYLE_CACHE 1
LV_USE_LOG 1
LV_LOG_PRINTF 1
LV_USE_ASSERT_MEM_INTEGRITY 1
LV_USE_ASSERT_OBJ 1
LV_USE_ASSERT_STYLE 1
LV_FONT_MONTSERRAT_12 1
LV_FONT_MONTSERRAT_14 1
LV_FONT_MONTSERRAT_16 1
LV_FONT_MONTSERRAT_18 1
LV_FONT_MONTSERRAT_20 1
LV_FONT_MONTSERRAT_22 1
LV_FONT_MONTSERRAT_24 1
LV_FONT_MONTSERRAT_26 1
LV_FONT_MONTSERRAT_28 1
LV_FONT_MONTSERRAT_30 1
LV_FONT_MONTSERRAT_32 1
LV_FONT_MONTSERRAT_34 1
LV_FONT_MONTSERRAT_36 1
LV_FONT_MONTSERRAT_38 1
LV_FONT_MONTSERRAT_40 1
LV_FONT_MONTSERRAT_42 1
LV_FONT_MONTSERRAT_44 1
LV_FONT_MONTSERRAT_46 1
LV_FONT_MONTSERRAT_48 1
LV_FONT_MONTSERRAT_28_COMPRESSED 1
LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1
LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 1
LV_FONT_UNSCII_8 1
LV_FONT_FMT_TXT_LARGE 1
LV_USE_FS_STDIO 1
LV_FS_DEFAULT_DRIVER_LETTER 'A'
LV_FS_STDIO_LETTER 'A'
LV_USE_VECTOR_GRAPHIC 1
LV_USE_THORVG_INTERNAL 1
LV_USE_MATRIX 1
LV_USE_FLOAT 1
LV_USE_LOTTIE 1
LV_USE_IMGFONT 1
LV_USE_LZ4_INTERNAL 1
LV_USE_TINY_TTF 1
LV_USE_BARCODE 1
LV_USE_QRCODE 1
LV_USE_RLE 1
LV_BIN_DECODER_RAM_LOAD 1
LV_USE_TJPGD 1
LV_USE_BMP 1
LV_USE_LABEL 1
LV_USE_LODEPNG 1
LV_BUILD_EXAMPLES 1
LV_BUILD_DEMOS 1
LV_USE_DEMO_WIDGETS 1
+4
View File
@@ -0,0 +1,4 @@
CONFIG_LV_USE_PRIVATE_API=y
CONFIG_LV_USE_VECTOR_GRAPHIC=y
CONFIG_LV_USE_THORVG=y
CONFIG_LV_USE_DEMO_WIDGETS=y
+3
View File
@@ -0,0 +1,3 @@
CONFIG_LV_USE_VECTOR_GRAPHIC=y
CONFIG_LV_USE_THORVG=y
CONFIG_LV_USE_DEMO_WIDGETS=y
+15 -4
View File
@@ -319,10 +319,21 @@ install(
# Install private headers only if required
if(CONFIG_LV_USE_PRIVATE_API)
install(
DIRECTORY "${LVGL_ROOT_DIR}/src"
DESTINATION "${INC_INSTALL_DIR}"
FILES_MATCHING
PATTERN "*_private.h")
DIRECTORY "${LVGL_ROOT_DIR}/src/"
DESTINATION "${INC_INSTALL_DIR}/lvgl_private"
FILES_MATCHING PATTERN "*.h")
# In the source tree, `lvgl_public.h` includes the public API via "../include/lvgl/lvgl.h".
# When installed, `lvgl/` and `lvgl_private/` are siblings under `include/`, so the path
# is patched to "../lvgl/lvgl.h" to match the installed layout.
# No other changes are required to other files because the `lvgl_private` folder structure
# is the same as the one in `src` meaning that all other includes work, as long as all
# private header files always go through `lvgl_public.h` to include public API symbols
install(CODE "
file(READ \"\${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/lvgl_private/lvgl_public.h\" content)
string(REPLACE \"../include/lvgl/lvgl.h\" \"../lvgl/lvgl.h\" content \"\${content}\")
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/lvgl_private/lvgl_public.h\" \"\${content}\")
")
endif()
# When KConfig is used, copy the expanded conf header and rename it to lv_conf.h