This commit is contained in:
parent
6ac0b124f2
commit
4df34fac91
3 changed files with 34 additions and 1 deletions
|
|
@ -82,6 +82,21 @@ namespace Crafter {
|
|||
libs.push_back(it.get<std::string>());
|
||||
}
|
||||
}
|
||||
if(config.contains("include_dirs")) {
|
||||
for (auto it : config["include_dirs"]) {
|
||||
includeDirs.push_back(it.get<std::string>());
|
||||
}
|
||||
}
|
||||
if(config.contains("lib_dirs")) {
|
||||
for (auto it : config["lib_dirs"]) {
|
||||
libDirs.push_back(it.get<std::string>());
|
||||
}
|
||||
}
|
||||
if(config.contains("cuda")) {
|
||||
for (auto it : config["cuda"]) {
|
||||
cuda.push_back(it.get<std::string>());
|
||||
}
|
||||
}
|
||||
if(config.contains("interfaces")) {
|
||||
const std::vector<std::string> tempModuleFiles = config["interfaces"].get<std::vector<std::string>>();
|
||||
std::vector<std::tuple<fs::path, std::string, ModulePartition*, Module*>> tempModulePaths = std::vector<std::tuple<fs::path, std::string, ModulePartition*, Module*>>(tempModuleFiles.size());
|
||||
|
|
|
|||
|
|
@ -250,6 +250,10 @@ namespace Crafter {
|
|||
command += " -O3";
|
||||
}
|
||||
|
||||
for(const std::string& dir : config.includeDirs) {
|
||||
command += std::format(" -I{}", dir);
|
||||
}
|
||||
|
||||
if(config.target != "wasm32-wasi") {
|
||||
const std::string stdPcm = std::format("{}/std.pcm", exeDir);
|
||||
std::string gccVersion = RunCommand("g++ -dumpversion");
|
||||
|
|
@ -337,12 +341,19 @@ namespace Crafter {
|
|||
|
||||
|
||||
for(const fs::path& cFile: config.c_files) {
|
||||
files+=std::format("{}_source.o ",(buildDir/cFile.filename()).string());
|
||||
files+=std::format(" {}_source.o ",(buildDir/cFile.filename()).string());
|
||||
if(!fs::exists((buildDir/cFile.filename()).string()+"_source.o") || fs::last_write_time(cFile.string()+".c") > fs::last_write_time((buildDir/cFile.filename()).string()+"_source.o")) {
|
||||
threads.emplace_back(&RunClang, std::format("clang {}.c -c -o {}_source.o", cFile.string(), (buildDir/cFile.filename()).string()));
|
||||
}
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> resultInterfaces(config.interfaces.size());
|
||||
|
||||
for(uint_fast32_t i = 0; i < config.interfaces.size(); i++) {
|
||||
|
|
@ -393,6 +404,10 @@ namespace Crafter {
|
|||
command += std::format(" -l{}", lib);
|
||||
}
|
||||
|
||||
for(const std::string& dir : config.libDirs) {
|
||||
command += std::format(" -L{}", dir);
|
||||
}
|
||||
|
||||
fileThread.join();
|
||||
|
||||
if(config.dependencies.size() > 0){
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@ namespace Crafter {
|
|||
std::string standard;
|
||||
std::vector<std::unique_ptr<Module>> interfaces;
|
||||
std::vector<Implementation> implementations;
|
||||
std::vector<std::string> includeDirs;
|
||||
std::vector<std::string> libDirs;
|
||||
std::vector<fs::path> c_files;
|
||||
std::vector<fs::path> cuda;
|
||||
std::vector<std::tuple<std::shared_ptr<Project>, Configuration&>> dependencies;
|
||||
std::vector<Shader> shaders;
|
||||
std::vector<fs::path> additionalFiles;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue