[Scummvm-git-logs] scummvm master -> 70f79d3df8b4a9d4c6d1b69838ff5a722c51b61e
criezy
criezy at scummvm.org
Sat Apr 25 23:34:23 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
70f79d3df8 MACOSX: Unset SDK version in executable
Commit: 70f79d3df8b4a9d4c6d1b69838ff5a722c51b61e
https://github.com/scummvm/scummvm/commit/70f79d3df8b4a9d4c6d1b69838ff5a722c51b61e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-26T00:33:42+01:00
Commit Message:
MACOSX: Unset SDK version in executable
This is a workaround for the blurry display we get on retina screen
when building with SDK 10.14 or above. Unsetting the SDK version
in the executable is sufficient to avoid the issue. See bug
similar change in LibreOffice.
The workaround can only be used with Xcode 11 or above. When using
configure it automatically detects if the workaround can be used.
The workaround is disabled by default in create_project and needs
to be enabled manually (uncomment the MACOSX_NO_SDKVERSION define
at the top of the xcode.cpp file).
Changed paths:
configure
devtools/create_project/xcode.cpp
diff --git a/configure b/configure
index 6657d0a63e..649ddb7a3f 100755
--- a/configure
+++ b/configure
@@ -2790,35 +2790,65 @@ case $_host_os in
fi
fi
- # When building for MacOS X 10.5 we need to use the legacy icon
- echocheck "macOS SDK target version at least 10.6"
- _macos_atleast_10_6=no
- cat > $TMPC << EOF
+ # Building with SDK 10.14+ causes blurry display on Retina screens.
+ # A workaround is to set the LC_VERSION_MIN_MACOSX load command's sdk value
+ # to n/a (i.e. 0.0). See bug #11430 for details.
+ echocheck "macOS deployement target"
+ _macos_min_version=undefined
+ for _macos_min_version_check in 1030 140 1050 1060 1070 1080 1090 101000 101100 101200 101300 101400 101500 101600; do
+ cat > $TMPC << EOF
#include "AvailabilityMacros.h"
-#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+#if MAC_OS_X_VERSION_MIN_REQUIRED > ${_macos_min_version_check}
error
#endif
int main(int argc, char *argv[]) { return 0; }
EOF
- cc_check && _macos_atleast_10_6=yes
- echo ${_macos_atleast_10_6}
- if test "$_macos_atleast_10_6" = no ; then
- add_line_to_config_mk 'MACOSX_USE_LEGACY_ICONS = 1'
+ cc_check
+ if test "$TMPR" -eq 0; then
+ _macos_min_version=$_macos_min_version_check
+ break
+ fi
+ done
+ # Also get a dot version of the min version
+ _macos_min_version_dot=undefined
+ if test "$_macos_min_version" != undefined ; then
+ if test "$_macos_min_version" -lt 101000; then
+ _macos_min_ver_major=$((${_macos_min_version}/100))
+ _macos_min_ver_minor=$((${_macos_min_version}/10 - 10*${_macos_min_ver_major}))
+ _macos_min_version_dot=${_macos_min_ver_major}.${_macos_min_ver_minor}
+ else
+ _macos_min_ver_major=$((${_macos_min_version}/10000))
+ _macos_min_ver_minor=$((${_macos_min_version}/100 - 100*${_macos_min_ver_major}))
+ _macos_min_version_dot=${_macos_min_ver_major}.${_macos_min_ver_minor}
+ fi
fi
-
- # When building with SDK 10.14 or above, we cannot compile the 32 bits dock plugin
- echocheck "macOS SDK target version at least 10.14"
- _macos_atleast_10_14=no
+ echo $_macos_min_version_dot
+
+ # Building with SDK 10.14+ causes blurry display on Retina screens.
+ # A workaround is to set the LC_VERSION_MIN_MACOSX load command's sdk value
+ # to n/a (i.e. 0.0). See bug #11430 for details.
+ # We do it in any case when the linker supports the -platform_version flag,
+ # even when using an older SDK.
+ echo_n "Checking if linker supports -platform_version... "
+ _macos_has_ld_platform_version=no
cat > $TMPC << EOF
-#include "AvailabilityMacros.h"
-#if !defined(MAC_OS_X_VERSION_10_14) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14
-error
-#endif
int main(int argc, char *argv[]) { return 0; }
EOF
- cc_check && _macos_atleast_10_14=yes
- echo ${_macos_atleast_10_14}
- if test "$_macos_atleast_10_14" = yes ; then
+ _macos_ldflags_platform_version="-Xlinker -platform_version -Xlinker macos -Xlinker $_macos_min_version_dot -Xlinker 0.0.0"
+ cc_check $_macos_ldflags_platform_version && _macos_has_ld_platform_version=yes
+ echo $_macos_has_ld_platform_version
+ if test "$_macos_has_ld_platform_version" = yes ; then
+ append_var LDFLAGS "$_macos_ldflags_platform_version"
+ fi
+
+ # When building for MacOS X 10.5 or below we need to use the legacy icon
+ if test "$_macos_min_version" != undefined -a "$_macos_min_version" -lt 1060 ; then
+ add_line_to_config_mk 'MACOSX_USE_LEGACY_ICONS = 1'
+ fi
+
+ # When building with SDK 10.14 or above, we cannot compile the 32 bits dock plugin
+ # Assume the SDK version is the same as the min version.
+ if test "$_macos_min_version" != undefined -a "$_macos_min_version" -gt 101399 ; then
add_line_to_config_mk 'MACOSX_64_BITS_ONLY = 1'
fi
diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp
index 68930a3ba5..f057339295 100644
--- a/devtools/create_project/xcode.cpp
+++ b/devtools/create_project/xcode.cpp
@@ -30,6 +30,11 @@
#include <sstream>
#include <iomanip>
#include <CommonCrypto/CommonCrypto.h>
+
+// If we want to unset the sdk version in the executable to work around bug #11430
+// (blury display on retina screens when building with SDK 10.14+).
+// This workaround only works with Xcode 11+.
+//#define MACOSX_NO_SDKVERSION
#endif
namespace CreateProjectTool {
@@ -1088,6 +1093,19 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
ADD_SETTING_LIST(scummvmOSX_Debug, "LIBRARY_SEARCH_PATHS", scummvmOSX_LibPaths, kSettingsNoQuote | kSettingsAsList, 5);
ADD_SETTING_QUOTE(scummvmOSX_Debug, "OTHER_CFLAGS", "");
ADD_SETTING(scummvmOSX_Debug, "PRODUCT_NAME", PROJECT_NAME);
+ ValueList scummvmOSX_LinkerFlags;
+#ifdef MACOSX_NO_SDKVERSION
+ scummvmOSX_LinkerFlags.push_back("-Xlinker");
+ scummvmOSX_LinkerFlags.push_back("-platform_version");
+ scummvmOSX_LinkerFlags.push_back("-Xlinker");
+ scummvmOSX_LinkerFlags.push_back("macos");
+ scummvmOSX_LinkerFlags.push_back("-Xlinker");
+ // Since the option can only be used with Xcode 11, assume the min version targetted is 10.14
+ scummvmOSX_LinkerFlags.push_back("10.14");
+ scummvmOSX_LinkerFlags.push_back("-Xlinker");
+ scummvmOSX_LinkerFlags.push_back("0.0.0");
+ ADD_SETTING_LIST(scummvmOSX_Debug, "OTHER_LDFLAGS", scummvmOSX_LinkerFlags, kSettingsAsList, 5);
+#endif
scummvmOSX_Debug_Object->addProperty("name", "Debug", "", kSettingsNoValue);
scummvmOSX_Debug_Object->_properties["buildSettings"] = scummvmOSX_Debug;
@@ -1101,6 +1119,9 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
ADD_SETTING(scummvmOSX_Release, "WRAPPER_EXTENSION", "app");
REMOVE_SETTING(scummvmOSX_Release, "DEBUG_INFORMATION_FORMAT");
ADD_SETTING_QUOTE(scummvmOSX_Release, "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym");
+#ifdef MACOSX_NO_SDKVERSION
+ ADD_SETTING_LIST(scummvmOSX_Release, "OTHER_LDFLAGS", scummvmOSX_LinkerFlags, kSettingsAsList, 5);
+#endif
scummvmOSX_Release_Object->addProperty("name", "Release", "", kSettingsNoValue);
scummvmOSX_Release_Object->_properties["buildSettings"] = scummvmOSX_Release;
More information about the Scummvm-git-logs
mailing list