Skip to content

Commit

Permalink
Add multi-configuration builds (#1774)
Browse files Browse the repository at this point in the history
This PR does:
* Do not fail the `extract-assets` job on forks
* Fix warnings and certain warnings as errors
* Build with a combination of gcc and clang with debug and release
  • Loading branch information
Xeeynamo authored Oct 11, 2024
1 parent af89c62 commit d36616f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 48 deletions.
63 changes: 30 additions & 33 deletions .github/workflows/picci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:

jobs:
extract-assets:
# Building and testing cannot work if the repository owner is not Xeeynamo
# due to the missing secrets to clone the CI dependencies
if: github.repository == 'Xeeynamo/sotn-decomp'
runs-on: ubuntu-latest
steps:
- name: Clone main repo
Expand Down Expand Up @@ -51,7 +54,12 @@ jobs:
path: assets

build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: ["clang", "gcc"]
build_type: ["Debug", "RelWithDebInfo"]
sound_engine: ["lle", "custom"]
runs-on: ubuntu-24.04
needs: extract-assets
steps:
- name: Install requirements
Expand All @@ -70,10 +78,22 @@ jobs:
run: make -j build_assets
- name: Build
run: |
cmake -B ${{github.workspace}}/pc
cmake --build ${{github.workspace}}/pc --config Release
export PC_FLAGS=""
if [[ "${{ matrix.sound_engine }}" == "lle" ]]; then
export PC_FLAGS="-DWANT_LIBSND_LLE=1"
fi
export CC=${{ matrix.compiler }}
cmake -B ${{github.workspace}}/pc ${PC_FLAGS} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build ${{github.workspace}}/pc --config ${{ matrix.build_type }}
- name: Test
if: matrix.sound_engine == 'lle'
run: |
${{github.workspace}}/pc/Sound test
build-macos:
strategy:
matrix:
build_type: ["Debug", "RelWithDebInfo"]
runs-on: macos-latest
needs: extract-assets
steps:
Expand All @@ -98,10 +118,13 @@ jobs:
run: make -j build_assets
- name: Build
run: |
cmake -B ${{github.workspace}}/pc
cmake --build ${{github.workspace}}/pc --config Release
cmake -B ${{github.workspace}}/pc -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build ${{github.workspace}}/pc --config ${{ matrix.build_type }}
build-windows:
strategy:
matrix:
build_type: ["Debug", "RelWithDebInfo"]
runs-on: windows-latest
needs: extract-assets
steps:
Expand Down Expand Up @@ -130,31 +153,5 @@ jobs:
& make -j build_assets SOTNASSETS=$SOTN_ASSETS
- name: Build
run: |
cmake -B ${{github.workspace}}/pc -DCMAKE_BUILD_TYPE=Release -DSDL2_PATH=C:\temp-sdl2\SDL2-2.28.5
cmake --build ${{github.workspace}}/pc --config Release
build-linux-lle:
runs-on: ubuntu-latest
needs: extract-assets
steps:
- name: Install requirements
run: sudo apt-get update && sudo apt-get install build-essential libsdl2-dev
- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: false
- name: Get assets
uses: actions/download-artifact@v4
with:
name: assets
path: assets
- name: Build assets
run: make -j build_assets
- name: Build
run: |
cmake -B ${{github.workspace}}/pc -DWANT_LIBSND_LLE=1
cmake --build ${{github.workspace}}/pc --config Release
- name: Test
run: |
${{github.workspace}}/pc/Sound test
cmake -B ${{github.workspace}}/pc -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSDL2_PATH=C:\temp-sdl2\SDL2-2.28.5
cmake --build ${{github.workspace}}/pc --config ${{ matrix.build_type }}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-int-conversion")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-mismatch")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type")
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
Expand Down
3 changes: 2 additions & 1 deletion include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#if defined(VERSION_PC)
#ifndef _MSC_VER
#include <assert.h>
#define STATIC_ASSERT _Static_assert
#define PACKED __attribute__((packed))
#else
Expand All @@ -44,7 +45,7 @@
#endif

