# Embeds the native renderer HLSL sources (src/native/shaders/*.hlsl) into a # generated C++ header so the exe stays self-contained. Run as a script: # cmake -DSHADER_DIR= -DOUT=
-P EmbedShaders.cmake # Each shader becomes `inline constexpr char [] = R"__hlsl__(...)__hlsl__";` # with a leading newline, matching the original in-cpp raw string literals # (consumers use sizeof(kX) - 1). set(SHADER_VARS kShaderSource kShadowBlurSource kResolveShaderSource kBlurShaderSource kOutlineShaderSource kShader2dSource kShaderSplineSource kPhotoFxShaderSource kSsaoShaderSource kHdrShaderSource kSsrShaderSource ) set(SHADER_FILES scene.hlsl shadow_blur.hlsl resolve.hlsl blur.hlsl outline.hlsl overlay2d.hlsl spline.hlsl photo_fx.hlsl ssao.hlsl hdr.hlsl ssr.hlsl ) set(content "// Generated by cmake/EmbedShaders.cmake from src/native/shaders/*.hlsl.\n") string(APPEND content "// DO NOT EDIT - edit the .hlsl files instead.\n") string(APPEND content "#pragma once\n\n") foreach(var file IN ZIP_LISTS SHADER_VARS SHADER_FILES) file(READ "${SHADER_DIR}/${file}" src) string(FIND "${src}" ")__hlsl__" collision) if(NOT collision EQUAL -1) message(FATAL_ERROR "${file} contains the raw-string delimiter )__hlsl__") endif() string(APPEND content "// ${file}\n") string(APPEND content "inline constexpr char ${var}[] = R\"__hlsl__(\n${src})__hlsl__\";\n\n") endforeach() file(WRITE "${OUT}" "${content}")