Set IPHONE_VER before going to HXCPP
This commit is contained in:
@@ -85,33 +85,52 @@ class IOSHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function getIOSVersion (project:HXProject):Void {
|
public static function getIOSVersion (project:HXProject):Void {
|
||||||
|
|
||||||
|
if (!project.environment.exists ("IPHONE_VER") || project.environment.get ("IPHONE_VER") == "4.2") {
|
||||||
|
|
||||||
if (!project.environment.exists("IPHONE_VER")) {
|
|
||||||
if (!project.environment.exists("DEVELOPER_DIR")) {
|
if (!project.environment.exists("DEVELOPER_DIR")) {
|
||||||
var proc = new Process("xcode-select", ["--print-path"]);
|
|
||||||
var developer_dir = proc.stdout.readLine();
|
|
||||||
proc.close();
|
|
||||||
project.environment.set("DEVELOPER_DIR", developer_dir);
|
|
||||||
}
|
|
||||||
var dev_path = project.environment.get("DEVELOPER_DIR") + "/Platforms/iPhoneOS.platform/Developer/SDKs";
|
|
||||||
|
|
||||||
if (FileSystem.exists (dev_path)) {
|
var process = new Process ("xcode-select", [ "--print-path" ]);
|
||||||
var best = "";
|
var developerDir = process.stdout.readLine ();
|
||||||
var files = FileSystem.readDirectory (dev_path);
|
process.close ();
|
||||||
var extract_version = ~/^iPhoneOS(.*).sdk$/;
|
|
||||||
|
project.environment.set ("DEVELOPER_DIR", developerDir);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var devPath = project.environment.get ("DEVELOPER_DIR") + "/Platforms/iPhoneOS.platform/Developer/SDKs";
|
||||||
|
|
||||||
|
if (FileSystem.exists (devPath)) {
|
||||||
|
|
||||||
|
var files = FileSystem.readDirectory (devPath);
|
||||||
|
var extractVersion = ~/^iPhoneOS(.*).sdk$/;
|
||||||
|
var best = "", version;
|
||||||
|
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
if (extract_version.match (file)) {
|
|
||||||
var ver = extract_version.matched (1);
|
if (extractVersion.match (file)) {
|
||||||
if (ver > best)
|
|
||||||
best = ver;
|
version = extractVersion.matched (1);
|
||||||
|
|
||||||
|
if (Std.parseFloat (version) > Std.parseFloat (best)) {
|
||||||
|
|
||||||
|
best = version;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (best != "")
|
if (best != "") {
|
||||||
|
|
||||||
project.environment.set ("IPHONE_VER", best);
|
project.environment.set ("IPHONE_VER", best);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ class IOSPlatform extends PlatformTarget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IOSHelper.getIOSVersion (project);
|
||||||
|
project.haxedefs.set ("IPHONE_VER", project.environment.get ("IPHONE_VER"));
|
||||||
|
|
||||||
var context = project.templateContext;
|
var context = project.templateContext;
|
||||||
|
|
||||||
context.HAS_ICON = false;
|
context.HAS_ICON = false;
|
||||||
@@ -366,6 +369,15 @@ class IOSPlatform extends PlatformTarget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IOSHelper.getIOSVersion (project);
|
||||||
|
var iphoneVer = project.environment.get ("IPHONE_VER");
|
||||||
|
|
||||||
|
for (command in commands) {
|
||||||
|
|
||||||
|
command.push ("-DIPHONE_VER=" + iphoneVer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
CPPHelper.rebuild (project, commands);
|
CPPHelper.rebuild (project, commands);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user