From bf46e44e1cb6027a072819a2a3aa3be32651f6e1 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 3 Feb 2026 18:44:41 +0100 Subject: refactor: Task #20 - Platform & Code Hygiene - Consolidated all WebGPU shims and platform-specific logic into src/platform.h. - Refactored platform_init to return PlatformState by value and platform_poll to automatically refresh time and aspect_ratio. - Removed STL dependencies (std::map, std::vector, std::string) from AssetManager and Procedural subsystems. - Fixed Windows cross-compilation by adjusting include paths and linker flags in CMakeLists.txt and updating build_win.sh. - Removed redundant direct inclusions of GLFW/glfw3.h and WebGPU headers across the project. - Applied clang-format and updated documentation. handoff(Gemini): Completed Task #20 and 20.1. Platform abstraction is now unified, and core paths are STL-free. Windows build is stable. --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 05623b6..6e96bea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,12 @@ set(CORE_INCLUDES src third_party) if (DEMO_CROSS_COMPILE_WIN32) add_definitions(-DDEMO_CROSS_COMPILE_WIN32) set(WINDOWS_DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/windows") - set(WGPU_INCLUDE_DIR "${WINDOWS_DEPS_DIR}/include/webgpu") + set(WGPU_INCLUDE_DIR "${WINDOWS_DEPS_DIR}/include") set(WGPU_LIBRARY "${WINDOWS_DEPS_DIR}/lib/libwgpu_native.dll.a") set(GLFW3_INCLUDE_DIR "${WINDOWS_DEPS_DIR}/include") set(GLFW3_LIBRARY "${WINDOWS_DEPS_DIR}/lib/libglfw3.a") - list(APPEND CORE_INCLUDES ${WGPU_INCLUDE_DIR} ${GLFW3_INCLUDE_DIR}) + list(APPEND CORE_INCLUDES ${WGPU_INCLUDE_DIR} ${WGPU_INCLUDE_DIR}/webgpu ${GLFW3_INCLUDE_DIR}) set(DEMO_LIBS ${GLFW3_LIBRARY} ${WGPU_LIBRARY} -lgdi32 -lws2_32 -luser32 -lkernel32 -lshell32 -ladvapi32 -ldwmapi) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") else() @@ -232,7 +232,11 @@ add_demo_executable(demo64k src/main.cc ${PLATFORM_SOURCES} ${GEN_DEMO_CC} ${GEN add_dependencies(demo64k generate_demo_assets generate_timeline generate_tracker_music)# Link order: Internal libs first, then external libs (DEMO_LIBS). # gpu and 3d depend on WGPU (in DEMO_LIBS). -target_link_libraries(demo64k PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) +if (APPLE) + target_link_libraries(demo64k PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) +else() + target_link_libraries(demo64k PRIVATE -Wl,--start-group 3d gpu audio procedural util -Wl,--end-group ${DEMO_LIBS}) +endif() #Size optimizations if (DEMO_SIZE_OPT) -- cgit v1.2.3