This commit is contained in:
parent
4df34fac91
commit
aa65d9ea46
3 changed files with 91 additions and 13 deletions
|
|
@ -173,7 +173,7 @@ namespace Crafter {
|
|||
|
||||
std::vector<std::thread> threads;
|
||||
for(const Shader& shader : config.shaders) {
|
||||
if(shader.Check(outputDir)) {
|
||||
if(!shader.Check(outputDir)) {
|
||||
threads.emplace_back(&Shader::Compile, &shader, outputDir);
|
||||
}
|
||||
}
|
||||
|
|
@ -183,19 +183,40 @@ namespace Crafter {
|
|||
fs::path destination = outputDir / additionalFile.filename();
|
||||
|
||||
if (fs::is_directory(additionalFile)) {
|
||||
if (!fs::exists(destination)) {
|
||||
fs::copy(additionalFile, destination, fs::copy_options::recursive);
|
||||
} else if (fs::last_write_time(additionalFile) > fs::last_write_time(destination)) {
|
||||
fs::remove_all(destination);
|
||||
fs::copy(additionalFile, destination, fs::copy_options::recursive);
|
||||
|
||||
for (const auto& entry : fs::recursive_directory_iterator(additionalFile)) {
|
||||
|
||||
const fs::path& sourcePath = entry.path();
|
||||
|
||||
// Compute relative path inside the directory
|
||||
fs::path relativePath = fs::relative(sourcePath, additionalFile);
|
||||
fs::path destPath = destination / relativePath;
|
||||
|
||||
if (entry.is_directory()) {
|
||||
// Ensure directory exists in destination
|
||||
if (!fs::exists(destPath)) {
|
||||
fs::create_directories(destPath);
|
||||
}
|
||||
} else if (entry.is_regular_file()) {
|
||||
// Ensure parent directory exists
|
||||
fs::create_directories(destPath.parent_path());
|
||||
|
||||
if (!fs::exists(destPath)) {
|
||||
fs::copy_file(sourcePath, destPath);
|
||||
}
|
||||
else if (fs::last_write_time(sourcePath) > fs::last_write_time(destPath)) {
|
||||
fs::copy_file(sourcePath, destPath, fs::copy_options::overwrite_existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Handle regular file
|
||||
if (!fs::exists(destination)) {
|
||||
fs::copy(additionalFile, destination);
|
||||
} else if (fs::last_write_time(additionalFile) > fs::last_write_time(destination)) {
|
||||
fs::remove(destination);
|
||||
fs::copy(additionalFile, destination);
|
||||
fs::copy_file(additionalFile, destination);
|
||||
}
|
||||
else if (fs::last_write_time(additionalFile) > fs::last_write_time(destination)) {
|
||||
fs::copy_file(additionalFile, destination, fs::copy_options::overwrite_existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -208,7 +229,7 @@ namespace Crafter {
|
|||
}
|
||||
path[count] = '\0';
|
||||
const std::string exeDir = fs::path(path).parent_path().parent_path().string();
|
||||
std::string command = "clang++";
|
||||
std::string command = "clang++ -Wno-unused-command-line-argument";
|
||||
if(!config.target.empty()) {
|
||||
command += std::format(" --target={}", config.target);
|
||||
if(config.target == "wasm32-wasi") {
|
||||
|
|
@ -350,7 +371,7 @@ namespace Crafter {
|
|||
for(const fs::path& cFile: config.cuda) {
|
||||
files+=std::format(" {}_source.o ",(buildDir/cFile.filename()).string());
|
||||
if(!fs::exists((buildDir/cFile.filename()).string()+"_source.o") || fs::last_write_time(cFile.string()+".cu") > fs::last_write_time((buildDir/cFile.filename()).string()+"_source.o")) {
|
||||
threads.emplace_back(&RunClang, std::format("nvcc {}.cu -c -o {}_source.o", cFile.string(), (buildDir/cFile.filename()).string()));
|
||||
threads.emplace_back(&RunClang, std::format("nvcc {}.cu -c -o {}_source.o -O3 -arch=sm_89", cFile.string(), (buildDir/cFile.filename()).string()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue