From 26915d8c47260f90d67df8c6af1f16ba7607a3d5 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 9 Feb 2026 18:34:20 +0100 Subject: feat: Implement Task #76 external library size measurement - Use ma_backend_null for audio (100-200KB savings) - Stub platform/gpu abstractions instead of external APIs - Add DEMO_STRIP_EXTERNAL_LIBS build mode - Create stub_types.h with minimal WebGPU opaque types - Add scripts/measure_size.sh for automated measurement Results: Demo=4.4MB, External=2.0MB (69% vs 31%) handoff(Claude): Task #76 complete. Binary compiles but doesn't run (size measurement only). --- src/platform/stub_platform.cc | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/platform/stub_platform.cc (limited to 'src/platform/stub_platform.cc') diff --git a/src/platform/stub_platform.cc b/src/platform/stub_platform.cc new file mode 100644 index 0000000..61473a0 --- /dev/null +++ b/src/platform/stub_platform.cc @@ -0,0 +1,53 @@ +// Stub platform implementation for size measurement builds. +// All functions are no-ops. Binary compiles but does NOT run. +// This file is only compiled when STRIP_EXTERNAL_LIBS is defined. + +#if defined(STRIP_EXTERNAL_LIBS) + +#include "platform.h" +#include "stub_types.h" + +// Forward declare GLFWwindow stub +struct GLFWwindow {}; + +PlatformState platform_init(bool fullscreen, int width, int height) { + (void)fullscreen; + PlatformState state = {}; + state.width = width; + state.height = height; + state.aspect_ratio = (float)width / (float)height; + state.window = nullptr; + state.time = 0.0; + state.is_fullscreen = false; + return state; +} + +void platform_shutdown(PlatformState* state) { + (void)state; +} + +void platform_poll(PlatformState* state) { + (void)state; +} + +bool platform_should_close(PlatformState* state) { + (void)state; + return false; +} + +void platform_toggle_fullscreen(PlatformState* state) { + (void)state; +} + +WGPUSurface platform_create_wgpu_surface(WGPUInstance instance, + PlatformState* state) { + (void)instance; + (void)state; + return nullptr; +} + +double platform_get_time() { + return 0.0; +} + +#endif // STRIP_EXTERNAL_LIBS -- cgit v1.2.3