MacPlatform: can specify -clang with -hlc to use clang instead of gcc

This commit is contained in:
Josh Tynjala
2023-11-03 12:11:23 -07:00
parent 6e19e26f45
commit 10635d6231

View File

@@ -210,13 +210,14 @@ class MacPlatform extends PlatformTarget
if (project.targetFlags.exists("hlc")) if (project.targetFlags.exists("hlc"))
{ {
var compiler = project.targetFlags.exists("clang") ? "clang" : "gcc";
// the libraries were compiled as x86_64, so if the build is // the libraries were compiled as x86_64, so if the build is
// happening on ARM64 instead, we need to ensure that the // happening on ARM64 instead, we need to ensure that the
// same architecture is used for the executable, so we wrap our // same architecture is used for the executable, so we wrap our
// compiler command with the `arch -x86_64` command. // compiler command with the `arch -x86_64` command.
// if we ever support ARM or Universal binaries, this will // if we ever support ARM or Universal binaries, this will
// need to be handled differently. // need to be handled differently.
var command = ["arch", "-x86_64", "gcc", "-O3", "-o", executablePath, "-std=c11", "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c")]; var command = ["arch", "-x86_64", compiler, "-O3", "-o", executablePath, "-std=c11", "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c")];
for (file in System.readDirectory(executableDirectory)) for (file in System.readDirectory(executableDirectory))
{ {
switch Path.extension(file) switch Path.extension(file)