Add support for QTQUICK_COMPILER_SKIPPED_RESOURCES
Detect this in the conversion script and map it to a source file property. When that's the case, avoid repeating the file list but instead store it in a variable. Change-Id: If3119d83914bb798766e27351746b4e867bd3ab3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
587581963e
commit
8ba882a0b3
@ -2425,7 +2425,7 @@ function(qt_quick_compiler_process_resources target resource_name)
|
|||||||
foreach(file IN LISTS arg_FILES)
|
foreach(file IN LISTS arg_FILES)
|
||||||
# check whether this resource should not be processed by the qt quick
|
# check whether this resource should not be processed by the qt quick
|
||||||
# compiler
|
# compiler
|
||||||
get_source_file_property(skip_compiler_check ${file} QT_QUICKCOMPILER_SKIPPED_RESOURCE)
|
get_source_file_property(skip_compiler_check ${file} QT_SKIP_QUICKCOMPILER)
|
||||||
if (skip_compiler_check)
|
if (skip_compiler_check)
|
||||||
list(APPEND resource_files ${file})
|
list(APPEND resource_files ${file})
|
||||||
continue()
|
continue()
|
||||||
|
@ -115,7 +115,7 @@ def find_qmake_conf(project_file_path: str = '') -> typing.Optional[str]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_file_path: str = '') -> str:
|
def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_file_path: str = '', skip_qtquick_compiler: bool = False) -> str:
|
||||||
assert(target)
|
assert(target)
|
||||||
|
|
||||||
# Hack to handle QT_SOURCE_TREE. Assume currently that it's the same
|
# Hack to handle QT_SOURCE_TREE. Assume currently that it's the same
|
||||||
@ -181,6 +181,14 @@ def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_fil
|
|||||||
output += 'set_source_files_properties("{}"\n' \
|
output += 'set_source_files_properties("{}"\n' \
|
||||||
' PROPERTIES alias "{}"\n)\n'.format(full_source, alias)
|
' PROPERTIES alias "{}"\n)\n'.format(full_source, alias)
|
||||||
|
|
||||||
|
if skip_qtquick_compiler:
|
||||||
|
file_list = '\n '.join(sorted_files)
|
||||||
|
output += 'set(resource_files\n {}\n)\n\n'.format(file_list)
|
||||||
|
file_list = "${resource_files}"
|
||||||
|
output += 'set_source_files_properties(${resource_files} QT_SKIP_QUICKCOMPILER 1)\n\n'
|
||||||
|
else:
|
||||||
|
file_list = '\n '.join(sorted_files)
|
||||||
|
|
||||||
params = ''
|
params = ''
|
||||||
if lang:
|
if lang:
|
||||||
params += ' LANG\n "{}"\n'.format(lang)
|
params += ' LANG\n "{}"\n'.format(lang)
|
||||||
@ -190,7 +198,7 @@ def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_fil
|
|||||||
params += ' BASE\n "{}"\n'.format(base_dir)
|
params += ' BASE\n "{}"\n'.format(base_dir)
|
||||||
output += 'add_qt_resource({} "{}"\n{} FILES\n {}\n)\n'.format(target, full_resource_name,
|
output += 'add_qt_resource({} "{}"\n{} FILES\n {}\n)\n'.format(target, full_resource_name,
|
||||||
params,
|
params,
|
||||||
'\n '.join(sorted_files))
|
file_list)
|
||||||
|
|
||||||
resource_count += 1
|
resource_count += 1
|
||||||
|
|
||||||
@ -1666,12 +1674,13 @@ def write_resources(cm_fh: typing.IO[str], target: str, scope: Scope, indent: in
|
|||||||
|
|
||||||
# Handle QRC files by turning them into add_qt_resource:
|
# Handle QRC files by turning them into add_qt_resource:
|
||||||
resources = scope.get_files('RESOURCES')
|
resources = scope.get_files('RESOURCES')
|
||||||
|
qtquickcompiler_skipped = scope.get_files('QTQUICK_COMPILER_SKIPPED_RESOURCES')
|
||||||
qrc_output = ''
|
qrc_output = ''
|
||||||
if resources:
|
if resources:
|
||||||
qrc_only = True
|
qrc_only = True
|
||||||
for r in resources:
|
for r in resources:
|
||||||
if r.endswith('.qrc'):
|
if r.endswith('.qrc'):
|
||||||
qrc_output += process_qrc_file(target, r, scope.basedir, scope.file_absolute_path)
|
qrc_output += process_qrc_file(target, r, scope.basedir, scope.file_absolute_path, r in qtquickcompiler_skipped)
|
||||||
else:
|
else:
|
||||||
qrc_only = False
|
qrc_only = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user