Skip to content

Commit

Permalink
Reorganize and update builds, add win-arm64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBrixican committed Sep 4, 2024
1 parent 131bb2e commit fe1bfeb
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 40 deletions.
66 changes: 40 additions & 26 deletions .github/workflows/build-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,34 @@ jobs:
include:
- os: windows-latest
arch: x64
lib: x64/FosterAudioPlatform.dll
target: win-x64
lib: FosterAudioPlatform.dll
- os: windows-latest
arch: arm64
target: win-arm64
lib: FosterAudioPlatform.dll
- os: macos-latest
arch: x64-arm64
lib: osx/libFosterAudioPlatform.dylib
target: osx
lib: libFosterAudioPlatform.dylib
- os: ubuntu-latest
arch: x64
lib: lib64/libFosterAudioPlatform.so
target: linux-x64
lib: libFosterAudioPlatform.so
- os: ubuntu-latest
arch: arm64
lib: libarm64/libFosterAudioPlatform.so
target: linux-arm64
lib: libFosterAudioPlatform.so
- os: ubuntu-latest
arch: arm32
lib: libarm/libFosterAudioPlatform.so
target: linux-arm32
lib: libFosterAudioPlatform.so
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4
- name: Get CMake
uses: lukka/get-cmake@v3.27.4
uses: lukka/get-cmake@v3.29.4
- name: Setup Linux dependencies (arm64)
if: ${{ runner.os == 'Linux' && matrix.arch == 'arm64' }}
run: |
Expand All @@ -57,53 +66,58 @@ jobs:
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c)-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture armhf
- name: CMake Configure
if: ${{ matrix.arch != 'arm64' && matrix.arch != 'arm32' }}
run: cmake -B build -S Platform
- name: CMake Configure (arm64)
if: ${{ !(runner.os == 'Linux' && matrix.arch == 'arm64') && !(runner.os == 'Linux' && matrix.arch == 'arm32') }}
run: cmake -B build -S Platform -DFOSTER_OVERRIDE_TARGET=${{matrix.target}}
- name: CMake Configure (Linux-arm64)
if: ${{ runner.os == 'Linux' && matrix.arch == 'arm64' }}
run: PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig cmake -B build -S Platform -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_SYSTEM_NAME=Linux
- name: CMake Configure (arm32)
run: PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig cmake -B build -S Platform -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_SYSTEM_NAME=Linux -DFOSTER_OVERRIDE_TARGET=${{matrix.target}}
- name: CMake Configure (Linux-arm32)
if: ${{ runner.os == 'Linux' && matrix.arch == 'arm32' }}
run: PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig cmake -B build -S Platform -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_PROCESSOR=armv7l -DCMAKE_SYSTEM_NAME=Linux
run: PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig cmake -B build -S Platform -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_PROCESSOR=armv7l -DCMAKE_SYSTEM_NAME=Linux -DFOSTER_OVERRIDE_TARGET=${{matrix.target}}
- name: CMake Build
run: cmake --build build --config Release
- name: Publish Artifact
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}-${{matrix.arch}}-build
path: Platform/libs/${{matrix.lib}}
path: Platform/libs/${{matrix.target}}/${{matrix.lib}}
UpdateLibs:
if: github.ref == 'refs/heads/main'
needs: [Build]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4.0.0
- name: Download windows lib
uses: actions/download-artifact@v3
uses: actions/checkout@v4
- name: Download windows x64 lib
uses: actions/download-artifact@v4
with:
name: windows-latest-x64-build
path: Platform/libs/x64
path: Platform/libs/win-x64
- name: Download windows arm lib
uses: actions/download-artifact@v4
with:
name: windows-latest-arm64-build
path: Platform/libs/win-arm64
- name: Download macos lib
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: macos-latest-x64-arm64-build
path: Platform/libs/osx
- name: Download ubuntu lib
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-x64-build
path: Platform/libs/lib64
path: Platform/libs/linux-x64
- name: Download ubuntu lib (arm64)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-arm64-build
path: Platform/libs/libarm64
path: Platform/libs/linux-arm64
- name: Download ubuntu lib (arm32)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-arm32-build
path: Platform/libs/libarm
path: Platform/libs/linux-arm32
- name: Display structure of libs
run: ls -R
working-directory: Platform/libs
Expand Down
34 changes: 26 additions & 8 deletions Foster.Audio/Foster.Audio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,45 @@
<NativeLibsDir>$(ProjectDir)..\Platform\libs\</NativeLibsDir>
</PropertyGroup>

