fixed error shader crash
Some checks failed
CI / build-test-release (push) Has been cancelled

This commit is contained in:
Jorijn van der Graaf 2026-05-01 19:02:14 +02:00
commit df9436c51d
3 changed files with 67 additions and 31 deletions

View file

@ -417,6 +417,7 @@ BuildResult Crafter::Build(Configuration& config, std::unordered_map<fs::path, s
std::string files;
std::unordered_set<std::string> libSet;
std::unordered_set<std::string> publicFlagSet;
std::mutex fileMutex;
std::vector<std::thread> depThreads;
depThreads.reserve(config.dependencies.size());
@ -477,6 +478,7 @@ BuildResult Crafter::Build(Configuration& config, std::unordered_map<fs::path, s
const BuildResult& result = resultFuture.get();
fileMutex.lock();
for (const std::string& lib : result.libs) libSet.insert(lib);
for (const std::string& f : result.publicCompileFlags) publicFlagSet.insert(f);
fileMutex.unlock();
if (!result.result.empty()) {
bool expected = false;
@ -577,10 +579,19 @@ BuildResult Crafter::Build(Configuration& config, std::unordered_map<fs::path, s
for(const std::string& flag : config.linkFlags) {
buildResult.libs.insert(flag);
}
// Public compile flags propagated from sub-deps. Add them to this build's
// command so config sees the headers its deps expose, and re-publish them
// so config's own consumers see them transitively.
for (const std::string& flag : publicFlagSet) command += " " + flag;
buildResult.publicCompileFlags = std::move(publicFlagSet);
fs::file_time_type externalFloor = fs::file_time_type::min();
for(const ExternalBuildResult& ext : externalResults) {
for(const std::string& flag : ext.compileFlags) {
command += " " + flag;
// Headers a dep links via ExternalDependency are part of its
// public surface (its modules can include them in declarations
// visible to consumers), so propagate the -I to consumers.
buildResult.publicCompileFlags.insert(flag);
}
for(const std::string& flag : ext.linkFlags) {
buildResult.libs.insert(flag);
@ -1047,6 +1058,11 @@ int Crafter::Run(int argc, char** argv) {
// through cmd /c, so the relative-prefixed path makes cmd error
// with "'.' is not recognized as an internal or external command".
artifact = fs::absolute(artifact);
// Run from the artifact's own directory so relative file opens
// (shaders, assets copied alongside the exe via cfg.files) resolve
// against the bin dir rather than the user's cwd. We exit the
// process immediately after, so no cwd restore needed.
fs::current_path(dir);
return std::system(artifact.string().c_str()) == 0 ? 0 : 1;
}