This commit is contained in:
Jorijn van der Graaf 2025-04-24 19:21:09 +02:00
commit be18fb8568
12 changed files with 427 additions and 19 deletions

View file

@ -99,18 +99,32 @@ void ModuleFile::Compile(std::string clangDir, const Configuration& config, fs::
for(const std::string& flag : config.flags) {
flags+=flag;
}
if(config.debug) {
flags+=" -g";
}
std::string march;
if(config.target != "wasm32-unknown-wasi"){
march = std::format("-march={}", config.march);
}
system(std::format("{} -std={} {}.cppm --precompile {} {} -fprebuilt-module-path={} -o {}.pcm {}", clangDir, config.standard, path.generic_string(), march, flags, pcmDir.generic_string(), (pcmDir/path.filename()).generic_string(), target).c_str());
std::string command = std::format("{} {} -std={} {}.cppm --precompile {} -fprebuilt-module-path={} -o {}.pcm {}", clangDir, flags, config.standard, path.generic_string(), march, pcmDir.generic_string(), (pcmDir/path.filename()).generic_string(), target);
if(config.verbose) {
std::cout << command << std::endl;
}
system(command.c_str());
recompiled = true;
fileMutex.unlock();
system(std::format("{} -std={} {}.pcm -fprebuilt-module-path={} -c -O{} {} {} -o {}.o {}", clangDir, config.standard, (pcmDir/path.filename()).generic_string(), pcmDir.generic_string(), config.optimizationLevel, march, flags, (config.buildDir/path.filename()).generic_string(), target).c_str());
command = std::format("{} -std={} {}.pcm -fprebuilt-module-path={} -c -O{} {} {} -o {}.o {}", clangDir, config.standard, (pcmDir/path.filename()).generic_string(), pcmDir.generic_string(), config.optimizationLevel, march, flags, (config.buildDir/path.filename()).generic_string(), target);
if(config.verbose) {
std::cout << command << std::endl;
}
system(command.c_str());
} else {
fileMutex.unlock();
}