summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-10-10 15:56:16 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-10-11 12:40:27 +0000
commit0a85f4f834d499ee4b4560c92db7516db898b76b (patch)
tree4953ee52b0e3adb6eae5de8fa3a43f3ba52756fb /util/cmake/pro2cmake.py
parentecccb71d3dd49199d02fc462d69770546d7d3bd3 (diff)
pro2cmake: Handle simd assignments in scopes
Make sure to process simd assignments in scopes by enclosing the add_qt_simd calls into if blocks. Change-Id: I3c7f2466cfa5bb0136d40deffb190ea8aabfb572 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index d61a5d27d2..eaef854f32 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -2100,18 +2100,40 @@ def write_simd_part(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0):
"avx512common",
"avx512core",
]
+
+ simd_io_string = io.StringIO()
+
+ condition = "ON"
+ if scope.total_condition:
+ condition = map_to_cmake_condition(scope.total_condition)
+
+ if condition != "ON":
+ indent += 1
+
for simd in simd_options:
SIMD = simd.upper()
write_source_file_list(
- cm_fh,
+ simd_io_string,
scope,
"SOURCES",
[f"{SIMD}_HEADERS", f"{SIMD}_SOURCES", f"{SIMD}_C_SOURCES", f"{SIMD}_ASM"],
- indent,
+ indent=indent,
header=f"add_qt_simd_part({target} SIMD {simd}\n",
- footer=")\n\n",
+ footer=")\n",
)
+ simd_string = simd_io_string.getvalue()
+ if simd_string:
+ simd_string = simd_string.rstrip("\n")
+ cond_start = ""
+ cond_end = ""
+ if condition != "ON":
+ cond_start = f"{spaces(indent - 1)}if({condition})"
+ cond_end = f"{spaces(indent - 1)}endif()"
+
+ extend_scope = f"\n{cond_start}\n" f"{simd_string}" f"\n{cond_end}\n"
+ cm_fh.write(extend_scope)
+
def write_android_part(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0):
keys = [
@@ -2431,6 +2453,8 @@ def write_main_part(
write_android_part(cm_fh, name, c, indent=indent)
write_wayland_part(cm_fh, name, c, indent=indent)
write_extend_target(cm_fh, name, c, indent=indent)
+ write_simd_part(cm_fh, name, c, indent=indent)
+
ignored_keys_report = write_ignored_keys(c, spaces(indent))
if ignored_keys_report:
cm_fh.write(ignored_keys_report)