diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9161962..2e8f6c56 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,35 +18,8 @@ jobs: with: fetch-depth: 0 - - name: Cache SDL3 (Linux) - uses: actions/cache@v3 - with: - path: | - sdl3 - sdl3-build - key: sdl3-linux-${{ hashFiles('sdl3/CMakeLists.txt') }} - - - name: Build SDL3 (Linux) - run: | - if [ ! -d "sdl3/.git" ]; then - echo "Cloning SDL3 repository..." - git clone --depth 1 --branch main https://github.com/libsdl-org/SDL.git sdl3 - else - echo "SDL3 source is already present (possibly from cache)." - fi - mkdir -p sdl3-build - cd sdl3-build - cmake ../sdl3 -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${PWD}/installed_sdl3" \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=OFF - ninja - ninja install - - name: Build Prosperon (Linux) run: | - export PKG_CONFIG_PATH="${PWD}/sdl3-build/installed_sdl3/lib/pkgconfig:$PKG_CONFIG_PATH" meson setup build -Dbuildtype=release -Db_lto=true -Db_ndebug=true meson compile -C build @@ -55,6 +28,7 @@ jobs: TRACY_NO_INVARIANT_CHECK: 1 run: | meson test --print-errorlogs -C build + strip build/prosperon - name: Upload Test Log (Linux) if: ${{ always() }} @@ -63,19 +37,12 @@ jobs: name: testlog-linux path: build/meson-logs/testlog.txt - - name: Create artifact folder (Linux) - if: startsWith(github.ref, 'refs/tags/v') - run: | - mkdir _pack - cp build/prosperon _pack/ - cp sdl3-build/installed_sdl3/lib/libSDL3.so _pack/ - - name: Upload Artifact (Linux) if: startsWith(github.ref, 'refs/tags/v') uses: actions/upload-artifact@v3 with: name: prosperon-artifacts-linux - path: _pack + path: build/prosperon build-windows: runs-on: win-native @@ -101,7 +68,6 @@ jobs: pacboy: | meson cmake - sdl3 toolchain - name: Build Prosperon @@ -117,6 +83,7 @@ jobs: TRACY_NO_INVARIANT_CHECK: 1 run: | meson test --print-errorlogs -C build + strip build/prosperon.exe - name: Upload Test Log if: ${{ always() }} @@ -125,20 +92,12 @@ jobs: name: testlog-windows path: build/meson-logs/testlog.txt - - name: Create package folder - if: startsWith(github.ref, 'refs/tags/v') - shell: msys2 {0} - run: | - mkdir _pack - cp build/prosperon.exe _pack/ - pacboy sdl3 | grep "SDL3.dll$" | awk '{print $2}' | xargs -I {} cp {} _pack/ - - name: Upload Artifact (Windows) if: startsWith(github.ref, 'refs/tags/v') uses: actions/upload-artifact@v3 with: name: prosperon-artifacts-windows - path: _pack + path: build/prosperon.exe package-dist: needs: [build-linux, build-windows] diff --git a/README.md b/README.md index 381f706d..e9684a35 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ Thank you for using Prosperon! -Provided are prosperon builds for all available platforms, including SDL3 for each respective one. SDL3 must be present in the same folder as prosperon to run! +Provided are prosperon builds for all available platforms. Simply run prosperon for your platform in a game folder to play! -To get started, take a dive into the provided example games in the examples folder. Just copy the prosperon executable for your platform, along with its SDL3 library, into any provided example folder, then run it! - -NOTE: For MacOS, SDL3 must first be installed with homebrew. After installing homebrew, run `brew install sdl3`. This will be fixed in a future release! +To get started, take a dive into the provided example games in the examples folder. Just copy the prosperon executable for your platform, into any provided example folder, then run it! You can take a look through the docs folder for the prosperon manual to learn all about it. The manual is available on the web at [docs.prosperon.dev](https://docs.prosperon.dev). diff --git a/meson.build b/meson.build index 10a5b361..5f0226ab 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('prosperon', ['c', 'cpp'], default_options : [ 'cpp_std=c++11']) -libtype = get_option('default_library') +libtype = get_option('default_library') link = [] src = [] @@ -44,8 +44,16 @@ if host_machine.system() == 'darwin' endforeach endif +cmake = import('cmake') + +sdl3_cmake_options = [ + '-DSDL_STATIC=ON', + '-DSDL_SHARED=OFF', + '-DSDL_TEST=OFF', + '-DCMAKE_BUILD_TYPE=Release', +] + cc = meson.get_compiler('c') -deps += dependency('sdl3', required:true) if host_machine.system() == 'darwin' deps += dependency('appleframeworks', modules: 'accelerate') @@ -56,22 +64,29 @@ endif if host_machine.system() == 'linux' deps += cc.find_library('asound', required:true) deps += [dependency('x11'), dependency('xi'), dependency('xcursor'), dependency('egl'), dependency('gl')] -# link += '-fuse-ld=mold' # use mold, which is very fast, for debug builds endif if host_machine.system() == 'windows' deps += cc.find_library('d3d11') - # these are for tracy deps += cc.find_library('ws2_32', required:true) deps += cc.find_library('dbghelp') - #end - link += '-static' # Required to pack in mingw dlls on cross compilation + deps += cc.find_library('winmm') + deps += cc.find_library('setupapi') + deps += cc.find_library('imm32') + deps += cc.find_library('version') + deps += cc.find_library('cfgmgr32') + sdl3_cmake_options += '-DHAVE_ISINF=1' # TODO: A hack to get this to compile on MSYS2; otherwise it doesn't link correctly + link += '-static' endif if host_machine.system() == 'emscripten' link += '-sUSE_WEBGPU' endif +sdl3_proj = cmake.subproject('sdl3', cmake_options: sdl3_cmake_options) + +deps += sdl3_proj.dependency('SDL3-static') + tracy_opts = ['fibers=true', 'on_demand=true'] quickjs_opts = [] diff --git a/subprojects/sdl3.wrap b/subprojects/sdl3.wrap new file mode 100644 index 00000000..b8a3116f --- /dev/null +++ b/subprojects/sdl3.wrap @@ -0,0 +1,4 @@ +[wrap-git] +url = https://github.com/libsdl-org/SDL.git +revision = release-3.2.4 +depth = 1