Fix 'cannot find build target by' error, increase consistency of C++ builds

This commit is contained in:
Joshua Granick
2016-12-15 21:04:44 -08:00
parent 44e79554e1
commit f358c92002
4 changed files with 48 additions and 43 deletions

View File

@@ -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")) {
// var list;
// var input = File.read (options, false);
// var text = input.readLine ();
list = text.split (" ");
// if (StringTools.startsWith (text, " -D")) {
} else {
// list = text.split (" ");
list = [ "-D" + StringTools.trim (text) ];
// } else {
while (!input.eof ()) {
// list = [ "-D" + StringTools.trim (text) ];
list.push ("-D" + StringTools.trim (input.readLine ()));
// while (!input.eof ()) {
}
// list.push ("-D" + StringTools.trim (input.readLine ()));
list.pop ();
// }
}
// list.pop ();
for (option in list) {
// }
if (option != "" && !StringTools.startsWith (option, "-Dno_compilation") && !StringTools.startsWith (option, "-Dno-compilation")) {
// for (option in list) {
args.push (option);
// 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");
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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