Files
lvgl/scripts/build-tools/preprocess_lv_conf_internal.py
T
André Costa 066d8db0b5
Arduino Lint / lint (push) Canceled after 0s
Build Examples with C++ Compiler / build-examples (push) Canceled after 0s
MicroPython CI / Build esp32 port (push) Canceled after 0s
MicroPython CI / Build rp2 port (push) Canceled after 0s
MicroPython CI / Build stm32 port (push) Canceled after 0s
MicroPython CI / Build unix port (push) Canceled after 0s
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Canceled after 0s
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Canceled after 0s
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Canceled after 0s
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Canceled after 0s
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Canceled after 0s
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Canceled after 0s
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Canceled after 0s
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Canceled after 0s
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Canceled after 0s
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Canceled after 0s
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Canceled after 0s
C/C++ CI / Build ESP IDF ESP32S3 (push) Canceled after 0s
C/C++ CI / Run tests with 32bit build (push) Canceled after 0s
C/C++ CI / Run tests with 64bit build (push) Canceled after 0s
BOM Check / bom-check (push) Canceled after 0s
Verify GDB constants are up-to-date / verify-gdb-consts (push) Canceled after 0s
Verify the widget property name / verify-property-name (push) Canceled after 0s
Verify code formatting / verify-formatting (push) Canceled after 0s
Compare file templates with file names / template-check (push) Canceled after 0s
Code Generation / Code Generation (push) Canceled after 0s
Build Docs / build-and-deploy (push) Canceled after 0s
Build .deb packages / build (push) Canceled after 0s
Validate pkg-config and CMake config / cmake (linux) (push) Canceled after 0s
Validate pkg-config and CMake config / pkgconfig (linux) (push) Canceled after 0s
Validate pkg-config and CMake config / cmake (linux-3d) (push) Canceled after 0s
Validate pkg-config and CMake config / pkgconfig (linux-3d) (push) Canceled after 0s
Test API JSON generator / Test API JSON (push) Canceled after 0s
Install LVGL using CMake / build-examples (private) (push) Canceled after 0s
Install LVGL using CMake / build-examples (public) (push) Canceled after 0s
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) Skipped
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Skipped
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Skipped
build(cmake): remove python package dependencies for gcc/clang (#10400)
2026-07-30 15:19:11 +00:00

101 lines
2.7 KiB
Python
Executable File

#!/usr/bin/env python3
# Preprocess the lv_conf_internal.h to generate a header file containing the
# evaluated definitions. This output will be used to generate the cmake
# variables
#
# The C compiler of the build does the preprocessing. When it can't emit its
# #define directives - which is the case of MSVC - pcpp is used instead, if it
# is available
import argparse
import os
import subprocess
import lv_conf_header
import lv_conf_preprocess_cc as cc_backend
import lv_conf_preprocess_pcpp as pcpp_backend
def fatal(msg):
print()
print("ERROR! " + msg)
exit(1)
def get_args():
parser = argparse.ArgumentParser(
description="Expand the configuration of a C header file."
)
parser.add_argument(
"--input", help="Path to the input C header file", required=True
)
parser.add_argument(
"--tmp_file", help="Path to save the preprocessed output", required=True
)
parser.add_argument(
"--output", help="Path to save the expanded configuration header", required=True
)
parser.add_argument(
"--cc", help="C compiler used to preprocess the input", default=None
)
parser.add_argument(
"--defs",
nargs="+",
default=[],
help="Definitions to be passed to the preprocessor (flag -D)",
)
parser.add_argument(
"--include",
nargs="+",
default=[],
help="Paths to include directories for the preprocessor (flag -I)",
)
return parser.parse_args()
def select_backend(cc):
"""
Returns the name of the backend to use and a callable running it
"""
if cc_backend.is_available(cc):
return cc_backend.NAME, lambda *args: cc_backend.preprocess(cc, *args)
if pcpp_backend.is_available():
return pcpp_backend.NAME, pcpp_backend.preprocess
fatal(
f"'{cc}' can not expand the configuration.\n"
"Install pcpp to expand the configuration without the compiler, or set\n"
"the CONFIG_LV_* variables manually by disabling LV_BUILD_SET_CONFIG_OPTS"
)
def main():
args = get_args()
name, preprocess = select_backend(args.cc)
print(f"Expanding the configuration with {name}")
try:
preprocess(args.input, args.tmp_file, args.include, args.defs)
except (subprocess.CalledProcessError, RuntimeError, OSError) as e:
fatal(f"Preprocessing of {args.input} failed: {e}")
try:
lv_conf_header.generate(args.tmp_file, args.output, args.defs)
except OSError as e:
fatal(f"Writing {args.output} failed: {e}")
print(f"Expanded configuration header saved to {args.output}")
os.remove(args.tmp_file)
if __name__ == "__main__":
main()