feat(cmake): disable PCPP by default (#8126)

This commit is contained in:
Erik Tagirov
2025-04-28 22:15:23 +02:00
committed by GitHub
parent 0040658e6a
commit 14bb5f2e6b
3 changed files with 72 additions and 39 deletions
+29 -8
View File
@@ -5,10 +5,12 @@
# 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()
@@ -29,6 +31,10 @@ def get_args():
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="Additionaly set the variables in the parent scope")
args = parser.parse_args()
# The input must exist
@@ -37,7 +43,15 @@ def get_args():
return args
def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool):
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='')
@@ -70,7 +84,7 @@ def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool):
name = name.replace("STDLIB", type)
fout.write(f'set({CONFIG_PREFIX}{name} 1)\n')
write_set_cmd(fout, f'{CONFIG_PREFIX}{name} 1', is_parent_scope)
# Treat the LV_USE_OS config in a special way, as we need
# to convert the define to full config with 1 value when enabled
@@ -87,11 +101,12 @@ def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool):
name += type
fout.write(f'set({CONFIG_PREFIX}{name} 1)\n')
write_set_cmd(fout, f'{CONFIG_PREFIX}{name} 1', is_parent_scope)
# For the rest of config, simply add CONFIG_ and write
# all LV_USE_* configs, as these are the one needed in cmake
elif line.startswith(f'{CONFIG_PATTERN}'):
# For the rest of the configs, simply add CONFIG_ and write the name of the define
# all LV_USE_* configs where the value is 0 or 1, as these are the one needed in cmake
# To detect the configuration of LVGL to perform conditional compilation/linking
elif re.search(f'{CONFIG_PATTERN}.* +[01] *$', line):
parts = line.split()
if len(parts) < 3:
@@ -100,10 +115,16 @@ def generate_cmake_variables(path_input: str, path_output: str, kconfig: bool):
name = parts[1]
value = parts[2].strip()
fout.write(f'set({CONFIG_PREFIX}{name} {value})\n')
write_set_cmd(fout, f'{CONFIG_PREFIX}{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)
generate_cmake_variables(args.input, args.output, args.kconfig, args.debug, args.parentscope)