-
Notifications
You must be signed in to change notification settings - Fork 6
64 lines (49 loc) · 1.84 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build
on: push
env:
LIB_NAME: libImagineBreaker
PATH_TO_CODE: 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 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$JAVA_HOME/include -I$JAVA_HOME/include/win32 ${{ env.PATH_TO_CODE }}.c -link -out:output/${{ env.LIB_NAME }}_${{ matrix.arch[1] }}.dll
- name: Upload Natives
uses: actions/upload-artifact@v3
with:
name: native
path: output/