From 95dd0ff4c000f3752c5c9112d79de3a4bdaa7b25 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 17 Feb 2026 11:32:05 +0100 Subject: fix(build): Resolve clean build failure from generated timeline header When starting from a clean tree (where `src/generated/` does not exist), the build would fail with a "file not found" error for `generated/timeline.h`. This was due to an incorrect dependency graph where `gpu.cc` was compiled before its required header was generated. This commit fixes the issue by making the dependency explicit: - Modified `tools/seq_compiler.py` to explicitly generate `timeline.h` alongside `timeline.cc`. - Updated `cmake/DemoCodegen.cmake` to declare both files as `OUTPUT`s of the timeline compilation step. - Added a direct dependency from the `gpu` library target to the `generate_timeline` custom target in `cmake/DemoLibraries.cmake`. - Refactored the generated file paths in `DemoCodegen.cmake` into a single `GENERATED_CODE` variable for improved clarity and future-proofing. --- tools/seq_compiler.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'tools/seq_compiler.py') diff --git a/tools/seq_compiler.py b/tools/seq_compiler.py index dec3ab1..18d5a1f 100755 --- a/tools/seq_compiler.py +++ b/tools/seq_compiler.py @@ -710,11 +710,31 @@ void RenderTimeline(WGPUSurface surface, float time, int width, int height, } ''' - # Write output + # Write C++ output with open(args.output, 'w') as f: f.write(all_cpp) - print(f"Generated {len(sequences)} sequence(s) -> {args.output}") + # Write C++ header + header_path = os.path.splitext(args.output)[0] + ".h" + header_content = f'''// Generated by seq_compiler.py +// DO NOT EDIT +#pragma once + +#include "gpu/gpu.h" +#include "gpu/sequence.h" + +void InitializeSequences(const GpuContext& ctx, int width, int height); +Sequence* GetActiveSequence(float time); +void RenderTimeline(WGPUCommandEncoder encoder, float time, int width, int height, + float beat_time, float audio_intensity); +void RenderTimeline(WGPUSurface surface, float time, int width, int height, + float beat_time, float audio_intensity); +float GetDemoDuration(); +''' + with open(header_path, 'w') as f: + f.write(header_content) + + print(f"Generated {len(sequences)} sequence(s) -> {args.output} and {header_path}") if __name__ == '__main__': main() -- cgit v1.2.3