diff --git a/.github/workflows/.github.yml b/.github/workflows/.github.yml index d3d87559..87f8bcb2 100644 --- a/.github/workflows/.github.yml +++ b/.github/workflows/.github.yml @@ -7,21 +7,39 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] - compiler: [gcc, clang] include: - - compiler: gcc - cpp-compiler: g++ - - compiler: clang - cpp-compiler: clang++ + - os: ubuntu-latest + cc: gcc + cxx: g++ + - os: ubuntu-latest + cc: clang + cxx: clang++ env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.cpp-compiler }} + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} steps: - name: Checkout uses: actions/checkout@v2 + + - name: Get SDL2 headers + uses: actions/checkout@v2 + with: + repository: libsdl-org/SDL + ref: release-2.0.9 + path: SDL2 + - name: Link SDL2 headers into system path + run: | + sudo ln -s "$GITHUB_WORKSPACE/SDL2/include" /usr/local/include/SDL2 + - name: Install dependencies - run: sudo apt-get -y install gcc-multilib g++-multilib libgl1-mesa-dev - - name: Build client and server on ${{ matrix.os }} with ${{ matrix.compiler }} + if: startsWith(matrix.os, 'ubuntu') + run: | + sudo apt-get -y install gcc-multilib g++-multilib + + - name: Build with xash3d-fwgs input run: | cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" && cmake --build build --target all + - name: Build with goldsource input + run: | + cmake -B build-gs -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DGOLDSOURCE_SUPPORT=ON && cmake --build build-gs --target all + diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index 4cbc2008..29edfbde 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -183,7 +183,7 @@ int *HUD_GetRect( void ) return extent; } -#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT +#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT class TeamFortressViewport : public vgui::Panel { public: @@ -238,7 +238,7 @@ so the HUD can reinitialize itself. int DLLEXPORT HUD_VidInit( void ) { gHUD.VidInit(); -#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT +#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT vgui::Panel* root=(vgui::Panel*)gEngfuncs.VGui_GetPanel(); if (root) { gEngfuncs.Con_Printf( "Root VGUI panel exists\n" ); @@ -337,7 +337,7 @@ Called by engine every frame that client .dll is loaded void DLLEXPORT HUD_Frame( double time ) { -#if USE_VGUI_FOR_GOLDSOURCE_SUPPORT +#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT if (!gViewPort) gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect()); #else diff --git a/cl_dll/input_goldsource.cpp b/cl_dll/input_goldsource.cpp index 1d1c9f8b..8698a5d3 100644 --- a/cl_dll/input_goldsource.cpp +++ b/cl_dll/input_goldsource.cpp @@ -10,7 +10,7 @@ #include "input_mouse.h" -#if SUPPORT_GOLDSOURCE_INPUT +#ifdef SUPPORT_GOLDSOURCE_INPUT #include "hud.h" #include "cl_util.h" @@ -27,7 +27,7 @@ #define USE_SDL2 #endif -#if USE_SDL2 +#ifdef USE_SDL2 #define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) ) #include #include @@ -242,7 +242,7 @@ DWORD joy_oldbuttonstate, joy_oldpovstate; int joy_id; DWORD joy_numbuttons; -#if USE_SDL2 +#ifdef USE_SDL2 SDL_GameController *s_pJoystick = NULL; #elif defined(_WIN32) DWORD joy_flags; @@ -566,7 +566,7 @@ void GoldSourceInput::IN_Shutdown (void) } #endif -#if USE_SDL2 +#ifdef USE_SDL2 for (int j=0; j 0 ) { @@ -1084,7 +1084,7 @@ void IN_StartupJoystick (void) #endif } -#if USE_SDL2 +#ifdef USE_SDL2 int RawValuePointer (int axis) { switch (axis) @@ -1216,7 +1216,7 @@ void GoldSourceInput::IN_Commands (void) // loop through the joystick buttons // key a joystick event or auxillary event for higher number buttons for each state change -#if USE_SDL2 +#ifdef USE_SDL2 buttonstate = 0; for ( i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++ ) { @@ -1294,7 +1294,7 @@ IN_ReadJoystick */ int IN_ReadJoystick (void) { -#if USE_SDL2 +#ifdef USE_SDL2 safe_pfnSDL_JoystickUpdate(); return 1; #elif defined(_WIN32) @@ -1374,7 +1374,7 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd ) for (i = 0; i < JOY_MAX_AXES; i++) { // get the floating point zero-centered, potentially-inverted data for the current axis -#if USE_SDL2 +#ifdef USE_SDL2 fAxisValue = (float)pdwRawValue[i]; #elif defined(_WIN32) fAxisValue = (float) *pdwRawValue[i]; @@ -1600,7 +1600,7 @@ void GoldSourceInput::IN_Init (void) } #endif -#if USE_SDL2 +#ifdef USE_SDL2 #if __APPLE__ #define SDL2_FULL_LIBNAME "libsdl2-2.0.0.dylib" #else diff --git a/cl_dll/input_mouse.cpp b/cl_dll/input_mouse.cpp index c5b1df6b..3233d797 100644 --- a/cl_dll/input_mouse.cpp +++ b/cl_dll/input_mouse.cpp @@ -10,7 +10,7 @@ cvar_t *in_joystick; FWGSInput fwgsInput; -#if SUPPORT_GOLDSOURCE_INPUT +#ifdef SUPPORT_GOLDSOURCE_INPUT GoldSourceInput goldSourceInput; AbstractInput* currentInput = &goldSourceInput; #else @@ -68,7 +68,7 @@ void IN_Shutdown( void ) void IN_Init( void ) { -#if SUPPORT_GOLDSOURCE_INPUT +#ifdef SUPPORT_GOLDSOURCE_INPUT if (IsXashFWGS()) { gEngfuncs.Con_Printf( "FWGS Xash3D input is in use\n" ); currentInput = &fwgsInput;