diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e331a90..bfe70e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,83 +1,87 @@ -name: Build Sonic Nexus for multiple platforms - +name: Build RSDKv2 on: push: branches: - master - - continuous-delivery + +env: + GENERAL_FLAGS: "-DCMAKE_BUILD_TYPE=Release" + # Normally you would use $VCPKG_INSTALLATION_PATH, but it's broken...so hardcode C:/vcpkg + GENERAL_WIN_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" + WIN32_FLAGS: "-DVCPKG_TARGET_TRIPLET=x86-windows-static -DCMAKE_PREFIX_PATH=C:/vcpkg/installed/x86-windows-static/ -A Win32" + WIN64_FLAGS: "-DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH=C:/vcpkg/installed/x64-windows-static/" + # FIXME: For some reason ubuntu enables _FORTIFY_SOURCE by default, so let's override it to prevent IO bugs + GENERAL_LINUX_FLAGS: "-DCMAKE_CXX_FLAGS='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0'" jobs: - windows: - runs-on: windows-2022 + v2-windows: + runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v2 - - name: Download libogg, libvorbis, and libtheora for easier includes - run : | - Invoke-WebRequest -Uri "https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.5.zip" -OutFile "libogg.zip" - Expand-Archive -Path libogg.zip -DestinationPath ./dependencies/windows/ - Rename-Item ./dependencies/windows/libogg-1.3.5 libogg - Invoke-WebRequest -Uri "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.zip" -OutFile "libvorbis.zip" - Expand-Archive -Path libvorbis.zip -DestinationPath ./dependencies/windows/ - Rename-Item ./dependencies/windows/libvorbis-1.3.7 libvorbis - - name: Download SDL2 + with: + submodules: recursive + - name: Install dependencies + run: vcpkg install glew sdl2 libogg libvorbis --triplet=x86-windows-static + - name: Build RSDKv2 run: | - Invoke-WebRequest -Uri "https://libsdl.org/release/SDL2-devel-2.0.14-VC.zip" -OutFile "SDL2.zip" - Expand-Archive -Path SDL2.zip -DestinationPath ./dependencies/windows/ - Rename-Item ./dependencies/windows/SDL2-2.0.14 SDL2 - - name: Run vcpkg + cmake -B build ${{env.GENERAL_FLAGS}} ${{env.GENERAL_WIN_FLAGS}} ${{env.WIN32_FLAGS}} + cmake --build build --parallel --config Release + - name: Move artifacts run: | - vcpkg install libogg:x86-windows-static libvorbis:x86-windows-static libtheora:x86-windows-static - vcpkg integrate install - - name: Build Sonic Nexus + mkdir artifacts + mv ./build/Release/*.exe ./artifacts + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: v2-windows + path: artifacts + v2-windows-x64: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install dependencies + run: vcpkg install glew sdl2 libogg libvorbis --triplet=x64-windows-static + - name: Build RSDKv2 run: | - msbuild Nexus.sln /p:Configuration=Release /p:Platform=x86 /p:ForceImportBeforeCppTargets="$env:GITHUB_WORKSPACE/props/winactions.props" + cmake -B build ${{env.GENERAL_FLAGS}} ${{env.GENERAL_WIN_FLAGS}} ${{env.WIN64_FLAGS}} + cmake --build build --parallel --config Release - name: Move artifacts run: | mkdir artifacts - move ./build/Win32/Release/*.dll ./artifacts - move ./build/Win32/Release/*.exe ./artifacts + mv ./build/Release/*.exe ./artifacts - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: Nexus-Windows - path: artifacts - windows-x64: - runs-on: windows-2022 + name: v2-windows-x64 + path: artifacts + v2-linux: + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v2 - - name: Download libogg, libvorbis, and libtheora for easier includes - run : | - Invoke-WebRequest -Uri "https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.5.zip" -OutFile "libogg.zip" - Expand-Archive -Path libogg.zip -DestinationPath ./dependencies/windows/ - Rename-Item ./dependencies/windows/libogg-1.3.5 libogg - Invoke-WebRequest -Uri "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.zip" -OutFile "libvorbis.zip" - Expand-Archive -Path libvorbis.zip -DestinationPath ./dependencies/windows/ - Rename-Item ./dependencies/windows/libvorbis-1.3.7 libvorbis - - name: Download SDL2 - run: | - Invoke-WebRequest -Uri "https://libsdl.org/release/SDL2-devel-2.0.14-VC.zip" -OutFile "SDL2.zip" - Expand-Archive -Path SDL2.zip -DestinationPath ./dependencies/windows/ - Rename-Item ./dependencies/windows/SDL2-2.0.14 SDL2 - - name: Run vcpkg + with: + submodules: recursive + - name: Install dependencies run: | - vcpkg install libogg:x64-windows-static libvorbis:x64-windows-static libtheora:x64-windows-static - vcpkg integrate install - - name: Build Sonic Nexus + sudo apt-get update + sudo apt-get install libglew-dev libglfw3-dev libsdl2-dev libogg-dev libvorbis-dev + - name: Build RSDKv2 run: | - msbuild Nexus.sln /p:Configuration=Release /p:Platform=x64 /p:ForceImportBeforeCppTargets="$env:GITHUB_WORKSPACE/props/winactions_x64.props" + cmake -B build ${{env.GENERAL_FLAGS}} ${{env.GENERAL_LINUX_FLAGS}} + cmake --build build --parallel + # tar the executables so that they don't lose exec permissions + # see: https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss - name: Move artifacts run: | mkdir artifacts - move ./build/x64/Release/*.dll ./artifacts - move ./build/x64/Release/*.exe ./artifacts + mv ./build/Nexus* ./artifacts + tar -czvf linux.tar.gz -C ./artifacts . - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: Nexus-Windows-x64 - path: artifacts + name: v2-linux + path: linux.tar.gz