cyberdeck-quake3/cmake/utils/stringify_shader.cmake
orca 42e5f92c3a Import ioquake3 upstream at 83a7762
Unmodified ioquake3 source from https://github.com/ioquake/ioq3
(commit 83a7762, Sep 2026), the base for the cyberdeck arena game code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 23:34:08 -04:00

13 lines
497 B
CMake

# Convert a shader file to a compilable C file
# INPUT_FILE, OUTPUT_FILE, SHADER_NAME must be set via -D
file(READ ${INPUT_FILE} CONTENTS)
string(REPLACE "\\" "\\\\" CONTENTS "${CONTENTS}") # Escape backslashes
string(REPLACE "\"" "\\\"" CONTENTS "${CONTENTS}") # Escape double quotes
string(REPLACE "\n" "\\n\"\n\"" CONTENTS "${CONTENTS}") # Escape newlines
set(OUTPUT_CONTENT "const char *fallbackShader_${SHADER_NAME} =\n\"${CONTENTS}\";\n")
file(WRITE ${OUTPUT_FILE} "${OUTPUT_CONTENT}")