Skip to content

Reinstate win x86/arm64 builds as well #49

Reinstate win x86/arm64 builds as well

Reinstate win x86/arm64 builds as well #49

Workflow file for this run

name: Build
on: push
env:
LIB_NAME: libImagineBreaker
PATH_TO_CODE: natives/src/main/c/zone_rong_imaginebreaker_ImagineBreaker
PATH_TO_CODE_WIN: natives\src\main\c\zone_rong_imaginebreaker_ImagineBreaker
jobs:
linux_compile:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Make Directory
run: mkdir output
- name: Install GCC-Multilib
run: sudo apt-get install gcc-multilib
- name: Compile for x64
run: gcc -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux ${{ env.PATH_TO_CODE }}.c -o ${{ env.PATH_TO_CODE }}_x64.o
- name: Compile for x86
run: gcc -m32 -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux ${{ env.PATH_TO_CODE }}.c -o ${{ env.PATH_TO_CODE }}_x86.o
- name: Link for x64
run: gcc -shared -fPIC -o output/${{ env.LIB_NAME }}_x64.so ${{ env.PATH_TO_CODE }}_x64.o -lc
- name: Link for x86
run: gcc -m32 -shared -fPIC -o output/${{ env.LIB_NAME }}_x86.so ${{ env.PATH_TO_CODE }}_x86.o -lc
- name: Upload Natives
uses: actions/upload-artifact@v3
with:
name: native
path: output/
windows_compile:
strategy:
matrix:
arch: [[x64, x64], [x86, x86], [amd64_arm64, arm64]]
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Make Directory
run: mkdir output
- name: Install Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch[0] }}
- name: Compile and Link for ${{ matrix.arch[1] }}
run: cl.exe -LD -I${{ env.JAVA_HOME }}\include -I${{ env.JAVA_HOME }}\include\win32 ${{ env.PATH_TO_CODE_WIN }}.c -link -out:output\${{ env.LIB_NAME }}_${{ matrix.arch[1] }}.dll
- name: Upload Natives
uses: actions/upload-artifact@v3
with:
name: native
path: output/