build(cmake): support external dependency fetching (#9887)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify GDB constants are up-to-date / verify-gdb-consts (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled

This commit is contained in:
André Costa
2026-03-24 06:56:00 +01:00
committed by GitHub
parent 012c98793d
commit 68b4ea45ef
25 changed files with 1106 additions and 8 deletions
+69
View File
@@ -171,6 +171,54 @@ To enable the demos and examples set these options:
set(CONFIG_LV_BUILD_DEMOS ON)
add_subdirectory(lvgl)
.. _dependency_management_cmake:
Dependency Management
---------------------
When ``LV_BUILD_SET_CONFIG_OPTS`` is enabled, LVGL can automatically resolve, and optionally fetch,
the dependencies required by the features enabled in ``lv_conf.h``. For example, enabling
``LV_USE_WAYLAND`` in ``lv_conf.h`` will cause LVGL to find or fetch the Wayland libraries
automatically.
Dependency resolution is attempted in this order:
1. ``find_package`` — uses CMake's built-in package discovery
2. ``pkg-config`` — uses the system's pkg-config tool (Linux/macOS)
3. ``FetchContent`` — fetches and builds the dependency from source
Each strategy can be disabled globally or per dependency. This is particularly useful for
cross-compilation environments where system libraries should not be used.
Disabling system resolution globally (e.g. for cross-compilation):
.. code-block:: bash
cmake -DLV_USE_FIND_PACKAGE=OFF -DLV_USE_PKG_CONFIG=OFF ..
Disabling system resolution for a specific dependency only:
.. code-block:: bash
cmake -DLV_USE_FIND_PACKAGE_FREETYPE=OFF -DLV_USE_PKG_CONFIG_FREETYPE=OFF ..
Disabling automatic fetching from source:
.. code-block:: bash
cmake -DLV_FETCH_DEPENDENCIES=OFF ..
Fetched dependency sources are cached in the ``.deps`` directory at the root of your project,
so they are not re-downloaded between builds.
.. note::
Dependency management requires ``CONFIG_LV_*`` variables to be set (e.g. ``CONFIG_LV_USE_WAYLAND``).
These can be set manually via ``-D`` arguments or generated automatically by enabling
``LV_BUILD_SET_CONFIG_OPTS``, which parses ``lv_conf_internal.h`` to derive them.
Below is a list of the available options/variables
.. list-table::
@@ -209,6 +257,27 @@ Below is a list of the available options/variables
``CONFIG_LV_BUILD_*`` CMake variables based on the contents of ``lv_conf_internal.h``.
This requires python3 with ``venv`` and ``pip`` or access to a working ``pcpp``.
If KConfig is used, this is enabled automatically.
* - LV_USE_FIND_PACKAGE
- BOOLEAN
- Allow resolving dependencies via ``find_package``. Enabled by default.
* - LV_USE_PKG_CONFIG
- BOOLEAN
- Allow resolving dependencies via ``pkg-config``. Enabled by default. Requires pkg-config to be installed.
* - LV_FETCH_DEPENDENCIES
- BOOLEAN
- Fetch dependencies from source if not found on the system. Enabled by default.
* - LV_USE_FIND_PACKAGE_<DEP>
- BOOLEAN
- Allow resolving a specific dependency via ``find_package``. Defaults to ``LV_USE_FIND_PACKAGE``.
Example: ``LV_USE_FIND_PACKAGE_FREETYPE``.
* - LV_USE_PKG_CONFIG_<DEP>
- BOOLEAN
- Allow resolving a specific dependency via ``pkg-config``. Defaults to ``LV_USE_PKG_CONFIG``.
Example: ``LV_USE_PKG_CONFIG_FREETYPE``.
* - LV_FETCH_<DEP>
- BOOLEAN
- Fetch a specific dependency from source. Defaults to ``LV_FETCH_DEPENDENCIES``.
Example: ``LV_FETCH_FREETYPE``.
* - CONFIG_LV_BUILD_DEMOS
- BOOLEAN
- When enabled builds the demos