-
Notifications
You must be signed in to change notification settings - Fork 6
102 lines (79 loc) · 2.96 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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/
mac_os_compile:
strategy:
matrix:
arch: [[x64, x64], [i386, x86], [arm64, arm64]]
runs-on: macos-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: Compile
run: gcc -c -arch ${{ matrix.arch[0] }} -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin ${{ env.PATH_TO_CODE }}.c -o ${{ env.PATH_TO_CODE }}_${{ matrix.arch[1] }}.o
- name: Link
run: gcc -dynamiclib -o output/${{ env.LIB_NAME }}_${{ matrix.arch[1] }}.dylib ${{ env.PATH_TO_CODE }}_${{ matrix.arch[1] }}.o -lc
- name: Upload Natives
uses: actions/upload-artifact@v3
with:
name: native
path: output/