More changes to build lime with AppleTV support (not yet finished)

This commit is contained in:
Valerio Santinelli
2015-09-30 09:13:34 +02:00
parent 253ad82ecd
commit 130e8e703e
7 changed files with 40 additions and 31 deletions

View File

@@ -20,11 +20,11 @@ class TVOSHelper {
initialize (project);
var platformName = "iphoneos";
var platformName = "appletvos";
if (project.targetFlags.exists ("simulator")) {
platformName = "iphonesimulator";
platformName = "appletvsimulator";
}
@@ -36,7 +36,7 @@ class TVOSHelper {
}
var iphoneVersion = project.environment.get ("IPHONE_VER");
var iphoneVersion = project.environment.get ("TVOS_VER");
var commands = [ "-configuration", configuration, "PLATFORM_NAME=" + platformName, "SDKROOT=" + platformName + iphoneVersion ];
if (project.targetFlags.exists("simulator")) {
@@ -61,11 +61,11 @@ class TVOSHelper {
initialize (project);
var platformName = "iPhoneOS";
var platformName = "AppleTVOS";
if (project.targetFlags.exists ("simulator")) {
platformName = "iPhoneSimulator";
platformName = "AppleTVSimulator";
}
@@ -79,7 +79,8 @@ class TVOSHelper {
}
directory += "/Platforms/" + platformName + ".platform/Developer/SDKs/" + platformName + project.environment.get ("IPHONE_VER") + ".sdk";
directory += "/Platforms/" + platformName + ".platform/Developer/SDKs/" + platformName + project.environment.get ("TVOS_VER") + ".sdk";
LogHelper.info(directory);
return directory;
}
@@ -87,19 +88,19 @@ class TVOSHelper {
private static function getIOSVersion (project:HXProject):Void {
if (!project.environment.exists("IPHONE_VER")) {
if (!project.environment.exists("TVOS_VER")) {
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";
var dev_path = project.environment.get("DEVELOPER_DIR") + "/Platforms/AppleTVOS.platform/Developer/SDKs";
if (FileSystem.exists (dev_path)) {
var best = "";
var files = FileSystem.readDirectory (dev_path);
var extract_version = ~/^iPhoneOS(.*).sdk$/;
var extract_version = ~/^AppleTVOS(.*).sdk$/;
for (file in files) {
if (extract_version.match (file)) {
@@ -110,7 +111,7 @@ class TVOSHelper {
}
if (best != "")
project.environment.set ("IPHONE_VER", best);
project.environment.set ("TVOS_VER", best);
}
}
@@ -191,7 +192,7 @@ class TVOSHelper {
} else {
applicationPath = workingDirectory + "/build/" + configuration + "-iphonesimulator/" + project.app.file + ".app";
applicationPath = workingDirectory + "/build/" + configuration + "-appletvsimulator/" + project.app.file + ".app";
}
@@ -200,8 +201,8 @@ class TVOSHelper {
Sys.command ("chmod", [ "+x", launcher ]);
// device config
var defaultDevice = "iphone-6";
var devices:Array<String> = ["iphone-4s", "iphone-5", "iphone-5s", "iphone-6-plus", "iphone-6", "ipad-2", "ipad-retina", "ipad-air"];
var defaultDevice = "appletv";
var devices:Array<String> = ["appletv", "iphone-4s", "iphone-5", "iphone-5s", "iphone-6-plus", "iphone-6", "ipad-2", "ipad-retina", "ipad-air"];
var oldDevices:Map<String, String> = ["iphone" => "iphone-6", "ipad" => "ipad-air"];
var deviceFlag:String = null;
@@ -271,7 +272,7 @@ class TVOSHelper {
} else {
applicationPath = workingDirectory + "/build/" + configuration + "-iphoneos/" + project.app.file + ".app";
applicationPath = workingDirectory + "/build/" + configuration + "-appletvos/" + project.app.file + ".app";
}
@@ -317,7 +318,7 @@ class TVOSHelper {
}
var applicationPath = "build/" + configuration + "-iphoneos/" + project.app.file + ".app";
var applicationPath = "build/" + configuration + "-appletvos/" + project.app.file + ".app";
commands.push (applicationPath);
ProcessHelper.runCommand (workingDirectory, "codesign", commands, true, true);

View File

@@ -203,7 +203,7 @@ class TVOSPlatform extends PlatformTarget {
context.REQUIRED_CAPABILITY = requiredCapabilities;
context.ARM64 = arm64;
context.TARGET_DEVICES = switch (project.config.getString ("ios.device", "universal")) { case "iphone": "1"; case "ipad": "2"; default: "1,2"; }
context.DEPLOYMENT = project.config.getString ("ios.deployment", "5.1.1");
context.DEPLOYMENT = project.config.getString ("tvos.deployment", "9.0");
if (project.config.getString ("tvos.compiler") == "llvm" || project.config.getString ("tvos.compiler", "clang") == "clang") {
@@ -313,9 +313,9 @@ class TVOSPlatform extends PlatformTarget {
var commands = [];
if (arm64) commands.push ([ "-Dtvos", "-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARM64" ]);
if (i386) commands.push ([ "-Dtvos", "-Dios", "-Dsimulator", "-DHXCPP_CPP11" ]);
if (x86_64) commands.push ([ "-Dtvos", "-Dios", "-Dsimulator", "-DHXCPP_M64", "-DHXCPP_CPP11" ]);
if (arm64) commands.push ([ "-Dtvos", "-DHXCPP_CPP11", "-DHXCPP_ARM64" ]);
if (i386) commands.push ([ "-Dtvos", "-Dsimulator", "-DHXCPP_CPP11" ]);
if (x86_64) commands.push ([ "-Dtvos", "-Dsimulator", "-DHXCPP_M64", "-DHXCPP_CPP11" ]);
CPPHelper.rebuild (project, commands);
@@ -476,18 +476,18 @@ class TVOSPlatform extends PlatformTarget {
//if (ndll.haxelib != null) {
var releaseLib = PathHelper.getLibraryPath (ndll, "tvOS", "lib", libExt);
var releaseLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", libExt);
LogHelper.info("releaseLib: " + releaseLib);
var debugLib = PathHelper.getLibraryPath (ndll, "tvOS", "lib", libExt, true);
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, "tvOS", "lib", ".tvos.a");
releaseLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", ".appletvos.a");
LogHelper.info("alternative releaseLib: " + releaseLib);
debugLib = PathHelper.getLibraryPath (ndll, "tvOS", "lib", ".tvos.a", true);
debugLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", ".appletvos.a", true);
}

View File

@@ -8,6 +8,7 @@
<set name="lime-legacy" value="1" if="legacy || lime_legacy" />
<set name="ios" value="1" if="iphone" />
<set name="tvos" value="1" if="appletv" />
<set name="LIME_CAIRO" value="1" />
<set name="LIME_CURL" value="1" unless="emscripten" />
@@ -186,6 +187,8 @@
<compilerflag value="-DLIME_SDL" />
<compilerflag value="-DNATIVE_TOOLKIT_SDL_ANGLE" if="NATIVE_TOOLKIT_SDL_ANGLE" />
<compilerflag value="-D__IPHONEOS__" if="ios || tvos" />
<compilerflag value="-D__APPLETVOS__" if="tvos" />
<compilerflag value="-DAPPLETV" if="tvos" />
<file name="src/backend/sdl/SDLApplication.cpp" />
<file name="src/backend/sdl/SDLWindow.cpp" />

View File

@@ -14,7 +14,7 @@
#include <gl2.h>
#include <gl2ext.h>
#elif defined (IPHONE) || defined(TVOS)
#elif defined (IPHONE) || defined(APPLETV)
#define LIME_GLES
#include <OpenGLES/ES1/gl.h>

View File

@@ -49,21 +49,21 @@ build-haxe-i386:
@echo "Haxe simulator build: $(CONFIG)"
haxe Build.hxml -D simulator -cpp build/$(CONFIG) $(DEBUG)
cd build/$(CONFIG); export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dtvos -Dsimulator -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done`
cp build/$(CONFIG)/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphonesim.a ../lib/i386$(LIB_DEST)
cp build/$(CONFIG)/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).appletvsim.a ../lib/i386$(LIB_DEST)
touch ../Classes/Main.mm
build-haxe-x86_64:
@echo "Haxe simulator build: $(CONFIG)-64"
haxe Build.hxml -D simulator -D HXCPP_M64 -cpp build/$(CONFIG)-64 $(DEBUG)
cd build/$(CONFIG)-64; export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dtvos -Dsimulator -DHXCPP_M64 -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done`
cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphonesim-64.a ../lib/x86_64$(LIB_DEST)
cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).appletvsim-64.a ../lib/x86_64$(LIB_DEST)
touch ../Classes/Main.mm
build-haxe-arm64:
@echo "Haxe device build: $(CONFIG)-64"
haxe Build.hxml -D HXCPP_ARM64 -cpp build/$(CONFIG)-64 $(DEBUG)
cd build/$(CONFIG)-64; export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dtvos -DHXCPP_ARM64 -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done`
cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphoneos-64.a ../lib/arm64$(LIB_DEST)
cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).appletvos-64.a ../lib/arm64$(LIB_DEST)
touch ../Classes/Main.mm
clean:

View File

@@ -237,10 +237,15 @@ class CommandLineTools {
target = Platform.FIREFOX;
overrides.haxedefs.set ("firefoxos", "");
case "tvos":
case "appletv", "appletvos":
target = Platform.TVOS;
case "appletvsim":
target = Platform.TVOS;
targetFlags.set ("simulator", "");
default:
target = cast targetName.toLowerCase ();
@@ -754,7 +759,7 @@ class CommandLineTools {
LogHelper.println (" \x1b[1mlinux\x1b[0m -- Create a Linux application");
LogHelper.println (" \x1b[1mmac\x1b[0m -- Create a Mac OS X application");
LogHelper.println (" \x1b[1mtizen\x1b[0m -- Create a Tizen application");
LogHelper.println (" \x1b[1mtvos\x1b[0m -- Create a tvOS application");
LogHelper.println (" \x1b[1mtvos\x1b[0m -- Create an AppleTVOS application");
LogHelper.println (" \x1b[1mwebos\x1b[0m -- Create a webOS application");
LogHelper.println (" \x1b[1mwindows\x1b[0m -- Create a Windows application");
LogHelper.println ("");
@@ -770,7 +775,7 @@ class CommandLineTools {
LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-neko\x1b[0m -- Build with Neko instead of C++");
LogHelper.println (" \x1b[3m(mac|linux)\x1b[0m \x1b[1m-32\x1b[0m -- Compile for 32-bit instead of the OS default");
LogHelper.println (" \x1b[3m(mac|linux)\x1b[0m \x1b[1m-64\x1b[0m -- Compile for 64-bit instead of the OS default");
LogHelper.println (" \x1b[3m(ios|blackberry|tizen|webos)\x1b[0m \x1b[1m-simulator\x1b[0m -- Target the device simulator");
LogHelper.println (" \x1b[3m(ios|blackberry|tizen|tvos|webos)\x1b[0m \x1b[1m-simulator\x1b[0m -- Target the device simulator");
LogHelper.println (" \x1b[3m(ios)\x1b[0m \x1b[1m-simulator -ipad\x1b[0m -- Build/test for the iPad Simulator");
LogHelper.println (" \x1b[3m(android)\x1b[0m \x1b[1m-emulator\x1b[0m -- Target the device emulator");
LogHelper.println (" \x1b[3m(html5)\x1b[0m \x1b[1m-minify\x1b[0m -- Minify output using the Google Closure compiler");

View File

@@ -1604,7 +1604,7 @@ class PlatformSetup {
}
createPath (path + "/lib");
var libs = [ "android", "bada-wac", "bada", "blackberry", "ios", "mac", "qt", "tizen", "webos", "wp7" ];
var libs = [ "android", "bada-wac", "bada", "blackberry", "ios", "mac", "qt", "tizen", "tvos", "webos", "wp7" ];
for (archive in childArchives) {