diff --git a/CraftSettings.ini.template b/CraftSettings.ini.template --- a/CraftSettings.ini.template +++ b/CraftSettings.ini.template @@ -21,6 +21,12 @@ ## This is an expert option, do not touch it unless you know exactly what it means. #MSVCToolset=14.16 +## Set the minimum supported MacOs version, this is also limited by Qt +## 10.13 https://github.com/qt/qtbase/blob/5.14/mkspecs/common/macx.conf#L8 +## 10.12 https://github.com/qt/qtbase/blob/5.13/mkspecs/common/macx.conf#L8 +## 10.12 https://github.com/qt/qtbase/blob/5.12/mkspecs/common/macx.conf#L8 +#MacDeploymentTarget = 10.13 + ## This option can be used to enable a notification backend. ## As soon as the buildprocess of a project has finished a notification will be displayed. ## Possible Backends: diff --git a/bin/BuildSystem/CMakeBuildSystem.py b/bin/BuildSystem/CMakeBuildSystem.py --- a/bin/BuildSystem/CMakeBuildSystem.py +++ b/bin/BuildSystem/CMakeBuildSystem.py @@ -59,9 +59,6 @@ if OsUtils.isMac(): options += f" -DKDE_INSTALL_BUNDLEDIR=\"{OsUtils.toUnixPath(CraftCore.standardDirs.craftRoot())}/Applications/KDE\" -DAPPLE_SUPPRESS_X11_WARNING=ON" - if CraftCore.compiler.macUseSDK: - # Ensure that we don't depend on SDK features only present on newer systems - options += " -DCMAKE_OSX_DEPLOYMENT_TARGET=" + CraftCore.compiler.macOSDeploymentTarget if CraftCore.compiler.isWindows or CraftCore.compiler.isMacOS: options += " -DKDE_INSTALL_USE_QT_SYS_PATHS=ON" diff --git a/bin/CraftCompiler.py b/bin/CraftCompiler.py --- a/bin/CraftCompiler.py +++ b/bin/CraftCompiler.py @@ -157,17 +157,6 @@ result = "i686-w64-mingw32" return result - @property - def macOSDeploymentTarget(self) -> str: - assert self.macUseSDK - return "10.11" - - @property - def macUseSDK(self) -> bool: - assert self.isMacOS - """Whether to compile against the macOS SDK instead of the libraries in /usr (off by default)""" - return CraftCore.settings.getboolean("MacSDK", "Enabled", "False") - @property def isWindows(self) -> bool: return self.platform == CraftCompiler.Platforms.Windows @@ -323,8 +312,4 @@ if CraftCore.compiler.isGCCLike(): print("Compiler Version: %s" % CraftCore.compiler.getGCCLikeVersion(CraftCore.compiler.compiler.name)) if CraftCore.compiler.isGCC(): - print("Compiler Target: %s" % CraftCore.compiler._getGCCTarget()) - if CraftCore.compiler.isMacOS: - print("Using SDK for macOS:", CraftCore.compiler.macUseSDK) - if CraftCore.compiler.macUseSDK: - print("macOS SDK deployment target:", CraftCore.compiler.macOSDeploymentTarget) + print("Compiler Target: %s" % CraftCore.compiler._getGCCTarget()) \ No newline at end of file diff --git a/bin/CraftSetupHelper.py b/bin/CraftSetupHelper.py --- a/bin/CraftSetupHelper.py +++ b/bin/CraftSetupHelper.py @@ -275,6 +275,7 @@ self.prependEnvVar("LDFLAGS", f"-Wl,-rpath,{os.path.join(CraftCore.standardDirs.craftRoot(), 'lib')}", sep=" ") self.prependEnvVar("BISON_PKGDATADIR", os.path.join(CraftCore.standardDirs.craftRoot(), "share", "bison")) self.prependEnvVar("M4", os.path.join(CraftCore.standardDirs.craftRoot(), "dev-utils", "bin", "m4")) + self.addEnvVar("MACOSX_DEPLOYMENT_TARGET", CraftCore.settings.get("General", "MacDeploymentTarget", "10.13")) dbusInstalled = CraftCore.installdb.isInstalled("libs/dbus") if dbusInstalled: serviceAgent = os.path.join(CraftCore.standardDirs.craftRoot(), "Library", "LaunchAgents", "org.freedesktop.dbus-session.plist") diff --git a/bin/shells.py b/bin/shells.py --- a/bin/shells.py +++ b/bin/shells.py @@ -42,18 +42,14 @@ # libraries installed by homebrew (causes errors e.g. with iconv since headers will be # found in /usr/local/include first but libraries are searched for in /usr/lib before # /usr/local/lib. See https://langui.sh/2015/07/24/osx-clang-include-lib-search-paths/ - if CraftCore.compiler.macUseSDK: - sdkPath = CraftCore.cache.getCommandOutput("xcrun", "--show-sdk-path")[1].strip() - deploymentFlag = "-mmacosx-version-min=" + CraftCore.compiler.macOSDeploymentTarget - cflags = f" -isysroot {sdkPath} {deploymentFlag}" + cflags - # See https://github.com/Homebrew/homebrew-core/issues/2674 for the -no_weak_imports flag - ldflags = f" -isysroot {sdkPath} {deploymentFlag} -Wl,-no_weak_imports" + ldflags - # Note: MACOSX_DEPLOYMENT_TARGET is set in utils.system() so doesn't need to be set here - else: - # Ensure that /usr/include comes before /usr/local/include in the header search path to avoid - # pulling in headers from /usr/local/include (e.g. installed by homebrew) that will cause - # linker errors later. - cflags = " -isystem /usr/include " + cflags + # Ensure that /usr/include comes before /usr/local/include in the header search path to avoid + # pulling in headers from /usr/local/include (e.g. installed by homebrew) that will cause + # linker errors later. + sdkPath = CraftCore.cache.getCommandOutput("xcrun", "--show-sdk-path")[1].strip() + deploymentFlag = f"-mmacosx-version-min={os.environ['MACOSX_DEPLOYMENT_TARGET']}" + cflags = f" -isysroot {sdkPath} {deploymentFlag} {cflags} -isystem /usr/include" + # See https://github.com/Homebrew/homebrew-core/issues/2674 for the -no_weak_imports flag + ldflags = f" -isysroot {sdkPath} {deploymentFlag} -Wl,-no_weak_imports {ldflags}" if CraftCore.compiler.isMSVC(): # based on Windows-MSVC.cmake diff --git a/bin/utils.py b/bin/utils.py --- a/bin/utils.py +++ b/bin/utils.py @@ -238,8 +238,6 @@ CraftCore.log.debug(f"executing command: {cmd!r}") CraftCore.log.debug(f"CWD: {cwd!r}") CraftCore.log.debug(f"displayProgress={displayProgress}") - if CraftCore.compiler.isMacOS and CraftCore.compiler.macUseSDK: - environment["MACOSX_DEPLOYMENT_TARGET"] = CraftCore.compiler.macOSDeploymentTarget CraftCore.debug.logEnv(environment) if pipeProcess: kw["stdin"] = pipeProcess.stdout