diff --git a/.github/workflows/build-libs.yml b/.github/workflows/build-libs.yml
index 330998d..18386f1 100644
--- a/.github/workflows/build-libs.yml
+++ b/.github/workflows/build-libs.yml
@@ -18,30 +18,59 @@ jobs:
matrix:
include:
- os: windows-latest
+ arch: x64
lib: x64/FosterAudioPlatform.dll
- os: macos-latest
+ arch: x64-arm64
lib: osx/libFosterAudioPlatform.dylib
- os: ubuntu-latest
+ arch: x64
lib: lib64/libFosterAudioPlatform.so
+ - os: ubuntu-latest
+ arch: arm64
+ lib: libarm64/libFosterAudioPlatform.so
+ - os: ubuntu-latest
+ arch: arm32
+ lib: libarm/libFosterAudioPlatform.so
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v4.0.0
- name: Get CMake
uses: lukka/get-cmake@v3.27.4
- - name: Setup Linux dependencies
- if: runner.os == 'Linux'
+ - name: Setup Linux dependencies (arm64)
+ if: ${{ runner.os == 'Linux' && matrix.arch == 'arm64' }}
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
+ sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list
+ echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
+ 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 arm64
+ - name: Setup Linux dependencies (arm32)
+ if: ${{ runner.os == 'Linux' && matrix.arch == 'arm32' }}
run: |
sudo apt-get update
- sudo apt-get install libsdl2-dev
+ sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
+ sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list
+ echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
+ 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' }}
+ 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)
+ 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
- name: CMake Build
run: cmake --build build --config Release
- name: Publish Artifact
uses: actions/upload-artifact@v3.1.3
with:
- name: ${{matrix.os}}-build
+ name: ${{matrix.os}}-${{matrix.arch}}-build
path: Platform/libs/${{matrix.lib}}
UpdateLibs:
if: github.ref == 'refs/heads/main'
@@ -53,18 +82,28 @@ jobs:
- name: Download windows lib
uses: actions/download-artifact@v3
with:
- name: windows-latest-build
+ name: windows-latest-x64-build
path: Platform/libs/x64
- name: Download macos lib
uses: actions/download-artifact@v3
with:
- name: macos-latest-build
+ name: macos-latest-x64-arm64-build
path: Platform/libs/osx
- name: Download ubuntu lib
uses: actions/download-artifact@v3
with:
- name: ubuntu-latest-build
+ name: ubuntu-latest-x64-build
path: Platform/libs/lib64
+ - name: Download ubuntu lib (arm64)
+ uses: actions/download-artifact@v3
+ with:
+ name: ubuntu-latest-arm64-build
+ path: Platform/libs/libarm64
+ - name: Download ubuntu lib (arm32)
+ uses: actions/download-artifact@v3
+ with:
+ name: ubuntu-latest-arm32-build
+ path: Platform/libs/libarm
- name: Display structure of libs
run: ls -R
working-directory: Platform/libs
diff --git a/Foster.Audio/Foster.Audio.csproj b/Foster.Audio/Foster.Audio.csproj
index eef8396..65f54e4 100644
--- a/Foster.Audio/Foster.Audio.csproj
+++ b/Foster.Audio/Foster.Audio.csproj
@@ -32,11 +32,23 @@
FosterAudioPlatform.dll
- PreserveNewest
+ PreserveNewest
runtimes\linux-x64\native
True
libFosterAudioPlatform.so
+
+ PreserveNewest
+ runtimes\linux-arm64\native
+ True
+ libFosterAudioPlatform.so
+
+
+ PreserveNewest
+ runtimes\linux-arm\native
+ True
+ libFosterAudioPlatform.so
+
PreserveNewest
runtimes\osx\native
diff --git a/Platform/CMakeLists.txt b/Platform/CMakeLists.txt
index 2796866..9086f5e 100644
--- a/Platform/CMakeLists.txt
+++ b/Platform/CMakeLists.txt
@@ -29,27 +29,22 @@ target_include_directories(${TARGET_NAME}
PRIVATE $
)
-# ignore some particularly annoying warnings from our third party libraries
-if(MSVC)
- # possible loss of data
- add_definitions("/wd4244 /wd4267")
- # truncation
- add_definitions("/wd4305")
- # signed/unsigned mismatch
- add_definitions("/wd4018")
-endif()
-
-file(GLOB_RECURSE TP_DIR "src/third_party/*.c" "src/third_party/*.h")
-
-message(${TP_DIR})
-
-set_source_files_properties(
- ${TP_DIR}
- PROPERTIES
- COMPILE_FLAGS
- "-Wno-everything"
-)
-#add_definitions(-w)
+# miniaudio dependencies
+# windows: none
+# mac: none
+# linux: pthreads, libm, libdl
+# bsd: pthreads, libm
+
+if (UNIX AND NOT APPLE)
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads REQUIRED)
+ find_library(LIB_M m)
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ find_library(LIB_DL dl)
+ target_link_libraries(${TARGET_NAME} PRIVATE ${LIB_DL})
+ endif ()
+ target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads ${LIB_M})
+endif ()
# Get platform target
if (APPLE)
@@ -57,7 +52,15 @@ if (APPLE)
elseif (WIN32)
set(FosterTarget x64)
elseif (UNIX)
- set(FosterTarget lib64)
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+ set(FosterTarget libarm64)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
+ set(FosterTarget libarm)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6l")
+ set(FosterTarget libarm)
+ else()
+ set(FosterTarget lib64)
+ endif()
else()
message(FATAL_ERROR "Unknown Target!")
endif()
@@ -79,18 +82,17 @@ if (MSVC)
# Warnings as Errors Enabled
target_compile_options(${TARGET_NAME} PRIVATE /WX)
+
+ # ignore some particularly annoying warnings from our third party libraries:
+ # possible loss of data
+ add_definitions("/wd4244 /wd4267")
+ # truncation
+ add_definitions("/wd4305")
+ # signed/unsigned mismatch
+ add_definitions("/wd4018")
endif()
if(WIN32)
target_compile_definitions(${TARGET_NAME} PRIVATE _UNICODE UNICODE _CRT_SECURE_NO_WARNINGS)
target_compile_definitions(${TARGET_NAME} PRIVATE NOMINMAX)
endif ()
-
-# tracks which libraries we need to link, depends on Options above
-set(LIBS "")
-
-# Tell SDL it's going to be a shared lib
-set_property(TARGET ${FOSTER_SDL2_LIBS} PROPERTY POSITION_INDEPENDENT_CODE ON)
-
-# Link SDL
-target_link_libraries(${TARGET_NAME} PRIVATE ${LIBS})