Skip to content

Commit

Permalink
Add new CPU architecture---LoongArch (#54)
Browse files Browse the repository at this point in the history
* add loongarch support

* add loongarch support

* add loongarch support

* add loongarch support
  • Loading branch information
wangchenguang123 authored Dec 18, 2023
1 parent 64d8f7a commit 21a622d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.badlogic.gdx.utils;

public enum Architecture {
x86, ARM, RISCV;
x86, ARM, RISCV,LOONGARCH;

public String toSuffix() {
if (this == x86) return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ else if (System.getProperty("os.name").contains("Mac"))
architecture = Architecture.ARM;
else if (System.getProperty("os.arch").startsWith("riscv"))
architecture = Architecture.RISCV;
else if (System.getProperty("os.arch").startsWith("loongarch"))
architecture = Architecture.LOONGARCH;

if (System.getProperty("os.arch").contains("64") || System.getProperty("os.arch").startsWith("armv8"))
bitness = Architecture.Bitness._64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ public static BuildTarget newDefaultTarget (Os type, Architecture.Bitness bitnes
"-Wl,--kill-at -shared -static -static-libgcc -static-libstdc++ -m64");
}

if (type == Os.Linux && architecture == Architecture.LOONGARCH && bitness == Architecture.Bitness._64) {
// Linux LoongArch 64-Bit
BuildTarget target = new BuildTarget(Os.Linux, Architecture.Bitness._64, new String[] {"**/*.c"}, new String[0], new String[] {"**/*.cpp"},
new String[0], new String[0], "loongarch64-unknown-linux-gnu-", "-c -Wall -O2 -fmessage-length=0 -fPIC",
"-c -Wall -O2 -fmessage-length=0 -fPIC", "-shared");
target.architecture = Architecture.LOONGARCH;
return target;
}

if (type == Os.Linux && architecture == Architecture.RISCV && bitness == Architecture.Bitness._32) {
// Linux RISCV 32-Bit
BuildTarget target = new BuildTarget(Os.Linux, Architecture.Bitness._32, new String[] {"**/*.c"}, new String[0], new String[] {"**/*.cpp"},
Expand Down

0 comments on commit 21a622d

Please sign in to comment.