Files
lvgl/scripts/generators/config_files.py
T
André Costa a73e59f6d1
Arduino Lint / lint (push) Waiting to run
Build Examples with C++ Compiler / build-examples (push) Waiting to run
MicroPython CI / Build esp32 port (push) Waiting to run
MicroPython CI / Build rp2 port (push) Waiting to run
MicroPython CI / Build stm32 port (push) Waiting to run
MicroPython CI / Build unix port (push) Waiting to run
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Waiting to run
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Waiting to run
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Waiting to run
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Waiting to run
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Waiting to run
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Waiting to run
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Waiting to run
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Waiting to run
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Waiting to run
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Waiting to run
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Waiting to run
C/C++ CI / Build ESP IDF ESP32S3 (push) Waiting to run
C/C++ CI / Run tests with 32bit build (push) Waiting to run
C/C++ CI / Run tests with 64bit build (push) Waiting to run
BOM Check / bom-check (push) Waiting to run
Verify GDB constants are up-to-date / verify-gdb-consts (push) Waiting to run
Verify the widget property name / verify-property-name (push) Waiting to run
Verify code formatting / verify-formatting (push) Waiting to run
Compare file templates with file names / template-check (push) Waiting to run
Code Generation / Code Generation (push) Waiting to run
Build Docs / build-and-deploy (push) Waiting to run
Build .deb packages / build (push) Waiting to run
Validate pkg-config and CMake config / cmake (linux) (push) Waiting to run
Validate pkg-config and CMake config / pkgconfig (linux) (push) Waiting to run
Validate pkg-config and CMake config / cmake (linux-3d) (push) Waiting to run
Validate pkg-config and CMake config / pkgconfig (linux-3d) (push) Waiting to run
Test API JSON generator / Test API JSON (push) Waiting to run
Install LVGL using CMake / build-examples (private) (push) Waiting to run
Install LVGL using CMake / build-examples (public) (push) Waiting to run
Check Makefile / Build using Makefile (push) Canceled after 0s
Check Makefile for UEFI / Build using Makefile for UEFI (push) Canceled after 0s
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Canceled after 0s
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Canceled after 0s
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Canceled after 0s
Hardware Performance Test / Hardware Performance Benchmark (push) Canceled after 0s
Hardware Performance Test / HW Benchmark - Save PR Number (push) Canceled after 0s
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Canceled after 0s
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Canceled after 0s
Port repo release update / run-release-branch-updater (push) Canceled after 0s
Static Checks / Static Checks (push) Canceled after 0s
Verify Font License / verify-font-license (push) Canceled after 0s
Verify Kconfig / verify-kconfig (push) Canceled after 0s
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Canceled after 0s
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Canceled after 0s
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Canceled after 0s
arch(config): split kconfig, add missing configs and generate lv_conf headers from it (#10292)
2026-07-16 08:30:55 +02:00

108 lines
2.8 KiB
Python

"""CLI: generate the LVGL configuration files.
python3 config_files.py
"""
from __future__ import annotations
import argparse
import os
from pathlib import Path
import sys
import re
from config_headers.emit import generate_bridge, generate_internal, generate_template
from config_headers.parse import load, parse_entries
SCRIPT_PATH = Path(__file__).resolve()
ROOT_FILES = [
"src/stdlib/Kconfig",
"src/osal/Kconfig",
"src/draw/Kconfig",
"src/indev/Kconfig",
"src/core/Kconfig",
"src/logging/Kconfig",
"src/themes/Kconfig",
"src/layouts/Kconfig",
"src/image/Kconfig",
"src/font/Kconfig",
"src/widgets/Kconfig",
"src/drivers/Kconfig",
"src/fs/Kconfig",
"src/debugging/Kconfig",
"src/others/Kconfig",
"env_support/kconfig/Kconfig.build",
"env_support/kconfig/Kconfig.compiler",
"examples/Kconfig",
"demos/Kconfig",
]
def parse_kconfig_content(path):
with open(path, "r") as f:
lines = f.readlines()
SOURCE_RE = re.compile(r'^(?!.*#.*\brsource\b)\s*rsource\s+"([^"]+)"')
content = []
for line in lines:
m = re.match(SOURCE_RE, line)
if not m:
content.append(line)
continue
relpath = m.group(1)
dir_name = os.path.dirname(path)
sourced_path = os.path.join(dir_name, relpath)
content.extend(parse_kconfig_content(sourced_path))
return content
def generate_kconfig_content(lvgl_root_dir):
content = ["# Generated file. DO NOT EDIT!\n\n"]
content += ['menu "LVGL"\n']
for root_file in ROOT_FILES:
abs_path = os.path.join(lvgl_root_dir, root_file)
content.extend(parse_kconfig_content(abs_path))
content += ['\nendmenu #"LVGL"\n']
return content
def main() -> int:
lvgl_root_dir = SCRIPT_PATH.parents[2]
lv_conf_template = os.path.join(lvgl_root_dir, "lv_conf_template.h")
lv_conf_internal = os.path.join(
lvgl_root_dir, "include", "lvgl", "config", "lv_conf_internal.h"
)
lv_conf_kconfig = os.path.join(
lvgl_root_dir, "include", "lvgl", "config", "lv_conf_kconfig.h"
)
if not "LVGL_DIR" in os.environ:
os.environ["LVGL_DIR"] = str(lvgl_root_dir)
kconfig_content = generate_kconfig_content(lvgl_root_dir)
kconfig_file_path = os.path.join(lvgl_root_dir, "Kconfig")
with open(kconfig_file_path, "w") as f:
f.writelines(kconfig_content)
kconf = load(kconfig_file_path)
entries = parse_entries(kconf)
with open(lv_conf_template, "w") as f:
f.write(generate_template(kconf, entries))
with open(lv_conf_internal, "w") as f:
f.write(generate_internal(kconf, entries))
with open(lv_conf_kconfig, "w") as f:
f.write(generate_bridge(kconf, entries))
return 0
if __name__ == "__main__":
raise SystemExit(main())