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. diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf index 0f983f059a..6a1b076d7d 100644 --- a/mkspecs/common/macx.conf +++ b/mkspecs/common/macx.conf @@ -22,6 +22,4 @@ device.deployment_identifier = $${device.sdk} QMAKE_LIBS_VULKAN = -DEFINES += GL_SILENCE_DEPRECATION - include(mac.conf) diff --git a/mkspecs/common/uikit.conf b/mkspecs/common/uikit.conf index 424381e285..0388b8e616 100644 --- a/mkspecs/common/uikit.conf +++ b/mkspecs/common/uikit.conf @@ -7,6 +7,4 @@ CONFIG += bitcode reduce_exports shallow_bundle no_qt_rpath INCLUDEPATH += $$PWD/uikit -DEFINES += GLES_SILENCE_DEPRECATION - include(mac.conf) diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 8df94aa4ee..421adcdaa0 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -62,6 +62,13 @@ contains(TEMPLATE, .*lib)|darwin { if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols } +# 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. +macos: DEFINES += GL_SILENCE_DEPRECATION +uikit: DEFINES += GLES_SILENCE_DEPRECATION + # The remainder of this file must not apply to host tools/libraries, # as the host compiler's version and capabilities are not checked. host_build:cross_compile: return()