Merge branch '8.3.0-Dev' into 9.0.0-dev

This commit is contained in:
Joseph Cloutier
2024-09-23 17:48:48 -04:00
63 changed files with 1596 additions and 752 deletions

View File

@@ -485,15 +485,14 @@ class CommandLineTools
}
case MAC:
// if (System.hostArchitecture == X64) {
untyped $loader.path = $array(path + "Mac64/", $loader.path);
// } else {
// untyped $loader.path = $array (path + "Mac/", $loader.path);
// }
if (System.hostArchitecture == X64)
{
untyped $loader.path = $array(path + "Mac64/", $loader.path);
}
else if (System.hostArchitecture == ARM64)
{
untyped $loader.path = $array(path + "MacArm64/", $loader.path);
}
case LINUX:
var arguments = Sys.args();
@@ -998,12 +997,12 @@ class CommandLineTools
if (isBuildCommand)
{
Log.println(" \x1b[3m(windows|mac|linux|android)\x1b[0m \x1b[1m-static\x1b[0m -- Compile as a static C++ executable");
Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-32\x1b[0m -- Compile for 32-bit instead of the OS default");
Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-64\x1b[0m -- Compile for 64-bit instead of the OS default");
Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-x86_32\x1b[0m -- Compile for x86_32 instead of the OS default");
Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-x86_64\x1b[0m -- Compile for x86_64 instead of the OS default");
Log.println(" \x1b[3m(ios|android)\x1b[0m \x1b[1m-armv6\x1b[0m -- Compile for ARMv6 instead of the OS defaults");
Log.println(" \x1b[3m(ios|android)\x1b[0m \x1b[1m-armv7\x1b[0m -- Compile for ARMv7 instead of the OS defaults");
Log.println(" \x1b[3m(ios|android)\x1b[0m \x1b[1m-armv7s\x1b[0m -- Compile for ARMv7s instead of the OS defaults");
Log.println(" \x1b[3m(ios)\x1b[0m \x1b[1m-arm64\x1b[0m -- Compile for ARM64 instead of the OS defaults");
Log.println(" \x1b[3m(mac|ios|android)\x1b[0m \x1b[1m-arm64\x1b[0m -- Compile for ARM64 instead of the OS defaults");
Log.println(" \x1b[3m(ios)\x1b[0m \x1b[1m-nosign\x1b[0m -- Compile executable, but skip codesigning");
}
@@ -2241,11 +2240,11 @@ class CommandLineTools
overrides.architectures.push(value);
}
}
else if (argument == "-64")
else if (argument == "-64" || argument == "-x86_64")
{
overrides.architectures.push(Architecture.X64);
}
else if (argument == "-32")
else if (argument == "-32" || argument == "-x86_32")
{
overrides.architectures.push(Architecture.X86);
}

View File

@@ -35,7 +35,7 @@ class RunScript
if (!rebuildBinaries) return;
var platforms = ["Windows", "Mac", "Mac64", "Linux", "Linux64"];
var platforms = ["Windows", "Mac", "Mac64", "MacArm64", "Linux", "Linux64"];
for (platform in platforms)
{
@@ -64,7 +64,7 @@ class RunScript
System.runCommand(limeDirectory, "neko", args.concat(["windows", toolsDirectory]));
}
case "Mac", "Mac64":
case "Mac", "Mac64", "MacArm64":
if (System.hostPlatform == MAC)
{
System.runCommand(limeDirectory, "neko", args.concat(["mac", toolsDirectory]));

View File

@@ -67,8 +67,14 @@ class SVGExport
// }
case MAC:
untyped $loader.path = $array(path + "Mac/", $loader.path);
untyped $loader.path = $array(path + "Mac64/", $loader.path);
if (System.hostArchitecture == X64)
{
untyped $loader.path = $array(path + "Mac64/", $loader.path);
}
else if (System.hostArchitecture == ARM64)
{
untyped $loader.path = $array(path + "MacArm64/", $loader.path);
}
case LINUX:
var arguments = Sys.args();

View File

@@ -481,7 +481,7 @@ class AndroidPlatform extends PlatformTarget
context.ANDROID_APPLICATION = project.config.getKeyValueArray("android.application", {
"android:label": project.meta.title,
"android:allowBackup": "true",
"android:theme": "@android:style/Theme.NoTitleBar" + (project.window.fullscreen ? ".Fullscreen" : null),
"android:theme": "@android:style/Theme.NoTitleBar" + (project.window.fullscreen ? ".Fullscreen" : ""),
"android:hardwareAccelerated": "true",
"android:allowNativeHeapPointerTagging": context.ANDROID_TARGET_SDK_VERSION >= 30 ? "false" : null
});
@@ -490,9 +490,12 @@ class AndroidPlatform extends PlatformTarget
"android:exported": "true",
"android:launchMode": "singleTask",
"android:label": project.meta.title,
"android:configChanges": project.config.getArrayString("android.configChanges", ["keyboardHidden", "orientation", "screenSize", "screenLayout", "uiMode"]).join("|"),
"android:configChanges": project.config.getArrayString("android.configChanges",
["layoutDirection", "locale", "orientation", "uiMode", "screenLayout", "screenSize", "smallestScreenSize", "keyboard", "keyboardHidden", "navigation"])
.join("|"),
"android:screenOrientation": project.window.orientation == PORTRAIT ? "sensorPortrait" : (project.window.orientation == LANDSCAPE ? "sensorLandscape" : null)
});
context.ANDROID_ACCEPT_FILE_INTENT = project.config.getArrayString("android.accept-file-intent", []);
if (!project.environment.exists("ANDROID_SDK") || !project.environment.exists("ANDROID_NDK_ROOT"))
{
@@ -595,17 +598,17 @@ class AndroidPlatform extends PlatformTarget
{
if (FileSystem.isDirectory(javaPath))
{
System.recursiveCopy(javaPath, sourceSet + "/java", context, true);
recursiveCopy(javaPath, sourceSet + "/java", context, true);
}
else
{
if (Path.extension(javaPath) == "jar")
{
System.copyIfNewer(javaPath, destination + "/app/libs/" + Path.withoutDirectory(javaPath));
copyIfNewer(javaPath, destination + "/app/libs/" + Path.withoutDirectory(javaPath));
}
else
{
System.copyIfNewer(javaPath, sourceSet + "/java/" + Path.withoutDirectory(javaPath));
copyIfNewer(javaPath, sourceSet + "/java/" + Path.withoutDirectory(javaPath));
}
}
}
@@ -618,7 +621,7 @@ class AndroidPlatform extends PlatformTarget
for (library in cast(context.ANDROID_LIBRARY_PROJECTS, Array<Dynamic>))
{
System.recursiveCopy(library.source, destination + "/deps/" + library.name, context, true);
recursiveCopy(library.source, destination + "/deps/" + library.name, context, true);
}
ProjectHelper.recursiveSmartCopyTemplate(project, "android/template", destination, context);

View File

@@ -159,9 +159,9 @@ class HTML5Platform extends PlatformTarget
if (dependency.embed && StringTools.endsWith(dependency.path, ".js") && FileSystem.exists(dependency.path))
{
var script = File.getContent(dependency.path);
if (!dependency.webWorker)
if (!dependency.allowWebWorkers)
{
script = 'if(typeof window != "undefined") {\n' + script + "\n}";
script = 'if(typeof self === "undefined" || !self.constructor.name.includes("Worker")) { $script }';
}
context.embeddedLibraries.push(script);
}
@@ -438,7 +438,7 @@ class HTML5Platform extends PlatformTarget
var name = Path.withoutDirectory(dependency.path);
context.linkedLibraries.push("./" + dependencyPath + "/" + name);
System.copyIfNewer(dependency.path, Path.combine(destination, Path.combine(dependencyPath, name)));
copyIfNewer(dependency.path, Path.combine(destination, Path.combine(dependencyPath, name)));
}
}
}

