mirror of
https://github.com/lvgl/lvgl.git
synced 2026-08-17 18:22:42 +08:00
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
113 lines
4.1 KiB
Python
Executable File
113 lines
4.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
#
|
|
# Generate the cmake variables CONFIG_LV_USE_* or CONFIG_LV_BUILD_* from the
|
|
# preprocessed lv_conf_internal.h
|
|
#
|
|
# Author: David TRUAN (david.truan@edgemtech.ch)
|
|
# Author: Erik Tagirov (erik.tagirov@edgemtech.ch)
|
|
#
|
|
|
|
import os
|
|
import argparse
|
|
import re
|
|
|
|
def fatal(msg):
|
|
print()
|
|
print("ERROR! " + msg)
|
|
exit(1)
|
|
|
|
def get_args():
|
|
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=""
|
|
"Convert the expanded lv_conf_internal.h to cmake variables."
|
|
"It converts all LV_USE_*, LV_BUILD_* configurations."
|
|
)
|
|
|
|
parser.add_argument('--input', type=str, required=True, nargs='?',
|
|
help='Path of the macro expanded lv_conf_internal.h, which should be generated during a cmake build')
|
|
|
|
parser.add_argument('--output', type=str, required=True, nargs='?',
|
|
help='Path of the output file, where the cmake variables declaration will be written (ex: build/lv_conf.cmake)')
|
|
|
|
parser.add_argument("--kconfig", action="store_true", help="Enable kconfig flag")
|
|
|
|
parser.add_argument("--debug", action="store_true", required=False, help="Show unhandled expressions")
|
|
|
|
parser.add_argument("--parentscope", action="store_true", required=False, help="Additionally set the variables in the parent scope")
|
|
|
|
args = parser.parse_args()
|
|
|
|
# The input must exist
|
|
if not os.path.exists(args.input):
|
|
fatal(f"Input {args.input} not found")
|
|
|
|
return args
|
|
|
|
def write_set_cmd(fout, expr, is_parent_scope):
|
|
|
|
fout.write(f'set({expr})\n')
|
|
|
|
# This makes the variable usable from the top level directory
|
|
if is_parent_scope == True:
|
|
fout.write(f'set({expr} PARENT_SCOPE)\n')
|
|
|
|
def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool, debug: bool, is_parent_scope: bool):
|
|
fin = open(path_input)
|
|
fout = open(path_output, "w", newline='')
|
|
|
|
BARE_PATTERN = "^#define +(LV_USE|LV_BUILD|LV_[0-9A-Z_]+_USE)"
|
|
|
|
if kconfig:
|
|
# If we use Kconfig, we must check for CONFIG_LV_USE_* and
|
|
# CONFIG_LV_BUILD_* defines
|
|
CONFIG_PATTERN = "^#define +(CONFIG_LV_USE|CONFIG_LV_BUILD|CONFIG_LV_[0-9A-Z_]+_USE)"
|
|
CONFIG_PREFIX = ""
|
|
else:
|
|
# Otherwise check the LV_USE_* and LV_BUILD_* defines
|
|
CONFIG_PATTERN = BARE_PATTERN
|
|
CONFIG_PREFIX = "CONFIG_"
|
|
|
|
|
|
# Using the expanded lv_conf_internal, we don't have to deal with regexp,
|
|
# as all the #define will be aligned on the left with a single space before the value
|
|
for line in fin.read().splitlines():
|
|
|
|
# For the rest of the configs, simply add CONFIG_ and write the name of the define
|
|
# all LV_USE_* or LV_BUILD_* configs where the value is 0 or 1,
|
|
# as these are the ones that are needed in cmake
|
|
# To detect the configuration of LVGL to perform conditional compilation/linking
|
|
if re.search(f'{CONFIG_PATTERN}.* +[01] *$', line):
|
|
|
|
parts = line.split()
|
|
if len(parts) < 3:
|
|
continue
|
|
|
|
name = parts[1]
|
|
value = parts[2].strip()
|
|
|
|
write_set_cmd(fout, f'{CONFIG_PREFIX}{name} {value}', is_parent_scope)
|
|
|
|
# When using kconfig: catch bare LV_* defines with a literal 0/1 value
|
|
# that aren't backed by Kconfig (value is not a CONFIG_* reference)
|
|
elif kconfig and re.search(f'{BARE_PATTERN}.* +[01] *$', line):
|
|
parts = line.split()
|
|
if len(parts) < 3:
|
|
continue
|
|
|
|
name = parts[1]
|
|
value = parts[2].strip()
|
|
# Export with CONFIG_ prefix so it's consistent with kconfig-backed vars
|
|
write_set_cmd(fout, f'CONFIG_{name} {value}', is_parent_scope)
|
|
|
|
else:
|
|
# Useful for debugging expressions that are unhandled,
|
|
# if the script fails in 'unexpected ways'
|
|
if debug == True:
|
|
print(f"DBG: Skipping expression: '{line} - not handled'")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
args = get_args()
|
|
|
|
generate_cmake_variables(args.input, args.output, args.kconfig, args.debug, args.parentscope)
|