defines
This commit is contained in:
parent
35f943af53
commit
5af6d0080a
8 changed files with 93 additions and 73 deletions
|
|
@ -55,10 +55,8 @@ ModulePartition::ModulePartition(const std::string& name, const fs::path& path,
|
|||
}
|
||||
if(!fs::exists((pcmDir/path.filename()).generic_string()+".pcm")) {
|
||||
needsRecompiling = true;
|
||||
needsRecompilingDependency = true;
|
||||
} else if(fs::last_write_time(path.generic_string()+".cppm") > fs::last_write_time((pcmDir/path.filename()).generic_string()+".pcm")) {
|
||||
needsRecompiling = true;
|
||||
needsRecompilingDependency = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +75,7 @@ void ModulePartition::AddDependants() {
|
|||
void ModulePartition::Check() {
|
||||
if(!needsRecompiling) {
|
||||
for(ModulePartition* dependency : partitionDependenciesP) {
|
||||
if(dependency->needsRecompilingDependency) {
|
||||
if(dependency->needsRecompiling) {
|
||||
needsRecompiling = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -87,12 +85,16 @@ void ModulePartition::Check() {
|
|||
|
||||
void ModulePartition::Compile(std::string clangDir, const Configuration& config, fs::path pcmDir, std::string target, const std::string& march, const std::string& flags) {
|
||||
if(needsRecompiling) {
|
||||
std::string defines;
|
||||
for(const Define& define : config.defines) {
|
||||
defines+=define.ToString();
|
||||
}
|
||||
for(ModulePartition* dependency : partitionDependenciesP) {
|
||||
if(dependency->needsRecompiling) {
|
||||
dependency->compiled->wait(false);
|
||||
}
|
||||
}
|
||||
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);
|
||||
std::string command = std::format("{} {} {} -std={} {}.cppm --precompile {} -fprebuilt-module-path={} -o {}.pcm {}", clangDir, defines, flags, config.standard, path.generic_string(), march, pcmDir.generic_string(), (pcmDir/path.filename()).generic_string(), target);
|
||||
if(config.verbose) {
|
||||
std::cout << command << std::endl;
|
||||
}
|
||||
|
|
@ -102,7 +104,11 @@ void ModulePartition::Compile(std::string clangDir, const Configuration& config,
|
|||
compiled->notify_all();
|
||||
}
|
||||
void ModulePartition::CompileSource(std::string clangDir, const Configuration& config, fs::path pcmDir, std::string target, const std::string& march, const std::string& flags, const fs::path& buildDir) {
|
||||
std::string 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, (buildDir/path.filename()).generic_string(), target);
|
||||
std::string defines;
|
||||
for(const Define& define : config.defines) {
|
||||
defines+=define.ToString();
|
||||
}
|
||||
std::string command = std::format("{} {} -std={} {}.pcm -fprebuilt-module-path={} -c -O{} {} {} -o {}.o {}", clangDir, defines, config.standard, (pcmDir/path.filename()).generic_string(), pcmDir.generic_string(), config.optimizationLevel, march, flags, (buildDir/path.filename()).generic_string(), target);
|
||||
if(config.verbose) {
|
||||
std::cout << command << std::endl;
|
||||
}
|
||||
|
|
@ -145,9 +151,12 @@ void Module::Check() {
|
|||
val.Check();
|
||||
}
|
||||
|
||||
for(auto& [key, val] : partitions) {;
|
||||
if(val.needsRecompilingDependency) {
|
||||
for(auto& [key, val] : partitions) {
|
||||
if(val.needsRecompiling) {
|
||||
needsRecompiling = true;
|
||||
for(auto& [key, val] : partitions) {
|
||||
val.needsRecompiling = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue