Sync tool platform changes from HXP

This commit is contained in:
Joshua Granick
2018-07-24 16:18:49 -07:00
parent 70f17324ca
commit c0b3692402
9 changed files with 1518 additions and 1420 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@ package;
import haxe.io.Path;
import haxe.Template;
import hxp.project.AssetType;
import hxp.project.HXProject;
import hxp.project.Icon;
@@ -24,6 +25,7 @@ class AIRPlatform extends FlashPlatform {
private var iconData:Array<Dynamic>;
private var splashScreenData:Array<Dynamic>;
private var targetPlatform:Platform;
private var targetPlatformType:PlatformType;
@@ -95,6 +97,12 @@ class AIRPlatform extends FlashPlatform {
}
for (splashScreen in splashScreenData) {
files.push (splashScreen.path);
}
var targetPath = switch (targetPlatform) {
case ANDROID: "bin/" + project.app.file + ".apk";
@@ -180,6 +188,31 @@ class AIRPlatform extends FlashPlatform {
}
private override function getDisplayHXML ():String {
var hxml = PathHelper.findTemplate (project.templatePaths, "flash/hxml/" + buildType + ".hxml");
var context = project.templateContext;
context.WIN_FLASHBACKGROUND = StringTools.hex (project.window.background, 6);
context.OUTPUT_DIR = targetDirectory;
for (dependency in project.dependencies) {
if (StringTools.endsWith (dependency.path, ".ane")) {
context.HAXE_FLAGS += "\n-swf-lib " + dependency.path;
}
}
var template = new Template (File.getContent (hxml));
return template.execute (context) + "\n-D display";
}
public override function install ():Void {
// TODO: Make separate install step
@@ -257,6 +290,14 @@ class AIRPlatform extends FlashPlatform {
}
var targetDevice = project.config.getString ("ios.device", "universal");
var targetDevices = [];
if (targetDevice != "ipad") targetDevices.push (1); // iphone
if (targetDevice != "iphone") targetDevices.push (2); // ipad
context.IOS_TARGET_DEVICES = targetDevices;
var iconSizes = [ 16, 29, 32, 36, 40, 48, 50, 57, 58, 60, 72, 75, 76, 80, 87, 96, 100, 114, 120, 128, 144, 152, 167, 180, 192, 512, 1024 ];
var icons = project.icons;
iconData = [];
@@ -278,19 +319,19 @@ class AIRPlatform extends FlashPlatform {
}
if (iconData.length > 0) context.icons = iconData;
context.extensions = new Array<String>();
for (dependency in project.dependencies) {
if (StringTools.endsWith(dependency.path, ".ane")) {
if (StringTools.endsWith (dependency.path, ".ane")) {
var extension:Dynamic = { name: dependency.name };
context.extensions.push(extension);
context.extensions.push (extension);
context.HAXE_FLAGS += "\n-swf-lib " + dependency.path;
}
}
FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context);
@@ -344,10 +385,24 @@ class AIRPlatform extends FlashPlatform {
}
splashScreenData = [];
if (project.splashScreens != null) {
for (splashScreen in project.splashScreens) {
var path = Path.withoutDirectory (splashScreen.path);
FileHelper.copyFile (splashScreen.path, PathHelper.combine (destination, path), context);
splashScreenData.push ({ path: path });
}
}
}
@ignore public override function rebuild ():Void {}
}
}

View File

@@ -66,12 +66,14 @@ class AndroidPlatform extends PlatformTarget {
var hasARMV5 = (ArrayHelper.containsValue (project.architectures, Architecture.ARMV5) || ArrayHelper.containsValue (project.architectures, Architecture.ARMV6));
var hasARMV7 = ArrayHelper.containsValue (project.architectures, Architecture.ARMV7);
var hasARM64 = ArrayHelper.containsValue (project.architectures, Architecture.ARM64);
var hasX86 = ArrayHelper.containsValue (project.architectures, Architecture.X86);
var architectures = [];
if (hasARMV5) architectures.push (Architecture.ARMV5);
if (hasARMV7 || (!hasARMV5 && !hasX86)) architectures.push (Architecture.ARMV7);
if (hasARM64) architectures.push (Architecture.ARM64);
if (hasX86) architectures.push (Architecture.X86);
for (architecture in architectures) {
@@ -95,6 +97,17 @@ class AndroidPlatform extends PlatformTarget {
suffix = "-v7.so";
} else if (architecture == Architecture.ARM64) {
haxeParams = [ hxml, "-D", "android", "-D", "PLATFORM=android-21" ];
cppParams = [ "-Dandroid", "-DPLATFORM=android-21" ];
haxeParams.push ("-D");
haxeParams.push ("HXCPP_ARM64");
cppParams.push ("-DHXCPP_ARM64");
path = sourceSet + "/jniLibs/arm64-v8a";
suffix = "-64.so";
} else if (architecture == Architecture.X86) {
haxeParams.push ("-D");
@@ -131,6 +144,16 @@ class AndroidPlatform extends PlatformTarget {
}
if (!hasARM64) {
if (FileSystem.exists (sourceSet + "/jniLibs/arm64-v8a")) {
PathHelper.removeDirectory (sourceSet + "/jniLibs/arm64-v8a");
}
}
if (!hasX86) {
if (FileSystem.exists (sourceSet + "/jniLibs/x86")) {
@@ -221,12 +244,14 @@ class AndroidPlatform extends PlatformTarget {
var armv5 = (command == "rebuild" || ArrayHelper.containsValue (project.architectures, Architecture.ARMV5) || ArrayHelper.containsValue (project.architectures, Architecture.ARMV6));
var armv7 = (command == "rebuild" || ArrayHelper.containsValue (project.architectures, Architecture.ARMV7));
var arm64 = (command == "rebuild" || ArrayHelper.containsValue (project.architectures, Architecture.ARM64));
var x86 = (command == "rebuild" || ArrayHelper.containsValue (project.architectures, Architecture.X86));
var commands = [];
if (armv5) commands.push ([ "-Dandroid", "-DPLATFORM=android-14" ]);
if (armv7) commands.push ([ "-Dandroid", "-DHXCPP_ARMV7", "-DHXCPP_ARM7", "-DPLATFORM=android-14" ]);
if (arm64) commands.push ([ "-Dandroid", "-DHXCPP_ARM64", "-DPLATFORM=android-21" ]);
if (x86) commands.push ([ "-Dandroid", "-DHXCPP_X86", "-DPLATFORM=android-14" ]);
CPPHelper.rebuild (project, commands);
@@ -326,8 +351,8 @@ class AndroidPlatform extends PlatformTarget {
context.CPP_DIR = targetDirectory + "/obj";
context.OUTPUT_DIR = targetDirectory;
context.ANDROID_INSTALL_LOCATION = project.config.getString ("android.install-location", "auto");
context.ANDROID_MINIMUM_SDK_VERSION = project.config.getInt ("android.minimum-sdk-version", 9);
context.ANDROID_TARGET_SDK_VERSION = project.config.getInt ("android.target-sdk-version", 19);
context.ANDROID_MINIMUM_SDK_VERSION = project.config.getInt ("android.minimum-sdk-version", 14);
context.ANDROID_TARGET_SDK_VERSION = project.config.getInt ("android.target-sdk-version", 26);
context.ANDROID_EXTENSIONS = project.config.getArrayString ("android.extension");
context.ANDROID_PERMISSIONS = project.config.getArrayString ("android.permission", [ "android.permission.WAKE_LOCK", "android.permission.INTERNET", "android.permission.VIBRATE", "android.permission.ACCESS_NETWORK_STATE" ]);
context.ANDROID_GRADLE_VERSION = project.config.getString ("android.gradle-version", "2.10");
@@ -336,7 +361,7 @@ class AndroidPlatform extends PlatformTarget {
if (!project.environment.exists ("ANDROID_SDK") || !project.environment.exists ("ANDROID_NDK_ROOT")) {
var command = "lime";
var command = #if lime "lime" #else "hxp" #end;
var toolsBase = Type.resolveClass ("CommandLineTools");
if (toolsBase != null)
command = Reflect.field (toolsBase, "commandName");
@@ -478,4 +503,4 @@ class AndroidPlatform extends PlatformTarget {
}
}
}

View File

@@ -4,7 +4,6 @@ package;
import haxe.io.Path;
import haxe.Json;
import haxe.Template;
import hxp.helpers.CompatibilityHelper;
import hxp.helpers.DeploymentHelper;
import hxp.helpers.FileHelper;
import hxp.helpers.FlashHelper;
@@ -292,4 +291,4 @@ class FlashPlatform extends PlatformTarget {
@ignore public override function rebuild ():Void {}
@ignore public override function uninstall ():Void {}
}
}

View File

@@ -3,7 +3,9 @@ package;
import haxe.io.Path;
import haxe.Template;
// import lime.text.Font;
#if lime
import lime.text.Font;
#end
import hxp.helpers.DeploymentHelper;
import hxp.helpers.ElectronHelper;
import hxp.helpers.FileHelper;
@@ -387,24 +389,16 @@ class HTML5Platform extends PlatformTarget {
if (embeddedAsset.type == "font" && embeddedAsset.sourcePath == asset.sourcePath) {
// var font = Font.fromFile (asset.sourcePath);
#if lime
var font = Font.fromFile (asset.sourcePath);
// embeddedAsset.ascender = font.ascender;
// embeddedAsset.descender = font.descender;
// embeddedAsset.height = font.height;
// embeddedAsset.numGlyphs = font.numGlyphs;
// embeddedAsset.underlinePosition = font.underlinePosition;
// embeddedAsset.underlineThickness = font.underlineThickness;
// embeddedAsset.unitsPerEM = font.unitsPerEM;
embeddedAsset.ascender = 0;
embeddedAsset.descender = 0;
embeddedAsset.height = 0;
embeddedAsset.numGlyphs = 0;
embeddedAsset.underlinePosition = 0;
embeddedAsset.underlineThickness = 0;
embeddedAsset.unitsPerEM = 0;
embeddedAsset.fontName = "sans";
embeddedAsset.ascender = font.ascender;
embeddedAsset.descender = font.descender;
embeddedAsset.height = font.height;
embeddedAsset.numGlyphs = font.numGlyphs;
embeddedAsset.underlinePosition = font.underlinePosition;
embeddedAsset.underlineThickness = font.underlineThickness;
embeddedAsset.unitsPerEM = font.unitsPerEM;
if (shouldEmbedFont) {
@@ -426,6 +420,7 @@ class HTML5Platform extends PlatformTarget {
}
break;
#end
}
@@ -493,4 +488,4 @@ class HTML5Platform extends PlatformTarget {
@ignore public override function uninstall ():Void {}
}
}

View File

@@ -17,7 +17,9 @@ import hxp.helpers.PlatformHelper;
import hxp.helpers.ProcessHelper;
import hxp.helpers.StringHelper;
import hxp.helpers.WatchHelper;
#if lime
import lime.graphics.Image;
#end
import hxp.project.Architecture;
import hxp.project.Asset;
import hxp.project.AssetType;
@@ -573,12 +575,14 @@ class IOSPlatform extends PlatformTarget {
if (!FileSystem.exists (imagePath)) {
#if lime
LogHelper.info ("", " - \x1b[1mGenerating image:\x1b[0m " + imagePath);
var image = new Image (null, 0, 0, size.w, size.h, (0xFF << 24) | (project.window.background & 0xFFFFFF));
var bytes = image.encode ("png");
var bytes = image.encode (PNG);
File.saveBytes (imagePath, bytes);
#end
}

View File

@@ -1,4 +1,4 @@
package lime.tools.platforms;
package;
//import openfl.display.BitmapData;
@@ -17,7 +17,9 @@ import hxp.helpers.PlatformHelper;
import hxp.helpers.ProcessHelper;
import hxp.helpers.StringHelper;
import hxp.helpers.WatchHelper;
#if lime
import lime.graphics.Image;
#end
import hxp.project.Architecture;
import hxp.project.Asset;
import hxp.project.AssetType;
@@ -33,201 +35,201 @@ import sys.FileSystem;
class TVOSPlatform extends PlatformTarget {
public function new (command:String, _project:HXProject, targetFlags:Map<String, String> ) {
super (command, _project, targetFlags);
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("tvos.output-directory", "tvos"));
}
public override function build ():Void {
if (project.targetFlags.exists ("xcode") && PlatformHelper.hostPlatform == Platform.MAC) {
ProcessHelper.runCommand ("", "open", [ targetDirectory + "/" + project.app.file + ".xcodeproj" ] );
} else {
TVOSHelper.build (project, targetDirectory);
if (noOutput) return;
if (!project.targetFlags.exists ("simulator")) {
TVOSHelper.sign (project, targetDirectory + "/bin");
}
}
}
public override function clean ():Void {
if (FileSystem.exists (targetDirectory)) {
PathHelper.removeDirectory (targetDirectory);
}
}
public override function deploy ():Void {
TVOSHelper.deploy (project, targetDirectory);
}
public override function display ():Void {
Sys.println (getDisplayHXML ());
}
private function generateContext ():Dynamic {
// project = project.clone ();
project.sources.unshift ("");
project.sources = PathHelper.relocatePaths (project.sources, PathHelper.combine (targetDirectory, project.app.file + "/haxe"));
//project.dependencies.push ("stdc++");
if (project.targetFlags.exists ("xml")) {
project.haxeflags.push ("-xml " + targetDirectory + "/types.xml");
}
if (project.targetFlags.exists ("final")) {
project.haxedefs.set ("final", "");
}
if (!project.config.exists ("tvos.identity")) {
project.config.set ("tvos.identity", "tvOS Developer");
}
var context = project.templateContext;
context.HAS_ICON = false;
context.HAS_LAUNCH_IMAGE = false;
context.OBJC_ARC = false;
context.KEY_STORE_IDENTITY = project.config.getString ("tvos.identity");
context.linkedLibraries = [];
for (dependency in project.dependencies) {
if (!StringTools.endsWith (dependency.name, ".framework") && !StringTools.endsWith (dependency.name, ".tbd") && !StringTools.endsWith (dependency.path, ".framework")) {
if (dependency.path != "") {
var name = Path.withoutDirectory (Path.withoutExtension (dependency.path));
project.config.push ("tvos.linker-flags", "-force_load $SRCROOT/$PRODUCT_NAME/lib/$CURRENT_ARCH/" + Path.withoutDirectory (dependency.path));
if (StringTools.startsWith (name, "lib")) {
name = name.substring (3, name.length);
}
context.linkedLibraries.push (name);
} else if (dependency.name != "") {
context.linkedLibraries.push (dependency.name);
}
}
}
var valid_archs = new Array<String> ();
var arm64 = false;
var architectures = project.architectures;
if (architectures == null || architectures.length == 0) {
architectures = [ Architecture.ARM64 ];
}
/*if (project.config.getString ("ios.device", "universal") == "universal" || project.config.getString ("ios.device") == "iphone") {
if (project.config.getFloat ("ios.deployment", 5.1) < 5) {
ArrayHelper.addUnique (architectures, Architecture.ARMV6);
}
}*/
for (architecture in project.architectures) {
switch (architecture) {
case ARM64: valid_archs.push ("arm64"); arm64 = true;
default:
}
}
context.CURRENT_ARCHS = "( " + valid_archs.join(",") + ") ";
valid_archs.push ("i386");
context.VALID_ARCHS = valid_archs.join(" ");
context.THUMB_SUPPORT = "";
var requiredCapabilities = [];
requiredCapabilities.push( { name: "arm64", value: true } );
context.REQUIRED_CAPABILITY = requiredCapabilities;
context.ARM64 = arm64;
context.TARGET_DEVICES = switch (project.config.getString ("tvos.device", "appletv")) { case "appletv": "3"; default: "3"; }
context.DEPLOYMENT = project.config.getString ("tvos.deployment", "9.0");
if (project.config.getString ("tvos.compiler") == "llvm" || project.config.getString ("tvos.compiler", "clang") == "clang") {
context.OBJC_ARC = true;
}
context.IOS_COMPILER = project.config.getString ("tvos.compiler", "clang");
context.CPP_BUILD_LIBRARY = project.config.getString ("cpp.buildLibrary", "hxcpp");
var json = Json.parse (File.getContent (PathHelper.getHaxelib (new Haxelib ("hxcpp"), true) + "/haxelib.json"));
if (Std.parseFloat (json.version) > 3.1) {
context.CPP_LIBPREFIX = "lib";
} else {
context.CPP_LIBPREFIX = "";
}
context.IOS_LINKER_FLAGS = ["-stdlib=libc++"].concat (project.config.getArrayString ("tvos.linker-flags"));
context.IOS_NON_EXEMPT_ENCRYPTION = project.config.getBool ("tvos.non-exempt-encryption", true);
switch (project.window.orientation) {
case PORTRAIT:
context.IOS_APP_ORIENTATION = "<array><string>UIInterfaceOrientationPortrait</string><string>UIInterfaceOrientationPortraitUpsideDown</string></array>";
case LANDSCAPE:
@@ -238,151 +240,151 @@ class TVOSPlatform extends PlatformTarget {
//context.IOS_APP_ORIENTATION = "<array><string>UIInterfaceOrientationLandscapeLeft</string><string>UIInterfaceOrientationLandscapeRight</string><string>UIInterfaceOrientationPortrait</string></array>";
default:
context.IOS_APP_ORIENTATION = "<array><string>UIInterfaceOrientationLandscapeLeft</string><string>UIInterfaceOrientationLandscapeRight</string><string>UIInterfaceOrientationPortrait</string><string>UIInterfaceOrientationPortraitUpsideDown</string></array>";
}
context.ADDL_PBX_BUILD_FILE = "";
context.ADDL_PBX_FILE_REFERENCE = "";
context.ADDL_PBX_FRAMEWORKS_BUILD_PHASE = "";
context.ADDL_PBX_FRAMEWORK_GROUP = "";
context.frameworkSearchPaths = [];
for (dependency in project.dependencies) {
var name = null;
var path = null;
var fileType = null;
if (Path.extension (dependency.name) == "framework") {
name = dependency.name;
path = "/System/Library/Frameworks/" + dependency.name;
fileType = "wrapper.framework";
} else if (Path.extension (dependency.name) == "tbd") {
name = dependency.name;
path = "usr/lib/" + dependency.name;
fileType = "sourcecode.text-based-dylib-definition";
} else if (Path.extension (dependency.path) == "framework") {
name = Path.withoutDirectory (dependency.path);
path = PathHelper.tryFullPath (dependency.path);
fileType = "wrapper.framework";
}
if (name != null) {
var frameworkID = "11C0000000000018" + StringHelper.getUniqueID ();
var fileID = "11C0000000000018" + StringHelper.getUniqueID ();
ArrayHelper.addUnique (context.frameworkSearchPaths, Path.directory (path));
context.ADDL_PBX_BUILD_FILE += " " + frameworkID + " /* " + name + " in Frameworks */ = {isa = PBXBuildFile; fileRef = " + fileID + " /* " + name + " */; };\n";
context.ADDL_PBX_FILE_REFERENCE += " " + fileID + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = \"" + fileType + "\"; name = \"" + name + "\"; path = \"" + path + "\"; sourceTree = SDKROOT; };\n";
context.ADDL_PBX_FRAMEWORKS_BUILD_PHASE += " " + frameworkID + " /* " + name + " in Frameworks */,\n";
context.ADDL_PBX_FRAMEWORK_GROUP += " " + fileID + " /* " + name + " */,\n";
}
}
context.HXML_PATH = PathHelper.findTemplate (project.templatePaths, "tvos/PROJ/haxe/Build.hxml");
context.PRERENDERED_ICON = project.config.getBool ("tvos.prerenderedIcon", false);
var haxelibPath = project.environment.get ("HAXELIB_PATH");
if (haxelibPath != null) {
context.HAXELIB_PATH = 'export HAXELIB_PATH=$haxelibPath;';
} else {
context.HAXELIB_PATH = '';
}
return context;
}
private function getDisplayHXML ():String {
var hxml = PathHelper.findTemplate (project.templatePaths, "tvos/PROJ/haxe/Build.hxml");
var template = new Template (File.getContent (hxml));
var context = generateContext ();
context.OUTPUT_DIR = targetDirectory;
return template.execute (context) + "\n-D display";
}
public override function rebuild ():Void {
var arm64 = (command == "rebuild" || (project.architectures.indexOf (Architecture.ARM64) > -1 && !project.targetFlags.exists ("simulator")));
var i386 = (command == "rebuild" || project.targetFlags.exists ("simulator"));
var x86_64 = (command == "rebuild" || project.targetFlags.exists ("simulator"));
var commands = [];
if (arm64) commands.push ([ "-Dtvos", "-Dappletvos", "-DHXCPP_CPP11", "-DHXCPP_ARM64", "-DOBJC_ARC", "-DENABLE_BITCODE" ]);
if (i386) commands.push ([ "-Dtvos", "-Dappletvsim", "-Dsimulator", "-DHXCPP_CPP11", "-DOBJC_ARC", "-DENABLE_BITCODE" ]);
if (x86_64) commands.push ([ "-Dtvos", "-Dappletvsim", "-Dsimulator", "-DHXCPP_M64", "-DHXCPP_CPP11", "-DOBJC_ARC", "-DENABLE_BITCODE" ]);
CPPHelper.rebuild (project, commands);
}
public override function run ():Void {
if (project.targetFlags.exists ("xcode")) return;
TVOSHelper.launch (project, targetDirectory);
}
public override function update ():Void {
// project = project.clone ();
for (asset in project.assets) {
if (asset.embed && asset.sourcePath == "") {
var path = PathHelper.combine (targetDirectory + "/" + project.app.file + "/obj/tmp", asset.targetPath);
PathHelper.mkdir (Path.directory (path));
FileHelper.copyAsset (asset, path);
asset.sourcePath = path;
}
}
//var manifest = new Asset ();
//manifest.id = "__manifest__";
//manifest.data = AssetHelper.createManifest (project).serialize ();
//manifest.resourceName = manifest.flatName = manifest.targetPath = "manifest";
//manifest.type = AssetType.TEXT;
//project.assets.push (manifest);
var context = generateContext ();
context.OUTPUT_DIR = targetDirectory;
var projectDirectory = targetDirectory + "/" + project.app.file + "/";
PathHelper.mkdir (targetDirectory);
PathHelper.mkdir (projectDirectory);
PathHelper.mkdir (projectDirectory + "/haxe");
PathHelper.mkdir (projectDirectory + "/haxe/lime/installer");
var iconSizes:Array<IconSize> = [
{ name : "Icon-Small.png", size : 29 },
{ name : "Icon-Small-40.png", size : 40 },
@@ -399,30 +401,30 @@ class TVOSPlatform extends PlatformTarget {
{ name : "Icon-76@2x.png", size : 152 },
{ name : "Icon-60@3x.png", size : 180 },
];
context.HAS_ICON = true;
var iconPath = PathHelper.combine (projectDirectory, "Images.xcassets/AppIcon.appiconset");
PathHelper.mkdir (iconPath);
var icons = project.icons;
if (icons.length == 0) {
icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ];
}
for (iconSize in iconSizes) {
if (!IconHelper.createIcon (icons, iconSize.size, iconSize.size, PathHelper.combine (iconPath, iconSize.name))) {
context.HAS_ICON = false;
}
}
var splashSizes:Array<SplashSize> = [
{ name: "Default.png", w: 320, h: 480 }, // iPhone, portrait
{ name: "Default@2x.png", w: 640, h: 960 }, // iPhone Retina, portrait
@@ -435,215 +437,218 @@ class TVOSPlatform extends PlatformTarget {
{ name: "Default-736h@3x.png", w: 1242, h: 2208 }, // iPhone 6 Plus, portrait
{ name: "Default-736h-Landscape@3x.png", w: 2208, h: 1242 }, // iPhone 6 Plus, landscape
];
var splashScreenPath = PathHelper.combine (projectDirectory, "Images.xcassets/LaunchImage.launchimage");
PathHelper.mkdir (splashScreenPath);
for (size in splashSizes) {
var match = false;
for (splashScreen in project.splashScreens) {
if (splashScreen.width == size.w && splashScreen.height == size.h && Path.extension (splashScreen.path) == "png") {
FileHelper.copyFile (splashScreen.path, PathHelper.combine (splashScreenPath, size.name));
match = true;
}
}
if (!match) {
var imagePath = PathHelper.combine (splashScreenPath, size.name);
if (!FileSystem.exists (imagePath)) {
#if lime
LogHelper.info ("", " - \x1b[1mGenerating image:\x1b[0m " + imagePath);
var image = new Image (null, 0, 0, size.w, size.h, (0xFF << 24) | (project.window.background & 0xFFFFFF));
var bytes = image.encode ("png");
var bytes = image.encode (PNG);
File.saveBytes (imagePath, bytes);
#end
}
}
}
context.HAS_LAUNCH_IMAGE = true;
PathHelper.mkdir (projectDirectory + "/resources");
PathHelper.mkdir (projectDirectory + "/haxe/build");
FileHelper.recursiveSmartCopyTemplate (project, "tvos/resources", projectDirectory + "/resources", context, true, false);
FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ/haxe", projectDirectory + "/haxe", context);
FileHelper.recursiveSmartCopyTemplate (project, "haxe", projectDirectory + "/haxe", context);
FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ/Classes", projectDirectory + "/Classes", context);
FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ/Images.xcassets", projectDirectory + "/Images.xcassets", context);
FileHelper.copyFileTemplate (project.templatePaths, "tvos/PROJ/PROJ-Entitlements.plist", projectDirectory + "/" + project.app.file + "-Entitlements.plist", context);
FileHelper.copyFileTemplate (project.templatePaths, "tvos/PROJ/PROJ-Info.plist", projectDirectory + "/" + project.app.file + "-Info.plist", context);
FileHelper.copyFileTemplate (project.templatePaths, "tvos/PROJ/PROJ-Prefix.pch", projectDirectory + "/" + project.app.file + "-Prefix.pch", context);
FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ.xcodeproj", targetDirectory + "/" + project.app.file + ".xcodeproj", context);
//SWFHelper.generateSWFClasses (project, projectDirectory + "/haxe");
PathHelper.mkdir (projectDirectory + "/lib");
for (archID in 0...3) {
var arch = [ "arm64", "i386", "x86_64" ][archID];
if (arch == "arm64" && !context.ARM64)
continue;
var libExt = [ ".appletvos-64.a", ".appletvsim.a", ".appletvsim-64.a" ][archID];
PathHelper.mkdir (projectDirectory + "/lib/" + arch);
PathHelper.mkdir (projectDirectory + "/lib/" + arch + "-debug");
for (ndll in project.ndlls) {
//if (ndll.haxelib != null) {
var releaseLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", libExt);
LogHelper.info("releaseLib: " + releaseLib);
var debugLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", libExt, true);
var releaseDest = projectDirectory + "/lib/" + arch + "/lib" + ndll.name + ".a";
LogHelper.info("releaseDest: " + releaseDest);
var debugDest = projectDirectory + "/lib/" + arch + "-debug/lib" + ndll.name + ".a";
if (!FileSystem.exists (releaseLib)) {
releaseLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", ".appletvos-64.a");
LogHelper.info("alternative releaseLib: " + releaseLib);
debugLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", ".appletvos-64.a", true);
}
FileHelper.copyIfNewer (releaseLib, releaseDest);
if (FileSystem.exists (debugLib) && debugLib != releaseLib) {
FileHelper.copyIfNewer (debugLib, debugDest);
} else if (FileSystem.exists (debugDest)) {
FileSystem.deleteFile (debugDest);
}
//}
}
for (dependency in project.dependencies) {
if (StringTools.endsWith (dependency.path, ".a")) {
var fileName = Path.withoutDirectory (dependency.path);
if (!StringTools.startsWith (fileName, "lib")) {
fileName = "lib" + fileName;
}
FileHelper.copyIfNewer (dependency.path, projectDirectory + "/lib/" + arch + "/" + fileName);
}
}
}
PathHelper.mkdir (projectDirectory + "/assets");
for (asset in project.assets) {
if (asset.type != AssetType.TEMPLATE) {
var targetPath = PathHelper.combine (projectDirectory + "/assets/", asset.resourceName);
//var sourceAssetPath:String = projectDirectory + "haxe/" + asset.sourcePath;
PathHelper.mkdir (Path.directory (targetPath));
FileHelper.copyAssetIfNewer (asset, targetPath);
//PathHelper.mkdir (Path.directory (sourceAssetPath));
//FileHelper.linkFile (flatAssetPath, sourceAssetPath, true, true);
} else {
var targetPath = PathHelper.combine (projectDirectory, asset.targetPath);
PathHelper.mkdir (Path.directory (targetPath));
FileHelper.copyAsset (asset, targetPath, context);
}
}
if (project.targetFlags.exists ("xcode") && PlatformHelper.hostPlatform == Platform.MAC && command == "update") {
ProcessHelper.runCommand ("", "open", [ targetDirectory + "/" + project.app.file + ".xcodeproj" ] );
}
}
/*private function updateLaunchImage () {
var destination = buildDirectory + "/ios";
PathHelper.mkdir (destination);
var has_launch_image = false;
if (launchImages.length > 0) has_launch_image = true;
for (launchImage in launchImages) {
var splitPath = launchImage.name.split ("/");
var path = destination + "/" + splitPath[splitPath.length - 1];
FileHelper.copyFile (launchImage.name, path, context, false);
}
context.HAS_LAUNCH_IMAGE = has_launch_image;
}*/
public override function watch ():Void {
var dirs = WatchHelper.processHXML (project, getDisplayHXML ());
var command = WatchHelper.getCurrentCommand ();
WatchHelper.watch (project, command, dirs);
}
@ignore public override function install ():Void {}
@ignore public override function trace ():Void {}
@ignore public override function uninstall ():Void {}
}
private typedef IconSize = {
name:String,
size:Int,
}
private typedef SplashSize = {
name:String,
w:Int,
h:Int,
}
}

View File

@@ -298,7 +298,7 @@ class WindowsPlatform extends PlatformTarget {
if (IconHelper.createWindowsIcon (icons, iconPath) && PlatformHelper.hostPlatform == Platform.WINDOWS) {
var templates = [ PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates" ].concat (project.templatePaths);
var templates = [ PathHelper.getHaxelib (new Haxelib (#if lime "lime" #else "hxp" #end)) + "/templates" ].concat (project.templatePaths);
ProcessHelper.runCommand ("", PathHelper.findTemplate (templates, "bin/ReplaceVistaIcon.exe"), [ executablePath, iconPath, "1" ], true, true);
}
@@ -403,13 +403,31 @@ class WindowsPlatform extends PlatformTarget {
var commands = [];
if (targetFlags.exists ("64")) {
if (!targetFlags.exists ("32") && PlatformHelper.hostArchitecture == X64) {
commands.push ([ "-Dwindow", "-DHXCPP_M64" ]);
if (targetFlags.exists ("winrt")) {
commands.push ([ "-Dwinrt", "-DHXCPP_M64" ]);
} else {
commands.push ([ "-Dwindows", "-DHXCPP_M64" ]);
}
} else {
}
if (!targetFlags.exists ("64") && (command == "rebuild" || PlatformHelper.hostArchitecture == Architecture.X86)) {
commands.push ([ "-Dwindow", "-DHXCPP_M32" ]);
if (targetFlags.exists ("winrt")) {
commands.push ([ "-Dwinrt", "-DHXCPP_M32" ]);
} else {
commands.push ([ "-Dwindows", "-DHXCPP_M32" ]);
}
}
@@ -552,19 +570,16 @@ class WindowsPlatform extends PlatformTarget {
if (targetType == "cpp" && project.targetFlags.exists ("static")) {
// TODO: Better way to detect the suffix HXCPP will use?
var programFiles = project.environment.get ("ProgramFiles(x86)");
var hasVSCommunity = (programFiles != null && FileSystem.exists (PathHelper.combine (programFiles, "Microsoft Visual Studio/Installer/vswhere.exe")));
var hxcppMSVC = project.environment.get ("HXCPP_MSVC");
var vs140 = project.environment.get ("VS140COMNTOOLS");
var msvc19 = true;
var olderVersions = [ "120", "110", "100", "90", "80", "71", "70" ];
for (olderVersion in olderVersions) {
if ((!hasVSCommunity && vs140 == null) || (hxcppMSVC != null && hxcppMSVC != vs140)) {
if (project.environment.exists ("VS" + olderVersion + "COMNTOOLS")) {
msvc19 = false;
break;
}
msvc19 = false;
}
@@ -867,4 +882,4 @@ class WindowsPlatform extends PlatformTarget {
@ignore public override function uninstall ():Void {}
}
}

View File

@@ -3,6 +3,7 @@
-D lime-curl
-D lime-cffi
-D lime
-cp platforms
-cp ../src
-lib format
-lib hxp