diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-01 13:40:11 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-02 10:27:58 +0200 |
commit | 1048d83fc29d77e7a8def35ba41454fe35f4747b (patch) | |
tree | 0a2af902cc2d4fe7a5b9024d6b844c5cbf0e0754 /cmake | |
parent | 6ff79478a44fce12ca18832a56db4a370a9ff417 (diff) |
Limit OpenGL deprecation silencing on Apple platform to Qt itself
Apple deprecated the entire OpenGL API in favor of Metal, which
we are aware of, so we don't need to see the warnings when building
Qt.
Instead of applying the silencing globally for all Qt consumers,
both internal and external, we now limit the silencing to Qt itself.
That means user code that explicitly uses any of the deprecated APIs
will see the warnings. Note that this does not apply to merely using
any of the Qt OpenGL APIs. The user has to explicitly use the platform
APIs that have been deprecated.
The warnings need to be disabled on a build system level, so that
that they are passed as -D flags on the command line. If the defines
were done in Qt headers (qguiglobal.h e.g.), they would require the
user to always include this header before any of the Apple headers.
Change-Id: I3f2a2a5211332a059ad4416394251772c677fdcb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 5 | ||||
-rw-r--r-- | cmake/QtInternalTargets.cmake | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index bde23072ea..cc5020fd9b 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -294,11 +294,6 @@ elseif(ANDROID) endif() elseif(APPLE) set(QT_DEFAULT_MKSPEC macx-clang) - if(MACOS) - list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS GL_SILENCE_DEPRECATION) - elseif(UIKIT) - list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS GLES_SILENCE_DEPRECATION) - endif() elseif(EMSCRIPTEN) set(QT_DEFAULT_MKSPEC wasm-emscripten) endif() diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 6eb4bd96f9..00a4ad6f75 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -123,6 +123,16 @@ function(qt_internal_apply_bitcode_flags target) target_compile_options("${target}" INTERFACE ${bitcode_flags}) endfunction() +# Apple deprecated the entire OpenGL API in favor of Metal, which +# we are aware of, so silence the deprecation warnings in code. +# This does not apply to user-code, which will need to silence +# their own warnings if they use the deprecated APIs explicitly. +if(MACOS) + target_compile_definitions(PlatformCommonInternal INTERFACE GL_SILENCE_DEPRECATION) +elseif(UIKIT) + target_compile_definitions(PlatformCommonInternal INTERFACE GLES_SILENCE_DEPRECATION) +endif() + if(UIKIT) # Do what mkspecs/features/uikit/default_pre.prf does, aka enable sse2 for # simulator_and_device_builds. |