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
23 changes: 22 additions & 1 deletion .github/workflows/natives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,47 @@ jobs:
with:
java-version: 1.8
- name: Install dependencies
run: sudo apt install g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 gcc-mingw-w64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 libasound2-dev libdrm-dev libsdl2-dev libgbm-dev
run: sudo apt install g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 gcc-mingw-w64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 libasound2-dev libdrm-dev libsdl2-dev libgbm-dev binutils-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
- name: Set env
run: echo "NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
- name: Build natives
run: |
./gradlew arc-core:jnigenBuild
./gradlew extensions:freetype:jnigenBuild
./gradlew backends:backend-sdl:jnigenBuild
# ARM SDL build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build ARM SDL Docker Image
uses: docker/build-push-action@v6
with:
tags: arc-arm-sdl:latest
load: true
platforms: linux/arm64
- name: Extract ARM SDL library from the container
uses: shrink/actions-docker-extract@v3
id: extract
with:
image: arc-arm-sdl:latest
path: /home/Arc/backends/backend-sdl/libs/linuxarm64/libsdl-arcarm64.so
destination: backends/backend-sdl/libs/linuxarm64
- name: Upload natives
uses: actions/upload-artifact@v4
with:
name: Arc-core desktop natives
path: |
natives/natives-desktop/libs/libarc64.so
natives/natives-desktop/libs/libarcarm64.so
natives/natives-desktop/libs/arc.dll
natives/natives-desktop/libs/arc64.dll
backends/backend-sdl/libs/linux64/libsdl-arc64.so
backends/backend-sdl/libs/linuxarm64/libsdl-arcarm64.so
backends/backend-sdl/libs/windows32/sdl-arc.dll
backends/backend-sdl/libs/windows64/sdl-arc64.dll
natives/natives-freetype-desktop/libs/libarc-freetype64.so
natives/natives-freetype-desktop/libs/libarc-freetypearm64.so
natives/natives-freetype-desktop/libs/arc-freetype.dll
natives/natives-freetype-desktop/libs/arc-freetype64.dll
- name: Upload Android natives
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move this somewhere else to avoid polluting the root directory?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing! I'd go for either the .github folder if GitHub doesn't mind or some other folder like .ci or something in that spirit.

Do you have a place in mind for it?

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM docker.io/azul/zulu-openjdk:8-latest

# Install dependencies
RUN apt update && apt install -y libasound2-dev libdrm-dev libsdl2-dev libgbm-dev libglew-dev ant binutils g++

# Copy the repository
COPY . /home/Arc
WORKDIR /home/Arc

