Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added arc-core/.temp/336a72a4/libarc64.so
Binary file not shown.
28 changes: 19 additions & 9 deletions arc-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ jar{
}
}

//now, you may ask: why don't I make this a new module? why do I include JARs in the repository? why don't I make this a separate build step?
//the reason is: I don't want to deal with compiler arguments, --add-opens, or whatever else Java throws at you these days
//this just works and I don't want to touch it, it's a dependency that has already been compiled and won't explode as much as source compilation might
//"why are you using unsafe, why aren't you using the new memory access APIs?" because they don't work on Android or iOS
//and no, I cannot work with buffer put() because of Java's idiotic design making it so that you need to put()/limit()/position() to write memory, breaking multithreading
//this makes Unsafe the only viable option - any "state independent" methods are Java-16 specific, and iOS/Android don't support those
/*
now, you may ask: why don't I make this a new module? why do I include JARs in the repository? why don't I make this a separate build step?
the reason is: I don't want to deal with compiler arguments, --add-opens, or whatever else Java throws at you these days
this just works and I don't want to touch it, it's a dependency that has already been compiled and won't explode as much as source compilation might
"why are you using unsafe, why aren't you using the new memory access APIs?" because they don't work on Android or iOS
and no, I cannot work with buffer put() because of Java's idiotic design making it so that you need to put()/limit()/position() to write memory, breaking multithreading
this makes Unsafe the only viable option - any "state independent" methods are Java-16 specific, and iOS/Android don't support those

tbh skill issue but im not gonna make seperate build for ts
*/

tasks.register("compileBuffersUnsafe", Exec){
workingDir "unsafe"
Expand All @@ -50,9 +54,11 @@ tasks.register("recompileUnsafe", Exec){
}

test{
testLogging{
exceptionFormat = 'full'
showStandardStreams = true
systemProperty "java.library.path", project(":backends:backend-sdl").file("libs/freebsd64").absolutePath
//more more log
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

Expand Down Expand Up @@ -186,3 +192,7 @@ jnigenBuild.finalizedBy postJni
getTasksByName("jnigen", true).each{
it.dependsOn preJni
}

tasks.withType(Jar).all {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
Binary file added arc-core/libarc64.so
Binary file not shown.
4 changes: 3 additions & 1 deletion arc-core/src/arc/util/OS.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public class OS{
public static final int javaVersionNumber = OS.isAndroid || OS.isIos || javaVersion == null || !javaVersion.contains(".") ? 0 : javaVersion.startsWith("1.") ? 8 : Strings.parseInt(javaVersion.substring(0, javaVersion.indexOf('.')), 8);

public static boolean isWindows = propNoNull("os.name").contains("Windows");
public static boolean isLinux = propNoNull("os.name").contains("Linux") || propNoNull("os.name").contains("BSD");
public static boolean isLinux = propNoNull("os.name").contains("Linux");
// DONT CHANGE THIS ELSE IT WONT WORK FOR OTHER BSD'S AND FREEBSD 15.X
public static boolean isFreeBSD = propNoNull("os.name").contains("FreeBSD") || propNoNull("os.name").contains("BSD");
public static boolean isMac = propNoNull("os.name").contains("Mac");
public static boolean isIos = false;
public static boolean isAndroid = false;
Expand Down
3 changes: 2 additions & 1 deletion arc-core/src/arc/util/SharedLibraryLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public String crc(InputStream input){
public String mapLibraryName(String libraryName){
if(isWindows) return libraryName + (is64Bit ? "64.dll" : ".dll");
if(isLinux) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.so" : ".so");
if(isMac) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.dylib" : ".dylib");
if(isFreeBSD) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.so" : ".so");
if(isMac) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.dylib" : ".dylib");
return libraryName;
}

Expand Down
33 changes: 32 additions & 1 deletion backends/backend-sdl/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sourceSets.main.java.srcDirs = ["src"]
sourceSets.main.resources.srcDirs = ["libs/linux64", "libs/macosx64","libs/windows32", "libs/windows64", "libs/openal"]
sourceSets.main.resources.srcDirs = ["libs/linux64", "libs/macosx64","libs/windows32", "libs/windows64", "libs/openal", "libs/freebsd64"]

dependencies {
testImplementation libraries.jnigen
Expand Down Expand Up @@ -131,3 +131,34 @@ getTasksByName("jnigen", true).each{
it.dependsOn classes
it.dependsOn aproj(":arc-core").getTasksByName("compileJava", true)
}

//gdx-jnigen doesnt supports freebsd so this xml needs to stay at here

task natives(type: Exec) {
// wait until jnigen
dependsOn jnigen

def nativesDir = "jni"
workingDir nativesDir
def osName = System.getProperty("os.name")

// runs our xml and "ant" crap for freebsd/generic bsd
if (osName.contains("FreeBSD") || osName.contains("BSD")) {
println "FreeBSD detected, Running build-freebsd64.xml..."
commandLine "ant", "-f", "build-freebsd64.xml", "-v"
}
// runs "ant" crap for others (why anuke :c)
else if (osName.contains("Linux")) {
commandLine "ant", "-f", "build-linux64.xml", "-v"
} else if (osName.contains("Mac")) {
commandLine "ant", "-f", "build-macosx64.xml", "-v"
} else if (osName.contains("Windows")) {
//README: idk if this right, ive never used windows since 1968
commandLine "cmd", "/c", "ant", "-f", "build-windows64.xml", "-v"
}
}

// runs natives while generating jar
tasks.named('jar') {
dependsOn 'natives'
}
2 changes: 2 additions & 0 deletions natives/build-freebsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: freebsd build script
# no need anymore i implemented it inside build.gradle