View File

@@ -862,7 +862,7 @@ class IOSPlatform extends PlatformTarget
fileName = "lib" + fileName;
}
System.copyIfNewer(dependency.path, projectDirectory + "/lib/" + arch + "/" + fileName);
copyIfNewer(dependency.path, projectDirectory + "/lib/" + arch + "/" + fileName);
}
}
}

View File

@@ -120,7 +120,7 @@ class LinuxPlatform extends PlatformTarget
for (architecture in project.architectures)
{
if (!targetFlags.exists("32") && architecture == Architecture.X64)
if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && architecture == Architecture.X64)
{
is64 = true;
}
@@ -507,12 +507,12 @@ class LinuxPlatform extends PlatformTarget
}
else
{
if (!targetFlags.exists("32") && System.hostArchitecture == X64)
if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && System.hostArchitecture == X64)
{
commands.push(["-Dlinux", "-DHXCPP_M64"]);
}
if (!targetFlags.exists("64") && (command == "rebuild" || System.hostArchitecture == X86))
if (!targetFlags.exists("64") && !targetFlags.exists("x86_64") && (command == "rebuild" || System.hostArchitecture == X86))
{
commands.push(["-Dlinux", "-DHXCPP_M32"]);
}

View File

@@ -423,7 +423,11 @@ class MacPlatform extends PlatformTarget
// TODO: Support single binary
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64", "-Dhashlink"]);
}
else if (!targetFlags.exists("32"))
else if (targetFlags.exists("arm64"))
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARM64"]);
}
else if (!targetFlags.exists("32") && !targetFlags.exists("x86_32"))
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64"]);
}
@@ -434,7 +438,19 @@ class MacPlatform extends PlatformTarget
case X86:
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M32"]);
case ARM64:
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARM64"]);
if (targetFlags.exists("hl"))
{
// hashlink doesn't support arm64 macs yet
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARCH=x86_64", "-Dhashlink"]);
}
else if (targetFlags.exists("64") || targetFlags.exists("x86_64"))
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARCH=x86_64"]);
}
else
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARM64"]);
}
default:
}
@@ -584,7 +600,12 @@ class MacPlatform extends PlatformTarget
private inline function get_dirSuffix():String
{
return targetArchitecture == X64 ? "64" : "";
if (targetFlags.exists("hl"))
{
// hashlink doesn't support arm64 macs yet
return "64";
}
return targetArchitecture == X64 ? "64" : targetArchitecture == ARM64 ? "Arm64" : "";
}
/**
@@ -710,23 +731,13 @@ class MacPlatform extends PlatformTarget
if (isLibrary)
{
var newId = "@executable_path/" + fileName;
var process = new Process("install_name_tool", ["-id", newId, absoluteFilePath]);
var exitCode = process.exitCode(true);
if (exitCode != 0)
{
Log.error('install_name_tool -id process exited with code: <${exitCode}> for file <${fileName}>');
}
System.runCommand("", "install_name_tool", ["-id", newId, absoluteFilePath]);
}
for (homebrewPath in homebrewDependencyPaths)
{
var newPath = "@executable_path/" + Path.withoutDirectory(homebrewPath);
var process = new Process("install_name_tool", ["-change", homebrewPath, newPath, absoluteFilePath]);
var exitCode = process.exitCode(true);
if (exitCode != 0)
{
Log.error('install_name_tool -change process exited with code: <${exitCode}> for file <${Path.withoutDirectory(homebrewPath)}>');
}
System.runCommand("", "install_name_tool", ["-change", homebrewPath, newPath, absoluteFilePath]);
}
}
}

View File

@@ -633,7 +633,7 @@ class TVOSPlatform extends PlatformTarget
fileName = "lib" + fileName;
}
System.copyIfNewer(dependency.path, projectDirectory + "/lib/" + arch + "/" + fileName);
copyIfNewer(dependency.path, projectDirectory + "/lib/" + arch + "/" + fileName);
}
}
}

View File

@@ -471,7 +471,7 @@ class WebAssemblyPlatform extends PlatformTarget
var name = Path.withoutDirectory(dependency.path);
context.linkedLibraries.push("./" + dependencyPath + "/" + name);
System.copyIfNewer(dependency.path, Path.combine(destination, Path.combine(dependencyPath, name)));
copyIfNewer(dependency.path, Path.combine(destination, Path.combine(dependencyPath, name)));
}
}
}

View File

@@ -145,7 +145,7 @@ class WindowsPlatform extends PlatformTarget
else if (project.targetFlags.exists("hl") || targetFlags.exists("hlc"))
{
targetType = "hl";
is64 = !project.flags.exists("32");
is64 = !project.flags.exists("32") && !project.flags.exists("x86_32");
}
else if (project.targetFlags.exists("cppia"))
{
@@ -286,7 +286,7 @@ class WindowsPlatform extends PlatformTarget
if (StringTools.endsWith(dependency.path, ".dll"))
{
var fileName = Path.withoutDirectory(dependency.path);
System.copyIfNewer(dependency.path, applicationDirectory + "/" + fileName);
copyIfNewer(dependency.path, applicationDirectory + "/" + fileName);
}
}
@@ -737,7 +737,8 @@ class WindowsPlatform extends PlatformTarget
if (targetType == "hl")
{
// default to 64 bit, just like upstream Hashlink releases
if (!targetFlags.exists("32") && (System.hostArchitecture == X64 || targetFlags.exists("64")))
if (!targetFlags.exists("32") && !targetFlags.exists("x86_32")
&& (System.hostArchitecture == X64 || targetFlags.exists("64") || targetFlags.exists("x86_64")))
{
commands.push(["-Dwindows", "-DHXCPP_M64", "-Dhashlink"]);
}
@@ -748,7 +749,7 @@ class WindowsPlatform extends PlatformTarget
}
else
{
if (!targetFlags.exists("64")
if (!targetFlags.exists("64") && !targetFlags.exists("x86_64")
&& (command == "rebuild" || System.hostArchitecture == X86 || (targetType != "cpp" && targetType != "winrt")))
{
if (targetType == "winrt")
@@ -765,7 +766,7 @@ class WindowsPlatform extends PlatformTarget
// as previous Windows builds. For now, force -64 to be done last
// so that it can be debugged in a default "rebuild"
if (!targetFlags.exists("32")
if (!targetFlags.exists("32") && !targetFlags.exists("x86_32")
&& System.hostArchitecture == X64
&& (command != "rebuild" || targetType == "cpp" || targetType == "winrt"))
{
@@ -1121,7 +1122,7 @@ class WindowsPlatform extends PlatformTarget
var name = Path.withoutDirectory(dependency.path);
context.linkedLibraries.push("./js/lib/" + name);
System.copyIfNewer(dependency.path, Path.combine(destination, Path.combine("js/lib", name)));
copyIfNewer(dependency.path, Path.combine(destination, Path.combine("js/lib", name)));
}
}