# Run the SDL build
RUN ./gradlew backends:backend-sdl:jnigenBuildLinuxARM64
7 changes: 6 additions & 1 deletion arc-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jnigen{
cppFlags = "-DWITH_MINIAUDIO " + cppFlags
libraries += " -lpthread -lrt -lm -ldl"
}
add(Linux, x64, ARM){
cppIncludes += ["soloud/src/backend/miniaudio/*.cpp"]
cppFlags = "-DWITH_MINIAUDIO " + cppFlags
libraries += " -lpthread -lrt -lm -ldl"
}
add(Windows, x32){
cppIncludes += ["soloud/src/backend/miniaudio/*.cpp"]
cppFlags = "-msse -DWITH_MINIAUDIO " + cppFlags
Expand Down Expand Up @@ -118,7 +123,7 @@ task preJni{
task postJni{
doLast{
copy{
from "libs/linux64", "libs/windows32", "libs/windows64", "libs/macosx64"
from "libs/linux64", "libs/linuxarm64", "libs/windows32", "libs/windows64", "libs/macosx64"
into "../natives/natives-desktop/libs"
include "**"
}
Expand Down
31 changes: 20 additions & 11 deletions 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/linuxarm64", "libs/macosx64","libs/windows32", "libs/windows64", "libs/openal"]

dependencies {
testImplementation libraries.jnigen
Expand Down Expand Up @@ -79,15 +79,6 @@ jnigen{
cIncludes = ["*.c", "glew-2.2.0/src/glew.c"]
headerDirs += ["glew-2.2.0/include"]
}
add(Linux, x64){
cppFlags += " " + execCmd("sdl2-config --cflags")
cFlags = cppFlags
//NOTE: for this to statically link properly, you need to add -L/path/to/folder/with/custom/libSDL2.a
//where this folder contains a custom build of SDL2 with the -fPIC flag (added to the makefile in the cflags section after configure)
//--static-libs and ?.replace("-lSDL2", "-l:libSDL2.a")
libraries = execCmd("sdl2-config --libs") + " -Wl,-Bdynamic -lGL "
linkerFlags = "-shared -m64"
}
Comment on lines -82 to -90

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @k8ieone! I am looking into syncing your PR with upstream, and found this strange diff: you seem to have moved this gradle job lower in the file.

I just wanted to know if it is deliberate or just a mistake

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it was intentional. It looks like I reused the if(System.getProperty("os.arch") != "aarch64") condition that already existed for MacOS.

add(Windows, x64){
def path = "SDL2-$sdlVersion/x86_64-w64-mingw32"
def root = "$rootDir/backends/backend-sdl/jni"
Expand All @@ -113,6 +104,15 @@ jnigen{
linkerFlags = "-shared -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++"
libraries = "/usr/local/lib/libSDL2.a -lm -liconv -Wl,-framework,CoreAudio -Wl,-framework,CoreHaptics -Wl,-weak_framework,GameController -Wl,-framework,OpenGL,-weak_framework,AudioToolbox -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal /usr/local/lib/libGLEW.a"
}
add(Linux, x64){
cppFlags += " " + execCmd("sdl2-config --cflags")
cFlags = cppFlags
//NOTE: for this to statically link properly, you need to add -L/path/to/folder/with/custom/libSDL2.a
//where this folder contains a custom build of SDL2 with the -fPIC flag (added to the makefile in the cflags section after configure)
//--static-libs and ?.replace("-lSDL2", "-l:libSDL2.a")
libraries = execCmd("sdl2-config --libs") + " -Wl,-Bdynamic -lGL "
linkerFlags = "-shared -m64"
}
}else{

//doesn't work on CI, have to use native M1
Expand All @@ -122,6 +122,15 @@ jnigen{
//execCmd("sdl2-config --static-libs") + " -Wl,-framework,OpenGL"
libraries = "/usr/local/lib/libSDL2.a -lm -liconv -Wl,-framework,CoreAudio -Wl,-weak_framework,GameController -Wl,-framework,OpenGL,-weak_framework,AudioToolbox -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal /usr/local/lib/libGLEW.a"
}
add(Linux, x64, ARM){
cppFlags += " " + execCmd("sdl2-config --cflags")
cFlags = cppFlags
//NOTE: for this to statically link properly, you need to add -L/path/to/folder/with/custom/libSDL2.a
//where this folder contains a custom build of SDL2 with the -fPIC flag (added to the makefile in the cflags section after configure)
//--static-libs and ?.replace("-lSDL2", "-l:libSDL2.a")
libraries = execCmd("sdl2-config --libs") + " -Wl,-Bdynamic -lGL "
linkerFlags = "-shared"
}
}

}
Expand All @@ -130,4 +139,4 @@ getTasksByName("jnigen", true).each{
it.dependsOn preJni
it.dependsOn classes
it.dependsOn aproj(":arc-core").getTasksByName("compileJava", true)
}
}
3 changes: 2 additions & 1 deletion extensions/filedialogs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jnigen{
libraries = " -lcomdlg32 -lole32"
}
add(Linux, x64)
add(Linux, x64, ARM)
add(MacOsX, x64)
add(MacOsX, x64, ARM){
cFlags = cppFlags = cppFlags.replace("x86_64", "arm64")
Expand Down Expand Up @@ -48,7 +49,7 @@ task preJni{
task postJni{
doLast{
copy{
from "libs/linux64", "libs/windows32", "libs/windows64", "libs/macosx64"
from "libs/linux64", "libs/linuxarm64", "libs/windows32", "libs/windows64", "libs/macosx64"
into "../../natives/natives-filedialogs/libs"
include "**"
}
Expand Down
5 changes: 3 additions & 2 deletions extensions/freetype/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jnigen{
add(Windows, x32)
add(Windows, x64)
add(Linux, x64)
add(Linux, x64, ARM)
add(MacOsX, x64)
add(MacOsX, x64, ARM){
cFlags = cppFlags = cppFlags.replace("x86_64", "arm64")
Expand Down Expand Up @@ -81,7 +82,7 @@ task preJni{
task postJni{
doLast{
copy{
from "libs/linux64", "libs/windows32", "libs/windows64", "libs/macosx64"
from "libs/linux64", "libs/linuxarm64", "libs/windows32", "libs/windows64", "libs/macosx64"
into "../../natives/natives-freetype-desktop/libs"
include "**"
}
Expand All @@ -107,4 +108,4 @@ jnigenBuild.finalizedBy postJni

getTasksByName("jnigen", true).each{
it.dependsOn preJni
}
}