Skip to content

Commit

Permalink
chore(build): Improve build system.
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Nana <[email protected]>
  • Loading branch information
na2axl committed Sep 27, 2024
1 parent 4028cf9 commit a0036b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 40 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,16 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-sdk:
build:
needs: [ cleanup ]
uses: ./.github/workflows/cmake.yml
with:
project-path: .
project-slug: amplitude_audio_sdk
name: Amplitude Audio SDK

build-plugins:
needs: [ build-sdk ]
uses: ./.github/workflows/cmake.yml
with:
project-path: ./plugins/${{ matrix.project.path }}
name: ${{ matrix.project.name }}
strategy:
matrix:
project:
- name: FLAC Codec
path: codec-flac
- name: Vorbis Codec
path: codec-vorbis

release:
needs: [ build-plugins ]
needs: [ build ]
runs-on: ${{ matrix.config.os }}
name: "[${{ matrix.build_type }}] ${{ matrix.config.name }}"
strategy:
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
project-path:
required: true
type: string
project-slug:
required: true
type: string


jobs:
build:
Expand All @@ -19,8 +23,7 @@ jobs:
- name: "Windows Latest MSVC"
key: msvc
os: windows-latest
sdk_dir: win
artifact: "amplitude_audio_sdk_windows_msvc_x64.7z"
artifact: "${{ inputs.project-slug }}_windows_msvc_x64.7z"
cc: "cl"
cxx: "cl"
generator: "Visual Studio 17 2022"
Expand All @@ -29,8 +32,7 @@ jobs:
- name: "Windows Latest MinGW"
key: mingw
os: windows-latest
sdk_dir: win
artifact: "amplitude_audio_sdk_windows_mingw_x64.7z"
artifact: "${{ inputs.project-slug }}_windows_mingw_x64.7z"
cc: "gcc"
cxx: "g++"
generator: "Ninja"
Expand All @@ -39,8 +41,7 @@ jobs:
- name: "Ubuntu Latest GCC"
key: gcc
os: ubuntu-24.04
sdk_dir: linux
artifact: "amplitude_audio_sdk_linux_gcc_x64.7z"
artifact: "${{ inputs.project-slug }}_linux_gcc_x64.7z"
cc: "gcc"
cxx: "g++"
generator: "Ninja"
Expand All @@ -49,8 +50,7 @@ jobs:
- name: "macOS x64 Latest Clang"
key: clang
os: macos-13
sdk_dir: osx
artifact: "amplitude_audio_sdk_macos_clang_x64.7z"
artifact: "${{ inputs.project-slug }}_macos_clang_x64.7z"
cc: "clang"
cxx: "clang++"
generator: "Ninja"
Expand All @@ -59,8 +59,7 @@ jobs:
- name: "macOS arm64 Latest Clang"
key: clang
os: macos-14
sdk_dir: osx
artifact: "amplitude_audio_sdk_macos_clang_arm64.7z"
artifact: "${{ inputs.project-slug }}_macos_clang_arm64.7z"
cc: "clang"
cxx: "clang++"
generator: "Ninja"
Expand Down Expand Up @@ -181,12 +180,12 @@ jobs:
- name: Copy flatc to SDK folder (Windows)
if: startsWith(matrix.config.os, 'windows')
run: |
Copy-Item .\bin\flatc.exe -Destination .\sdk\bin\${{ matrix.config.sdk_dir }}
Copy-Item .\bin\flatc.exe -Destination .\sdk\bin\${{ matrix.config.target_triplet }}
- name: Copy flatc to SDK folder (Unix)
if: startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos')
run: |
cp ./bin/flatc ./sdk/bin/${{ matrix.config.sdk_dir }}
cp ./bin/flatc ./sdk/bin/${{ matrix.config.target_triplet }}
- name: Save SDK Cache
uses: actions/cache/save@v4
Expand Down
16 changes: 4 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,11 @@ set(CMAKE_DEBUG_POSTFIX "_d")
set(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(OBJ_DIR ${CMAKE_CURRENT_BINARY_DIR}/obj)

if (MSVC OR WIN32)
set(RUNTIME_OUTPUT_DIRECTORY "win")
elseif (APPLE)
set(RUNTIME_OUTPUT_DIRECTORY "osx")
else ()
set(RUNTIME_OUTPUT_DIRECTORY "linux")
endif ()

set(AM_LIB_DESTINATION "lib/${RUNTIME_OUTPUT_DIRECTORY}")
set(AM_LIB_DESTINATION "lib/${VCPKG_TARGET_TRIPLET}")
set(AM_INC_DESTINATION "include")
set(AM_SHM_DESTINATION "schemas")
set(AM_PYS_DESTINATION "scripts")
set(AM_BIN_DESTINATION "bin/${RUNTIME_OUTPUT_DIRECTORY}")
set(AM_BIN_DESTINATION "bin/${VCPKG_TARGET_TRIPLET}")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${AM_BIN_DESTINATION}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${AM_LIB_DESTINATION}")
Expand Down Expand Up @@ -492,8 +484,8 @@ foreach (build_type ${AM_BUILDSYSTEM_TYPE})

set_target_properties(${build_type}
PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}
ARCHIVE_OUTPUT_DIRECTORY ${build_type_l}
OUTPUT_NAME ${PROJECT_NAME}
ARCHIVE_OUTPUT_DIRECTORY ${build_type_l}
)

target_compile_definitions(${build_type} PRIVATE AM_BUILDSYSTEM_BUILDING_AMPLITUDE)
Expand Down

0 comments on commit a0036b6

Please sign in to comment.