diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 076b8fb..d8bdde2 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -122,6 +122,12 @@ function toolchain(_buildDir, _libDir) description = "Set iOS target version (default: 8.0).", } + newoption { + trigger = "with-macos", + value = "#", + description = "Set macOS target version (default 10.9).", + } + newoption { trigger = "with-tvos", value = "#", @@ -170,6 +176,11 @@ function toolchain(_buildDir, _libDir) iosPlatform = _OPTIONS["with-ios"] end + local macosPlatform = "" + if _OPTIONS["with-macos"] then + macosPlatform = _OPTIONS["with-macos"] + end + local tvosPlatform = "" if _OPTIONS["with-tvos"] then tvosPlatform = _OPTIONS["with-tvos"] @@ -478,16 +489,23 @@ function toolchain(_buildDir, _libDir) end elseif _ACTION == "xcode4" then + local action = premake.action.current() + local str_or = function(str, def) + return #str > 0 and str or def + end if "osx" == _OPTIONS["xcode"] then + action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "10.9") premake.xcode.toolset = "macosx" location (path.join(_buildDir, "projects", _ACTION .. "-osx")) elseif "ios" == _OPTIONS["xcode"] then + action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "8.0") premake.xcode.toolset = "iphoneos" location (path.join(_buildDir, "projects", _ACTION .. "-ios")) elseif "tvos" == _OPTIONS["xcode"] then + action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0") premake.xcode.toolset = "appletvos" location (path.join(_buildDir, "projects", _ACTION .. "-tvos")) end