mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-07-02 19:13:43 -04:00
Add experimental Android support (#190)
* Add `Raylib-cs.Android` project * Update ci to handle android native libraries * Update ci to pack android project
This commit is contained in:
80
.github/workflows/build.yml
vendored
80
.github/workflows/build.yml
vendored
@ -22,8 +22,52 @@ jobs:
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
echo "version=$(sed -n 's/.*<TargetRaylibTag>\(.*\)<\/TargetRaylibTag>.*/\1/p' Raylib-cs/Raylib-cs.csproj)">> ${GITHUB_OUTPUT}
|
||||
echo "pkgversion=$(sed -n 's/.*<PackageVersion>\(.*\)<\/PackageVersion>.*/\1/p' Raylib-cs/Raylib-cs.csproj)">> ${GITHUB_OUTPUT}
|
||||
echo "version=$(sed -n 's/.*<TargetRaylibTag>\(.*\)<\/TargetRaylibTag>.*/\1/p' Directory.Build.props)">> ${GITHUB_OUTPUT}
|
||||
echo "pkgversion=$(sed -n 's/.*<PackageVersion>\(.*\)<\/PackageVersion>.*/\1/p' Directory.Build.props)">> ${GITHUB_OUTPUT}
|
||||
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare
|
||||
strategy:
|
||||
matrix:
|
||||
name: [arm, arm64, x86, x64]
|
||||
include:
|
||||
- name: arm
|
||||
arch: armeabi-v7a
|
||||
- name: arm64
|
||||
arch: arm64-v8a
|
||||
- name: x86
|
||||
arch: x86
|
||||
- name: x64
|
||||
arch: x86_64
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: build raylib
|
||||
env:
|
||||
version: ${{ needs.prepare.outputs.version }}
|
||||
run: |
|
||||
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${version}.zip
|
||||
unzip -qq raylib.zip
|
||||
pushd raylib-${version}; patch -p1 < ../Raylib-cs.Android/android.patch; popd
|
||||
cmake -S raylib-${version} \
|
||||
-B build \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D BUILD_SHARED_LIBS=ON \
|
||||
-D BUILD_EXAMPLES=OFF \
|
||||
-D CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
|
||||
-D PLATFORM=Android \
|
||||
-D ANDROID_ABI=${{ matrix.arch }} \
|
||||
-D ANDROID_PLATFORM=21
|
||||
cmake --build build --config Release
|
||||
|
||||
- name: upload build
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: android-${{ matrix.name }}
|
||||
path: build/raylib/libraylib.so
|
||||
if-no-files-found: error
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
@ -133,6 +177,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- prepare
|
||||
- build-android
|
||||
- build-linux
|
||||
- build-osx
|
||||
- build-windows
|
||||
@ -140,6 +185,26 @@ jobs:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: android-arm
|
||||
path: Raylib-cs.Android/runtimes/android-arm/native
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: android-arm64
|
||||
path: Raylib-cs.Android/runtimes/android-arm64/native
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: android-x86
|
||||
path: Raylib-cs.Android/runtimes/android-x86/native
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: android-x64
|
||||
path: Raylib-cs.Android/runtimes/android-x64/native
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: linux-x64
|
||||
@ -170,23 +235,26 @@ jobs:
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
|
||||
- name: Restore workload
|
||||
run: dotnet workload restore
|
||||
|
||||
- name: Create NuGet Package
|
||||
run: dotnet pack -c Release Raylib-cs
|
||||
run: dotnet pack -c Release --output nuget
|
||||
|
||||
- name: Upload NuGet Package As Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: Raylib-cs/bin/Release/Raylib-cs.${{ needs.prepare.outputs.pkgversion }}.*pkg
|
||||
path: nuget/*
|
||||
|
||||
- name: Upload NuGet Package As Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: Raylib-cs/bin/Release/Raylib-cs.${{ needs.prepare.outputs.pkgversion }}.*pkg
|
||||
files: nuget/*
|
||||
|
||||
- name: Publish to NuGet
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
dotnet nuget push \
|
||||
Raylib-cs/bin/Release/Raylib-cs.${{ needs.prepare.outputs.pkgversion }}.nupkg \
|
||||
nuget/* \
|
||||
--api-key ${{secrets.NUGET_API_KEY}}
|
||||
|
Reference in New Issue
Block a user