From 7ed0286e8cd40367ab6ba7f100e3b30d9d1ae383 Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 28 Jan 2026 01:27:02 +0100 Subject: opt: Implement build stripping and platform-specific size optimizations Adds a 'STRIP_ALL' mode to minimize binary size for the final build, and refines size optimization flags for macOS. - **STRIP_ALL Mode**: Added a 'DEMO_STRIP_ALL' CMake option that defines 'STRIP_ALL'. In this mode, command-line parsing is bypassed (forcing fullscreen), debug labels/error callbacks are removed from WebGPU, and non-essential code (like iostream) is stripped. - **macOS Optimizations**: Updated CMake to use '-dead_strip' instead of GNU '--gc-sections' on Apple platforms to resolve linker errors and improve dead code elimination. - **Documentation**: Updated HOWTO.md to document the new 'Final / Strip Build' process and FETCH_DEPS.md for optimized wgpu-native build guidance. - **Task 7 & 8**: Marks these tasks as completed in PROJECT_CONTEXT.md. --- src/main.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main.cc') diff --git a/src/main.cc b/src/main.cc index 315fa10..ef48f21 100644 --- a/src/main.cc +++ b/src/main.cc @@ -28,12 +28,19 @@ void generate_tone(float *buffer, float freq) { int main(int argc, char **argv) { bool fullscreen_enabled = false; + +#ifndef STRIP_ALL for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "--fullscreen") == 0) { fullscreen_enabled = true; break; } } +#else + (void)argc; + (void)argv; + fullscreen_enabled = true; +#endif platform_init_window(fullscreen_enabled); gpu_init(platform_get_window()); -- cgit v1.2.3