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) {