Files
Behdad EsfahbodandClaude Opus 4.6 b1ad797e50 [gpu] Commit stringized shader headers; auto-regenerate like ragel
Pre-generate hb-gpu-{fragment,vertex}-glsl.hh from the .glsl
sources so the library builds without Python/stringize at
compile time.

When stringize is found, a build rule regenerates them from
the .glsl sources and copies back to the source tree, matching
the ragel artifact pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 23:37:52 -06:00

27 lines
563 B
Python
Executable File

#! /usr/bin/env python3
import sys
try:
decl = sys.argv[1]
except IndexError:
sys.stderr.write("hb-gpu-stringize: missing declaration: {}\n".format(sys.argv))
sys.exit(1)
try:
filename = sys.argv[2]
except IndexError:
sys.stderr.write("hb-gpu-stringize: missing filename: {}\n".format(sys.argv))
sys.exit(1)
file = open(filename, 'r')
print(f'{decl} =')
text = file.read(-1)
lines = text.splitlines()
for line in lines:
line = line.replace(r'\\', r'\\\\')
line = line.replace(r'"', r'\"')
print(f'"{line}\\n"')
print(';')