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.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* \ingroup glsl_preprocess
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user