CMake: pro2cmake: Fix handling of QT_SKIP_QUICKCOMPILER
If a file was part of a resource that has a non-empty base directory, the script generated set_source_files_properties calls to the file path without including the base dir, which means the command did nothing. The script should set the QT_SKIP_QUICKCOMPILER on the full file path if a base dir is present, similar to how the alias handled. Refactor the alias property writing code to write all properties into the command that uses the full correct path. Change-Id: Ic75d51ecf60eef3ada9bd6ca26882de3447896e9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
82cb1ecca2
commit
19b04f6928
@ -495,16 +495,34 @@ def write_add_qt_resource_call(
|
|||||||
|
|
||||||
assert sorted_files
|
assert sorted_files
|
||||||
|
|
||||||
|
if base_dir:
|
||||||
|
base_dir_expanded = scope.expandString(base_dir)
|
||||||
|
if base_dir_expanded:
|
||||||
|
base_dir = base_dir_expanded
|
||||||
|
|
||||||
|
source_file_properties = defaultdict(list)
|
||||||
|
|
||||||
for source in sorted_files:
|
for source in sorted_files:
|
||||||
|
full_source = posixpath.join(base_dir, source)
|
||||||
alias = files[source]
|
alias = files[source]
|
||||||
if alias:
|
if alias:
|
||||||
full_source = posixpath.join(base_dir, source)
|
source_file_properties[full_source].append(f'QT_RESOURCE_ALIAS "{alias}"')
|
||||||
|
# If a base dir is given, we have to write the source file property
|
||||||
|
# assignments that disable the quick compiler per file.
|
||||||
|
if base_dir and skip_qtquick_compiler:
|
||||||
|
source_file_properties[full_source].append('QT_SKIP_QUICKCOMPILER 1')
|
||||||
|
|
||||||
|
for full_source in source_file_properties:
|
||||||
|
per_file_props = source_file_properties[full_source]
|
||||||
|
if per_file_props:
|
||||||
|
prop_spaces = " "
|
||||||
|
per_file_props_joined = f'\n{prop_spaces}'.join(per_file_props)
|
||||||
output += dedent(
|
output += dedent(
|
||||||
f"""\
|
f"""\
|
||||||
set_source_files_properties("{full_source}"
|
set_source_files_properties("{full_source}"
|
||||||
PROPERTIES QT_RESOURCE_ALIAS "{alias}"
|
PROPERTIES {per_file_props_joined}
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
# Quote file paths in case there are spaces.
|
# Quote file paths in case there are spaces.
|
||||||
@ -525,7 +543,7 @@ def write_add_qt_resource_call(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
file_list = f"${{{resource_name}_resource_files}}"
|
file_list = f"${{{resource_name}_resource_files}}"
|
||||||
if skip_qtquick_compiler:
|
if skip_qtquick_compiler and not base_dir:
|
||||||
output += (
|
output += (
|
||||||
f"set_source_files_properties(${{{resource_name}_resource_files}}"
|
f"set_source_files_properties(${{{resource_name}_resource_files}}"
|
||||||
" PROPERTIES QT_SKIP_QUICKCOMPILER 1)\n\n"
|
" PROPERTIES QT_SKIP_QUICKCOMPILER 1)\n\n"
|
||||||
@ -539,15 +557,12 @@ def write_add_qt_resource_call(
|
|||||||
|
|
||||||
prefix_expanded = scope.expandString(prefix)
|
prefix_expanded = scope.expandString(prefix)
|
||||||
if prefix_expanded:
|
if prefix_expanded:
|
||||||
prefix = perfix_expanded
|
prefix = prefix_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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user