diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-28 00:41:07 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-28 00:41:07 +0100 |
| commit | a7bcf5e9cd6884d010b5cec0146293a0515242fc (patch) | |
| tree | bcc07dd93e19c7b429363c8cac1e9866762f6e6e /CMakeLists.txt | |
| parent | 9dcf94ab01269311b4e5d39be23c95560904c626 (diff) | |
feat: Implement fullscreen, keyboard controls, and pulsating heptagon
This commit fulfills tasks 1 and 2, and adds a synchronized visual effect.
- **Fullscreen Mode**: Added '--fullscreen' command-line argument and dynamic toggling via 'F' key.
- **Keyboard Controls**: Implemented 'Esc' to exit and 'F' to toggle fullscreen in 'src/platform.cc'.
- **Synchronized Visuals**: Added a pulsating heptagon effect in 'src/gpu/gpu.cc' and 'src/gpu/shader.wgsl' that scales and changes color based on the real-time audio peak from the synth.
- **Refactor**: Abstracted platform-specific WebGPU surface creation into 'src/platform.cc' to keep 'src/gpu/gpu.cc' cross-platform.
- **Build System**: Corrected 'CMakeLists.txt' to properly link 'wgpu-native' and platform frameworks, and updated 'project_init.sh' to build the submodule.
- **Documentation**: Updated 'HOWTO.md' and 'PROJECT_CONTEXT.md' with new features and decisions.
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 75 |
1 files changed, 47 insertions, 28 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 92d12f2..b06bd6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,43 @@ option(DEMO_SIZE_OPT "Enable size optimization flags" OFF) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Search in both debug and release +set(WGPU_SEARCH_PATHS + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/wgpu-native/target/debug + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/wgpu-native/target/release +) + +find_library( + WGPU_LIBRARY NAMES libwgpu_native.a wgpu_native.lib wgpu_native + HINTS ${WGPU_SEARCH_PATHS} + REQUIRED +) + +include_directories( + src + third_party + third_party/wgpu-native/ffi + third_party/wgpu-native/ffi/webgpu-headers +) + +find_package(glfw3 REQUIRED) + +set(DEMO_LIBS glfw ${WGPU_LIBRARY}) + +# Platform-specific dependencies for wgpu-native +if (APPLE) + set_source_files_properties(src/platform.cc PROPERTIES COMPILE_FLAGS "-x objective-c++") + list(APPEND DEMO_LIBS + "-framework Metal" + "-framework Foundation" + "-framework Cocoa" + "-framework QuartzCore" + ) +else() + # Assume Linux/other POSIX-like systems might need these + list(APPEND DEMO_LIBS pthread m dl) +endif() + add_executable(demo64k src/main.cc src/platform.cc @@ -17,13 +54,7 @@ add_executable(demo64k src/audio/synth.cc ) -target_include_directories(demo64k PRIVATE - src - third_party -) - -find_package(glfw3 REQUIRED) -target_link_libraries(demo64k PRIVATE glfw) +target_link_libraries(demo64k PRIVATE ${DEMO_LIBS}) if (DEMO_SIZE_OPT) if (MSVC) @@ -43,9 +74,7 @@ if(DEMO_BUILD_TESTS) src/tests/test_window.cc src/audio/window.cc ) - target_include_directories(test_window PRIVATE - src - ) + target_include_directories(test_window PRIVATE src) add_test(NAME HammingWindowTest COMMAND test_window) add_executable(test_synth @@ -54,24 +83,19 @@ if(DEMO_BUILD_TESTS) src/audio/idct.cc src/audio/window.cc ) - target_include_directories(test_synth PRIVATE - src - ) + target_include_directories(test_synth PRIVATE src) add_test(NAME SynthEngineTest COMMAND test_synth) add_executable(test_spectool src/tests/test_spectool.cc - src/audio/audio.cc # For miniaudio implementation + src/audio/audio.cc src/audio/window.cc src/audio/fdct.cc src/audio/synth.cc src/audio/idct.cc ) - target_include_directories(test_spectool PRIVATE - src - third_party - ) - add_dependencies(test_spectool spectool) + target_include_directories(test_spectool PRIVATE src third_party) + target_link_libraries(test_spectool PRIVATE ${DEMO_LIBS}) add_test(NAME SpectoolEndToEndTest COMMAND test_spectool) endif() @@ -86,16 +110,11 @@ if(DEMO_BUILD_TOOLS) src/audio/window.cc src/audio/synth.cc ) - target_include_directories(spectool PRIVATE - src - third_party - ) - target_link_libraries(spectool PRIVATE glfw) + target_include_directories(spectool PRIVATE src third_party) + target_link_libraries(spectool PRIVATE ${DEMO_LIBS}) add_executable(specview tools/specview.cc ) - target_include_directories(specview PRIVATE - src - ) -endif() + target_include_directories(specview PRIVATE src) +endif()
\ No newline at end of file |
