summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-03-11 15:09:33 +0100
committerTobias Hunger <tobias.hunger@qt.io>2019-03-18 11:37:47 +0000
commit6e16f127ad4f1bf8f8191b72be12aa20785d816c (patch)
tree57c60fade7d769b2ab483f937bc24ba530262788 /util
parentd48160be9e752833ab3658d1e7f50b49b60f1a85 (diff)
CMake: pro2cmake.py: Handle SIMD sources
Change-Id: Ib445888e769432e8c247ae2d2fb5d8af2d5cd275 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 7abb8f5a1c..37ead10513 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -1208,6 +1208,30 @@ def merge_scopes(scopes: typing.List[Scope]) -> typing.List[Scope]:
return result
+def write_simd_part(cm_fh: typing.IO[str], target: str, scope: Scope, indent: int = 0):
+ simd_options = [ 'sse2', 'sse3', 'ssse3', 'sse4_1', 'sse4_2', 'aesni', 'shani', 'avx', 'avx2',
+ 'avx512f', 'avx512cd', 'avx512er', 'avx512pf', 'avx512dq', 'avx512bw',
+ 'avx512vl', 'avx512ifma', 'avx512vbmi', 'f16c', 'rdrnd', 'neon', 'mips_dsp',
+ 'mips_dspr2',
+ 'arch_haswell', 'avx512common', 'avx512core'];
+ ind = spaces(indent)
+
+ for simd in simd_options:
+ SIMD = simd.upper();
+ sources = scope.get('{}_HEADERS'.format(SIMD), []) \
+ + scope.get('{}_SOURCES'.format(SIMD), []) \
+ + scope.get('{}_C_SOURCES'.format(SIMD), []) \
+ + scope.get('{}_ASM'.format(SIMD), [])
+
+ if not sources:
+ continue
+
+ cm_fh.write('{}add_qt_simd_part({} SIMD {}\n'.format(ind, target, simd))
+ cm_fh.write('{} SOURCES\n'.format(ind))
+ cm_fh.write('{} {}\n'.format(ind, '\n{} '.format(ind).join(sources)))
+ cm_fh.write('{})\n\n'.format(ind))
+
+
def write_main_part(cm_fh: typing.IO[str], name: str, typename: str,
cmake_function: str, scope: Scope, *,
extra_lines: typing.List[str] = [],
@@ -1243,6 +1267,8 @@ def write_main_part(cm_fh: typing.IO[str], name: str, typename: str,
write_resources(cm_fh, name, scope, indent)
+ write_simd_part(cm_fh, name, scope, indent)
+
# Scopes:
if len(scopes) == 1:
return