Adding --with-macos trigger. (#172)

Also setting defaults to macOS, iOS, and tvOS versions that match what the flags say they should default to.
This commit is contained in:
Johan Sköld
2017-12-07 20:16:35 -08:00
committed by Branimir Karadžić
parent b691f8b946
commit d2bcdc5c0d

View File

@@ -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