From 130e8e703e52436c7d5de6a57fe5999a30f94ecb Mon Sep 17 00:00:00 2001 From: Valerio Santinelli Date: Wed, 30 Sep 2015 09:13:34 +0200 Subject: [PATCH] More changes to build lime with AppleTV support (not yet finished) --- lime/tools/helpers/TVOSHelper.hx | 31 ++++++++++++++-------------- lime/tools/platforms/TVOSPlatform.hx | 16 +++++++------- project/Build.xml | 3 +++ project/src/graphics/opengl/OpenGL.h | 2 +- templates/tvos/PROJ/haxe/makefile | 6 +++--- tools/CommandLineTools.hx | 11 +++++++--- tools/utils/PlatformSetup.hx | 2 +- 7 files changed, 40 insertions(+), 31 deletions(-) diff --git a/lime/tools/helpers/TVOSHelper.hx b/lime/tools/helpers/TVOSHelper.hx index 438aec83c..ae6caa49a 100644 --- a/lime/tools/helpers/TVOSHelper.hx +++ b/lime/tools/helpers/TVOSHelper.hx @@ -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 = ["iphone-4s", "iphone-5", "iphone-5s", "iphone-6-plus", "iphone-6", "ipad-2", "ipad-retina", "ipad-air"]; + var defaultDevice = "appletv"; + var devices:Array = ["appletv", "iphone-4s", "iphone-5", "iphone-5s", "iphone-6-plus", "iphone-6", "ipad-2", "ipad-retina", "ipad-air"]; var oldDevices:Map = ["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); diff --git a/lime/tools/platforms/TVOSPlatform.hx b/lime/tools/platforms/TVOSPlatform.hx index b0322d79a..33b88a5f9 100644 --- a/lime/tools/platforms/TVOSPlatform.hx +++ b/lime/tools/platforms/TVOSPlatform.hx @@ -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); } diff --git a/project/Build.xml b/project/Build.xml index 4529a841f..95fdab72c 100644 --- a/project/Build.xml +++ b/project/Build.xml @@ -8,6 +8,7 @@ + @@ -186,6 +187,8 @@ + + diff --git a/project/src/graphics/opengl/OpenGL.h b/project/src/graphics/opengl/OpenGL.h index 501d44dc7..3a6d878e4 100644 --- a/project/src/graphics/opengl/OpenGL.h +++ b/project/src/graphics/opengl/OpenGL.h @@ -14,7 +14,7 @@ #include #include -#elif defined (IPHONE) || defined(TVOS) +#elif defined (IPHONE) || defined(APPLETV) #define LIME_GLES #include diff --git a/templates/tvos/PROJ/haxe/makefile b/templates/tvos/PROJ/haxe/makefile index f217e2e35..c9a752afd 100644 --- a/templates/tvos/PROJ/haxe/makefile +++ b/templates/tvos/PROJ/haxe/makefile @@ -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: diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index fcb236dd6..6d34e3815 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -237,9 +237,14 @@ 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: @@ -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"); diff --git a/tools/utils/PlatformSetup.hx b/tools/utils/PlatformSetup.hx index 4ad256e7b..53672dc23 100644 --- a/tools/utils/PlatformSetup.hx +++ b/tools/utils/PlatformSetup.hx @@ -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) {