From f358c9200221b0f1f5c8f53010f23a16bf97bf4b Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Thu, 15 Dec 2016 21:04:44 -0800 Subject: [PATCH] Fix 'cannot find build target by' error, increase consistency of C++ builds --- lime/tools/helpers/CPPHelper.hx | 59 +++++++++++++++-------------- lime/tools/helpers/IOSHelper.hx | 2 +- lime/tools/platforms/IOSPlatform.hx | 12 +++++- templates/iphone/PROJ/haxe/makefile | 18 +++------ 4 files changed, 48 insertions(+), 43 deletions(-) diff --git a/lime/tools/helpers/CPPHelper.hx b/lime/tools/helpers/CPPHelper.hx index 250044f70..f7cf920f4 100644 --- a/lime/tools/helpers/CPPHelper.hx +++ b/lime/tools/helpers/CPPHelper.hx @@ -30,37 +30,40 @@ class CPPHelper { if (FileSystem.exists (options)) { - var list; - var input = File.read (options, false); - var text = input.readLine (); + args.push ("-options"); + args.push (options); - if (StringTools.startsWith (text, " -D")) { - - list = text.split (" "); - - } else { - - list = [ "-D" + StringTools.trim (text) ]; - - while (!input.eof ()) { - - list.push ("-D" + StringTools.trim (input.readLine ())); - - } - - list.pop (); - - } + // var list; + // var input = File.read (options, false); + // var text = input.readLine (); - for (option in list) { + // if (StringTools.startsWith (text, " -D")) { - if (option != "" && !StringTools.startsWith (option, "-Dno_compilation") && !StringTools.startsWith (option, "-Dno-compilation")) { - - args.push (option); - - } + // list = text.split (" "); - } + // } else { + + // list = [ "-D" + StringTools.trim (text) ]; + + // while (!input.eof ()) { + + // list.push ("-D" + StringTools.trim (input.readLine ())); + + // } + + // list.pop (); + + // } + + // for (option in list) { + + // if (option != "" && !StringTools.startsWith (option, "-Dno_compilation") && !StringTools.startsWith (option, "-Dno-compilation")) { + + // args.push (option); + + // } + + // } foundOptions = true; @@ -96,7 +99,7 @@ class CPPHelper { if (project.debug) { - args.push ("-Ddebug"); + args.push ("-debug"); } diff --git a/lime/tools/helpers/IOSHelper.hx b/lime/tools/helpers/IOSHelper.hx index 2ab13a5b7..76c39fbe6 100644 --- a/lime/tools/helpers/IOSHelper.hx +++ b/lime/tools/helpers/IOSHelper.hx @@ -108,7 +108,7 @@ class IOSHelper { var files = FileSystem.readDirectory (devPath); var extractVersion = ~/^iPhoneOS(.*).sdk$/; - var best = "", version; + var best = "0", version; for (file in files) { diff --git a/lime/tools/platforms/IOSPlatform.hx b/lime/tools/platforms/IOSPlatform.hx index 677b892de..97b5d14ee 100644 --- a/lime/tools/platforms/IOSPlatform.hx +++ b/lime/tools/platforms/IOSPlatform.hx @@ -89,6 +89,7 @@ class IOSPlatform extends PlatformTarget { var hxml = PathHelper.findTemplate (project.templatePaths, "iphone/PROJ/haxe/Build.hxml"); var template = new Template (File.getContent (hxml)); + project = project.clone (); var context = generateContext (); context.OUTPUT_DIR = targetDirectory; @@ -100,7 +101,7 @@ class IOSPlatform extends PlatformTarget { private function generateContext ():Dynamic { - project = project.clone (); + //project = project.clone (); project.sources.unshift (""); project.sources = PathHelper.relocatePaths (project.sources, PathHelper.combine (targetDirectory, project.app.file + "/haxe")); @@ -127,6 +128,15 @@ class IOSPlatform extends PlatformTarget { IOSHelper.getIOSVersion (project); project.haxedefs.set ("IPHONE_VER", project.environment.get ("IPHONE_VER")); + project.haxedefs.set ("HXCPP_CPP11", "1"); + + if (project.config.getString ("ios.compiler") == "llvm" || project.config.getString ("ios.compiler", "clang") == "clang") { + + project.haxedefs.set ("HXCPP_CLANG", "1"); + project.haxedefs.set ("OBJC_ARC", "1"); + + } + var context = project.templateContext; context.HAS_ICON = false; diff --git a/templates/iphone/PROJ/haxe/makefile b/templates/iphone/PROJ/haxe/makefile index 57ba87a0e..d0f3b6787 100644 --- a/templates/iphone/PROJ/haxe/makefile +++ b/templates/iphone/PROJ/haxe/makefile @@ -19,20 +19,12 @@ default: debug_print ifeq ("$(BUILD_STYLE)","Debug") DEBUG := -debug - DEF_DEBUG := -Ddebug CONFIG := Debug else DEBUG := - DEF_DEBUG := CONFIG := Release endif -ifeq ("$(CLANG_ENABLE_OBJC_ARC)", "YES") - HXCPP_CLANG := -DHXCPP_CLANG -DOBJC_ARC -else - HXCPP_CLANG := -endif - HAXE_OS := $(PLATFORM_NAME) ifeq ("$(HAXE_OS)","iphonesimulator") HAXE_OS := iphonesim @@ -48,35 +40,35 @@ LIB_DEST := $(DEBUG)/libApplicationMain.a build-haxe-i386: @echo "Haxe simulator build: $(CONFIG)" haxe Build.hxml -D simulator -cpp build/$(CONFIG) $(DEBUG) - cd build/$(CONFIG); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dios -Diphone -Dsimulator -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done` + cd build/$(CONFIG); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt cp build/$(CONFIG)/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphonesim.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; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dios -Diphone -Dsimulator -DHXCPP_M64 -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done` + cd build/$(CONFIG)-64; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphonesim-64.a ../lib/x86_64$(LIB_DEST) touch ../Classes/Main.mm build-haxe-armv6: @echo "Haxe device build: $(CONFIG)" haxe Build.hxml -D HXCPP_ARMV6 -cpp build/$(CONFIG) $(DEBUG) - cd build/$(CONFIG); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dios -Diphone -DHXCPP_ARMV6 -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done` + cd build/$(CONFIG); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt cp build/$(CONFIG)/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphoneos.a ../lib/armv6$(LIB_DEST) touch ../Classes/Main.mm build-haxe-armv7: @echo "Haxe device build: $(CONFIG)-v7" haxe Build.hxml -D HXCPP_ARMV7 -cpp build/$(CONFIG)-v7 $(DEBUG) - cd build/$(CONFIG)-v7; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dios -Diphone -DHXCPP_ARMV7 -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done` + cd build/$(CONFIG)-v7; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt cp build/$(CONFIG)-v7/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphoneos-v7.a ../lib/armv7$(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; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml -Dios -Diphone -DHXCPP_ARM64 -DHXCPP_CPP11 $(DEF_DEBUG) $(HXCPP_CLANG) `cat Options.txt | while read LINE; do printf " -D$$LINE"; done` + cd build/$(CONFIG)-64; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphoneos-64.a ../lib/arm64$(LIB_DEST) touch ../Classes/Main.mm