Browse Source

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

Also setting defaults to macOS, iOS, and tvOS versions that match what the flags say they should default to.
Johan Sköld 8 years ago
parent
commit
d2bcdc5c0d
1 changed files with 18 additions and 0 deletions
  1. 18 0
      scripts/toolchain.lua

+ 18 - 0
scripts/toolchain.lua

@@ -122,6 +122,12 @@ function toolchain(_buildDir, _libDir)
 		description = "Set iOS target version (default: 8.0).",
 		description = "Set iOS target version (default: 8.0).",
 	}
 	}
 
 
+	newoption {
+		trigger     = "with-macos",
+		value       = "#",
+		description = "Set macOS target version (default 10.9).",
+	}
+
 	newoption {
 	newoption {
 		trigger     = "with-tvos",
 		trigger     = "with-tvos",
 		value       = "#",
 		value       = "#",
@@ -170,6 +176,11 @@ function toolchain(_buildDir, _libDir)
 		iosPlatform = _OPTIONS["with-ios"]
 		iosPlatform = _OPTIONS["with-ios"]
 	end
 	end
 
 
+	local macosPlatform = ""
+	if _OPTIONS["with-macos"] then
+		macosPlatform = _OPTIONS["with-macos"]
+	end
+
 	local tvosPlatform = ""
 	local tvosPlatform = ""
 	if _OPTIONS["with-tvos"] then
 	if _OPTIONS["with-tvos"] then
 		tvosPlatform = _OPTIONS["with-tvos"]
 		tvosPlatform = _OPTIONS["with-tvos"]
@@ -478,16 +489,23 @@ function toolchain(_buildDir, _libDir)
 		end
 		end
 
 
 	elseif _ACTION == "xcode4" then
 	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
 		if "osx" == _OPTIONS["xcode"] then
+			action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "10.9")
 			premake.xcode.toolset = "macosx"
 			premake.xcode.toolset = "macosx"
 			location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
 			location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
 
 
 		elseif "ios" == _OPTIONS["xcode"] then
 		elseif "ios" == _OPTIONS["xcode"] then
+			action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "8.0")
 			premake.xcode.toolset = "iphoneos"
 			premake.xcode.toolset = "iphoneos"
 			location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
 			location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
 
 
 		elseif "tvos" == _OPTIONS["xcode"] then
 		elseif "tvos" == _OPTIONS["xcode"] then
+			action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0")
 			premake.xcode.toolset = "appletvos"
 			premake.xcode.toolset = "appletvos"
 			location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
 			location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
 		end
 		end