#elif defined(VERSION_PSP)
#define STATIC_ASSERT(x)
#define STATIC_ASSERT(x, y)
#define PACKED

#else
Expand Down
4 changes: 2 additions & 2 deletions include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -1965,8 +1965,8 @@ typedef union { // offset=0x7C
ET_DestructAnimation destructAnim;
} Ext;

#define SYNC_FIELD(struct1, struct2, field_name) \
STATIC_ASSERT(OFF(struct1, field_name) == OFF(struct2, field_name))
#define SYNC_FIELD(struct1, struct2, field) \
STATIC_ASSERT(OFF(struct1, field) == OFF(struct2, field), "unsynced")

SYNC_FIELD(ET_Player, ET_Weapon, anim);
SYNC_FIELD(ET_Player, ET_WeaponUnk006, anim);
Expand Down
7 changes: 6 additions & 1 deletion src/main/psxsdk/libsnd/seqread.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "common.h"
#include "libsnd_i.h"

void _SsGetSeqData(s16 arg0, s16 arg1);
void _SsContPortamento(s16 arg0, s16 arg1, s32 arg2);

void _SsSeqPlay(s16 arg0, s16 arg1) {
struct SeqStruct* temp_s1;
s32 var_s0;
Expand Down Expand Up @@ -160,6 +163,8 @@ void _SsContDataEntry(s16, s16, u8);
void _SsContNrpn2(s16, s16, u8);
void _SsContRpn1(s16, s16, u8);
void _SsContRpn2(s16, s16, u8);
void _SsContResetAll(s16 arg0, s16 arg1);
void _SsContNrpn1(s16 arg0, s16 arg1, s16 arg2);

void _SsSetControlChange(s16 arg0, s16 arg1, s32 arg2) {
u32 control;
Expand Down Expand Up @@ -321,7 +326,7 @@ typedef void (*SndSsMarkCallbackProc)(short seq_no, short sep_no, short data);

extern SndSsMarkCallbackProc _SsMarkCallback[32][16];

void _SsContNrpn1(s16 arg0, s16 arg1, s8 arg2) {
void _SsContNrpn1(s16 arg0, s16 arg1, s16 arg2) {
SndSsMarkCallbackProc temp_v0;
struct SeqStruct* temp_s0;
temp_s0 = &_ss_score[arg0][arg1];
Expand Down
17 changes: 7 additions & 10 deletions src/main/psxsdk/libspu/s_ini.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#include "common.h"
#include "libspu_internal.h"

extern s32 _spu_fd;
extern s32 _spu_trans_mode;
extern s32 _spu_rev_flag;
extern s32 _spu_rev_reserve_wa;
extern s32 _spu_rev_offsetaddr;

struct SpuRevAttr {
s32 unk0;
s32 unk18;
Expand All @@ -16,16 +10,19 @@ struct SpuRevAttr {
s32 unk24;
};

extern s32 _spu_fd;
extern s32 _spu_trans_mode;
extern s32 _spu_rev_flag;
extern s32 _spu_rev_reserve_wa;
extern s32 _spu_rev_offsetaddr;
extern struct SpuRevAttr _spu_rev_attr;

extern u16 _spu_voice_centerNote[];

extern s32 _spu_EVdma;

extern s32 _spu_keystat;

extern s32 _spu_rev_startaddr[];

void SpuStart(void);

void _SpuInit(s32 arg0) {
s32 i;
ResetCallback();
Expand Down
2 changes: 1 addition & 1 deletion src/pc/psxsdk/emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ extern "C" u16 read_16(u32 addr, char* file, int line)

extern "C" void write_dma(u32 data, char* file, int line)
{
writes.push_back({SPU->RWAddr, data, file, line, 1});
writes.push_back({SPU->RWAddr, (u16)data, file, line, 1});
SPU->WriteDMA(data);
}

Expand Down

0 comments on commit d36616f

Please sign in to comment.