Add LoongArch64 support (#428)

* Add LoongArch64 support

* Use refined preprocessor to determine loongarch64
This commit is contained in:
Catty Steve
2026-09-19 14:41:38 +08:00
committed by GitHub
parent f86bece796
commit 663631eb50
2 changed files with 30 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ function toolchain(_buildDir, _libDir)
{ "linux-ppc64le-gcc", "Linux (PPC64LE, GCC compiler)" },
{ "linux-ppc64le-clang", "Linux (PPC64LE, Clang compiler)" },
{ "linux-riscv64-gcc", "Linux (RISC-V 64, GCC compiler)" },
{ "linux-loongarch64-gcc", "Linux (LoongArch64, GCC compiler)" },
{ "ios-arm64", "iOS - ARM64" },
{ "ios-simulator", "iOS - Simulator" },
{ "tvos-arm64", "tvOS - ARM64" },
@@ -341,6 +342,9 @@ function toolchain(_buildDir, _libDir)
elseif "linux-riscv64-gcc" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-linux-riscv64-gcc"))
elseif "linux-loongarch64-gcc" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-linux-loongarch64-gcc"))
elseif "mingw-gcc" == _OPTIONS["gcc"] then
if not os.getenv("MINGW") then
print("Set MINGW environment variable.")
@@ -929,6 +933,20 @@ function toolchain(_buildDir, _libDir)
"-Wl,--gc-sections",
}
configuration { "linux-loongarch64*" }
buildoptions {
"-Wunused-value",
"-Wundef",
"-march=loongarch64"
}
links {
"rt",
"dl",
}
linkoptions {
"-Wl,--gc-sections",
}
configuration { "linux-ppc64le-gcc" }
targetdir (path.join(_buildDir, "linux_ppc64le_gcc/bin"))
objdir (path.join(_buildDir, "linux_ppc64le_gcc/obj"))
@@ -944,6 +962,11 @@ function toolchain(_buildDir, _libDir)
objdir (path.join(_buildDir, "linux_riscv64_gcc/obj"))
libdirs { path.join(_libDir, "lib/linux_riscv64_gcc") }
configuration { "linux-loongarch64-gcc" }
targetdir (path.join(_buildDir, "linux_loongarch64_gcc/bin"))
objdir (path.join(_buildDir, "linux_loongarch64_gcc/obj"))
libdirs { path.join(_libDir, "lib/linux_loongarch64_gcc") }
configuration { "wasm2js" }
targetdir (path.join(_buildDir, "wasm2js/bin"))
objdir (path.join(_buildDir, "wasm2js/obj"))