From ec9bef64253a478f82ccf87dd15ac8a25fdef467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 16 Jul 2025 14:51:33 +0200 Subject: [PATCH] Fix: GPU: Build issue caused by missing directories When running `make` it can happen that the target directory was not created before the invocation of `glsl_preprocess`. This patch copies #141404 and creates the output directory before creating the output files. --- .../blender/gpu/glsl_preprocess/glsl_preprocess.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/blender/gpu/glsl_preprocess/glsl_preprocess.cc b/source/blender/gpu/glsl_preprocess/glsl_preprocess.cc index d30f3bb18a8..da110d2eccf 100644 --- a/source/blender/gpu/glsl_preprocess/glsl_preprocess.cc +++ b/source/blender/gpu/glsl_preprocess/glsl_preprocess.cc @@ -6,6 +6,7 @@ * \ingroup glsl_preprocess */ +#include #include #include #include @@ -32,6 +33,19 @@ int main(int argc, char **argv) exit(1); } + /* We make the required directories here rather than having the build system + * do the work for us, as having cmake do it leads to several thousand cmake + * instances being launched, leading to significant overhead, see pr #141404 + * for details. */ + std::filesystem::path parent_dir = std::filesystem::path(output_file_name).parent_path(); + std::error_code ec; + if (!std::filesystem::create_directories(parent_dir, ec)) { + if (ec) { + std::cerr << "Unable to create " << parent_dir << " : " << ec.message() << std::endl; + exit(1); + } + } + /* Open the output file for writing */ std::ofstream output_file(output_file_name, std::ofstream::out | std::ofstream::binary); if (!output_file) {