aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/configure.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-04-01 14:03:55 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-04-03 19:07:28 +0200
commitfcbb78808eea5672f12deb3f15c1fcbf9f0fbdaf (patch)
tree78502b183038662037fb2f937f837a9e1c4aa62b /src/qml/configure.cmake
parent76a7c93f9b860e2f6fde2198edde19a5d704a97f (diff)
CMake: Disable JIT for arm64 when doing macOS universal builds
Our current approach to building universal macOS Qt is to pass 2 -arch flags to clang, which underneath spawn 2 clang invocations with each separate arch and lipo-s the result together. This approah also meanss that we do only one set of config tests for the main (first) architecture. Currently Qml doesn't support JITing for macOS on Apple Silicon (arm64), but if the first architecture is x86_64, the qml_jit feature will be set to 'true', and cause compilation errors when trying to build the arm slice of the jit source files. To circumvent that, and allow skipping compilation of JIT specific code, we have to apply the same trick we do in qtbase, which is to set a compile definition that takes the current architecture into account, and surround all relevant code with an #if block taking to account both the feature and current architecture. Use a custom hacky qt_extra_definition call to redefine the value of QT_FEATURE_qml_jit based on the original feature value and the current architecture. Additionally, surround the jit source files with #if QT_CONFIG(qml_jit). Amends 561a2cec9b95b22783a00b48078b532010357066 Task-number: QTBUG-85447 Change-Id: I28b286d218333076223177c456175f180888a667 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/configure.cmake')
-rw-r--r--src/qml/configure.cmake24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qml/configure.cmake b/src/qml/configure.cmake
index abab0ee731..6f6cef2e58 100644
--- a/src/qml/configure.cmake
+++ b/src/qml/configure.cmake
@@ -134,6 +134,30 @@ qt_feature("qml-jit" PRIVATE
AUTODETECT NOT IOS AND NOT TVOS
CONDITION ( ( ( TEST_architecture_arch STREQUAL i386 ) AND TEST_pointer_32bit AND QT_FEATURE_sse2 ) OR ( ( TEST_architecture_arch STREQUAL x86_64 ) AND TEST_pointer_64bit AND QT_FEATURE_sse2 ) OR ( ( TEST_architecture_arch STREQUAL arm ) AND TEST_pointer_32bit AND TEST_arm_fp AND TEST_arm_thumb AND ( LINUX OR IOS OR TVOS OR QNX ) ) OR ( ( TEST_architecture_arch STREQUAL arm64 ) AND TEST_pointer_64bit AND TEST_arm_fp AND ( LINUX OR IOS OR TVOS OR QNX OR INTEGRITY ) ) )
)
+# special case begin
+# When doing macOS universal builds, JIT needs to be disabled for the ARM slice.
+# Because both arm and x86_64 slices are built in one clang frontend invocation
+# we need this hack to ensure each backend invocation sees the correct value
+# of the feature definition.
+qt_extra_definition("QT_QML_JIT_SUPPORTED_IMPL" "0
+// Unset dummy value
+#undef QT_QML_JIT_SUPPORTED_IMPL
+// Compute per-arch value and save in extra define
+#if QT_CONFIG(qml_jit) && !(defined(Q_OS_MACOS) && defined(Q_PROCESSOR_ARM))
+#define QT_QML_JIT_SUPPORTED_IMPL 1
+#else
+#define QT_QML_JIT_SUPPORTED_IMPL 0
+#endif
+// Unset original feature value
+#undef QT_FEATURE_qml_jit
+// Set new value based on previous computation
+#if QT_QML_JIT_SUPPORTED_IMPL
+#define QT_FEATURE_qml_jit 1
+#else
+#define QT_FEATURE_qml_jit -1
+#endif
+" PRIVATE)
+# special case end
qt_feature("qml-debug" PUBLIC
SECTION "QML"
LABEL "QML debugging and profiling support"