<PropertyGroup Condition="$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == 'X64'">
<IsX64>true</IsX64>
</PropertyGroup>

<PropertyGroup Condition="$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == 'Arm64'">
<IsArm64>true</IsArm64>
</PropertyGroup>

<PropertyGroup Condition="$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == 'Arm32'">
<IsArm32>true</IsArm32>
</PropertyGroup>

<ItemGroup>
<Content Include="$(NativeLibsDir)x64\FosterAudioPlatform.dll">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Windows'))">PreserveNewest</CopyToOutputDirectory>
<Content Include="$(NativeLibsDir)win-x64\FosterAudioPlatform.dll">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Windows')) AND $(IsArm64) != 'true'">PreserveNewest</CopyToOutputDirectory>
<PackagePath>runtimes\win-x64\native</PackagePath>
<Pack>True</Pack>
<Link>FosterAudioPlatform.dll</Link>
</Content>
<Content Include="$(NativeLibsDir)lib64\libFosterAudioPlatform.so">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Linux')) AND '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64'">PreserveNewest</CopyToOutputDirectory>
<Content Include="$(NativeLibsDir)win-arm64\FosterAudioPlatform.dll">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Windows')) AND $(IsArm64) == 'true'">PreserveNewest</CopyToOutputDirectory>
<PackagePath>runtimes\win-arm64\native</PackagePath>
<Pack>True</Pack>
<Link>FosterAudioPlatform.dll</Link>
</Content>
<Content Include="$(NativeLibsDir)linux-x64\libFosterAudioPlatform.so">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Linux')) AND $(IsX64) == 'true'">PreserveNewest</CopyToOutputDirectory>
<PackagePath>runtimes\linux-x64\native</PackagePath>
<Pack>True</Pack>
<Link>libFosterAudioPlatform.so</Link>
</Content>
<Content Include="$(NativeLibsDir)libarm64\libFosterAudioPlatform.so">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Linux')) AND '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64'">PreserveNewest</CopyToOutputDirectory>
<Content Include="$(NativeLibsDir)linux-arm64\libFosterAudioPlatform.so">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Linux')) AND $(IsArm64) == 'true'">PreserveNewest</CopyToOutputDirectory>
<PackagePath>runtimes\linux-arm64\native</PackagePath>
<Pack>True</Pack>
<Link>libFosterAudioPlatform.so</Link>
</Content>
<Content Include="$(NativeLibsDir)libarm\libFosterAudioPlatform.so">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Linux')) AND '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm'">PreserveNewest</CopyToOutputDirectory>
<Content Include="$(NativeLibsDir)linux-arm32\libFosterAudioPlatform.so">
<CopyToOutputDirectory Condition="$([MSBuild]::IsOSPlatform('Linux')) AND $(IsArm32) == 'true'">PreserveNewest</CopyToOutputDirectory>
<PackagePath>runtimes\linux-arm\native</PackagePath>
<Pack>True</Pack>
<Link>libFosterAudioPlatform.so</Link>
Expand Down
14 changes: 8 additions & 6 deletions Platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,21 @@ if (UNIX AND NOT APPLE)
endif ()

# Get platform target
if (APPLE)
if (FOSTER_OVERRIDE_TARGET)
set(FosterTarget ${FOSTER_OVERRIDE_TARGET})
elseif (APPLE)
set(FosterTarget osx)
elseif (WIN32)
set(FosterTarget x64)
set(FosterTarget win-x64)
elseif (UNIX)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(FosterTarget libarm64)
set(FosterTarget linux-arm64)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
set(FosterTarget libarm)
set(FosterTarget linux-arm32)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6l")
set(FosterTarget libarm)
set(FosterTarget linux-arm32)
else()
set(FosterTarget lib64)
set(FosterTarget linux-x64)
endif()
else()
message(FATAL_ERROR "Unknown Target!")
Expand Down
File renamed without changes.

0 comments on commit fe1bfeb

Please sign in to comment.