From 938da0d4dc08c3af2fbabb299079ec903f653f3b Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Mon, 5 May 2025 12:48:52 -0500 Subject: [PATCH] Use thin lto for release builds; move 'strip' to meson.build for release --- .github/workflows/build.yml | 19 +++++-------------- Makefile | 2 +- meson.build | 22 +++++++++++++++++++++- scripts/modules/graphics.js | 7 ------- tests/bunnymark.js | 2 +- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46cc658a..0d01e3fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,14 +22,13 @@ jobs: - name: Build Prosperon (Linux) run: | - meson setup build -Dbuildtype=release -Db_lto=true -Db_ndebug=true + meson setup build -Dbuildtype=release -Db_lto=true -Db_lto_mode=thin -Db_ndebug=true meson compile -C build - name: Test Prosperon (Linux) env: { TRACY_NO_INVARIANT_CHECK: 1 } run: | meson test --print-errorlogs -C build - strip build/prosperon - name: Upload Test Log (Linux) if: ${{ always() }} @@ -73,7 +72,7 @@ jobs: - name: Build Prosperon (Windows) shell: msys2 {0} run: | - meson setup build -Dbuildtype=release -Db_lto=true -Db_ndebug=true -Dtracy:only_localhost=true -Dtracy:no_broadcast=true + meson setup build -Dbuildtype=release -Db_lto=true -Db_lto_mode=thin -Db_ndebug=true -Dtracy:only_localhost=true -Dtracy:no_broadcast=true meson compile -C build - name: Test Prosperon (Windows) @@ -81,7 +80,6 @@ jobs: env: { TRACY_NO_INVARIANT_CHECK: 1 } run: | meson test --print-errorlogs -C build - strip build/prosperon.exe - name: Upload Test Log (Windows) if: ${{ always() }} @@ -110,13 +108,12 @@ jobs: - name: Build Prosperon (macOS) run: | - meson setup build -Dbuildtype=release -Db_lto=true -Db_ndebug=true + meson setup build -Dbuildtype=release -Db_lto=true -Db_lto_mode=thin -Db_ndebug=true meson compile -C build - name: Test Prosperon (macOS) run: | - meson test --pring-errorlogs -C build - strip build/prosperon + meson test --print-errorlogs -C build - name: Upload Test Log (macOS) if: ${{ always() }} @@ -125,18 +122,12 @@ jobs: name: testlog-macos path: build/meson-logs/testlog.txt - - name: Create artifact folder (macOS) - run: | - mkdir _pack - cp build_macos/prosperon _pack/ - cp sdl3-macos/libSDL3*.dylib _pack/ || true - - name: Upload Artifact (macOS) if: startsWith(github.ref, 'refs/tags/v') uses: actions/upload-artifact@v3 with: name: prosperon-artifacts-macos - path: prosperon + path: build/prosperon # ────────────────────────────────────────────────────────────── # PACKAGE CROSS-PLATFORM DIST diff --git a/Makefile b/Makefile index af658e1d..63313c9f 100755 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ fast: FORCE meson compile -C build_fast release: FORCE - meson setup -Dbuildtype=release -Db_lto=true -Db_ndebug=true build_release + meson setup -Dbuildtype=release -Db_lto=true -Db_lto_mode=thin -Db_ndebug=true build_release meson compile -C build_release sanitize: FORCE diff --git a/meson.build b/meson.build index 3219f7e0..01c96b19 100644 --- a/meson.build +++ b/meson.build @@ -213,6 +213,26 @@ prosperon_raw = executable('prosperon_raw', sources, install:false ) +strip_enabled = ['release', 'minsize'].contains(get_option('buildtype')) + +if strip_enabled + prosperon_raw_stripped = custom_target('prosperon_raw_stripped', + input: prosperon_raw, + output: 'prosperon_raw_stripped', + command: [ + 'sh', '-c', + 'strip "$1" && cp "$1" "$2"', + 'stripper', + '@INPUT@', + '@OUTPUT@' + ], + build_by_default: true + ) + exe_for_concat = prosperon_raw_stripped +else + exe_for_concat = prosperon_raw +endif + if host_machine.system() == 'windows' exe_ext = '.exe' else @@ -221,7 +241,7 @@ endif prosperon = custom_target('prosperon', output: 'prosperon' + exe_ext, - input: [prosperon_raw, core], + input: [exe_for_concat, core], command: [ 'sh', '-c', 'cat "$1" "$2" > "$3" && chmod +x "$3" >/dev/null 2>&1', diff --git a/scripts/modules/graphics.js b/scripts/modules/graphics.js index fd9304a9..5fdb8eb1 100644 --- a/scripts/modules/graphics.js +++ b/scripts/modules/graphics.js @@ -310,13 +310,6 @@ graphics.cull_sprites[prosperon.DOC] = ` Filter an array of sprites to only those visible in the provided camera’s view. ` -graphics.rects_to_sprites[prosperon.DOC] = ` -:param rects: An array of rect coords or objects. -:param image: An image object (with .texture). -:return: An array of sprite objects referencing the 'image' and each rect for UV or position. -Convert an array of rect coords into sprite objects referencing a single image. -` - graphics.make_surface[prosperon.DOC] = ` :param dimensions: The size object {width, height}, or an array [w,h]. :return: A blank RGBA surface with the given dimensions, typically for software rendering or icons. diff --git a/tests/bunnymark.js b/tests/bunnymark.js index a6ddc3a6..646fd6b2 100644 --- a/tests/bunnymark.js +++ b/tests/bunnymark.js @@ -84,7 +84,7 @@ function loop() render.present() dt = os.now() - now - + fps_samples.push(dt) if (fps_samples.length > fps_window) fps_samples.shift()