CMake: pro2cmake expand variables for qt_add_resource()
Change-Id: Ida1196645dabcb0c3aee210d9bc5ee5632a9ccc5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
f38d5e563f
commit
a77cd07b24
@ -395,6 +395,7 @@ def get_cmake_api_call(api_name: str, api_version: Optional[int] = None) -> str:
|
|||||||
|
|
||||||
def process_qrc_file(
|
def process_qrc_file(
|
||||||
target: str,
|
target: str,
|
||||||
|
scope: Scope,
|
||||||
filepath: str,
|
filepath: str,
|
||||||
base_dir: str = "",
|
base_dir: str = "",
|
||||||
project_file_path: str = "",
|
project_file_path: str = "",
|
||||||
@ -461,6 +462,7 @@ def process_qrc_file(
|
|||||||
|
|
||||||
output += write_add_qt_resource_call(
|
output += write_add_qt_resource_call(
|
||||||
target,
|
target,
|
||||||
|
scope,
|
||||||
full_resource_name,
|
full_resource_name,
|
||||||
prefix,
|
prefix,
|
||||||
base_dir,
|
base_dir,
|
||||||
@ -477,6 +479,7 @@ def process_qrc_file(
|
|||||||
|
|
||||||
def write_add_qt_resource_call(
|
def write_add_qt_resource_call(
|
||||||
target: str,
|
target: str,
|
||||||
|
scope: Scope,
|
||||||
resource_name: str,
|
resource_name: str,
|
||||||
prefix: Optional[str],
|
prefix: Optional[str],
|
||||||
base_dir: str,
|
base_dir: str,
|
||||||
@ -534,11 +537,17 @@ def write_add_qt_resource_call(
|
|||||||
"PROPERTIES QT_RETAIN_QUICKCOMPILER 1)\n\n"
|
"PROPERTIES QT_RETAIN_QUICKCOMPILER 1)\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
prefix_expanded = scope.expandString(prefix)
|
||||||
|
if prefix_expanded:
|
||||||
|
prefix = perfix_expanded
|
||||||
params = ""
|
params = ""
|
||||||
if lang:
|
if lang:
|
||||||
params += f'{spaces(1)}LANG\n{spaces(2)}"{lang}"\n'
|
params += f'{spaces(1)}LANG\n{spaces(2)}"{lang}"\n'
|
||||||
params += f'{spaces(1)}PREFIX\n{spaces(2)}"{prefix}"\n'
|
params += f'{spaces(1)}PREFIX\n{spaces(2)}"{prefix}"\n'
|
||||||
if base_dir:
|
if base_dir:
|
||||||
|
base_dir_expanded = scope.expandString(base_dir)
|
||||||
|
if base_dir_expanded:
|
||||||
|
base_dir = base_dir_expanded
|
||||||
params += f'{spaces(1)}BASE\n{spaces(2)}"{base_dir}"\n'
|
params += f'{spaces(1)}BASE\n{spaces(2)}"{base_dir}"\n'
|
||||||
add_resource_command = ""
|
add_resource_command = ""
|
||||||
if is_example:
|
if is_example:
|
||||||
@ -2310,6 +2319,7 @@ def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0,
|
|||||||
continue
|
continue
|
||||||
qrc_output += process_qrc_file(
|
qrc_output += process_qrc_file(
|
||||||
target,
|
target,
|
||||||
|
scope,
|
||||||
r,
|
r,
|
||||||
scope.basedir,
|
scope.basedir,
|
||||||
scope.file_absolute_path,
|
scope.file_absolute_path,
|
||||||
@ -2341,6 +2351,7 @@ def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0,
|
|||||||
immediate_name = f"qmake_{r}"
|
immediate_name = f"qmake_{r}"
|
||||||
qrc_output += write_add_qt_resource_call(
|
qrc_output += write_add_qt_resource_call(
|
||||||
target=target,
|
target=target,
|
||||||
|
scope=scope,
|
||||||
resource_name=immediate_name,
|
resource_name=immediate_name,
|
||||||
prefix=immediate_prefix,
|
prefix=immediate_prefix,
|
||||||
base_dir=immediate_base,
|
base_dir=immediate_base,
|
||||||
@ -2378,6 +2389,7 @@ def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0,
|
|||||||
skip_qtquick_compiler = False
|
skip_qtquick_compiler = False
|
||||||
qrc_output += write_add_qt_resource_call(
|
qrc_output += write_add_qt_resource_call(
|
||||||
target=target,
|
target=target,
|
||||||
|
scope=scope,
|
||||||
resource_name=name,
|
resource_name=name,
|
||||||
prefix=prefix,
|
prefix=prefix,
|
||||||
base_dir=base,
|
base_dir=base,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user