- Lookup the value of `dgen:compiler` from the config and use that as the C compiler

Configuration

- Set default value of `dgen:compiler` to `"clang"`

Commands

- Added a command to specify the C compile to use
- Transfer `-cccompiler`/`-cc` over to a config entry
This commit is contained in:
Tristan B. Velloza Kildaire 2023-08-20 15:26:54 +02:00
parent ef0c817217
commit 12daee5c44
3 changed files with 12 additions and 1 deletions

View File

@ -66,6 +66,10 @@ mixin template EmitBase()
@ArgNamed("prettygen|pg", "Generate pretty-printed code")
@(ArgConfig.optional)
bool prettyPrintCodeGen = true;
@ArgNamed("ccompiler|cc", "The system C compiler to use for DGne (C emitter)")
@(ArgConfig.optional)
string systemCC = "clang";
@ArgNamed("output|o", "Filename of generated object file")
@(ArgConfig.optional)
@ -99,6 +103,9 @@ mixin template EmitBase()
// Set whether or not to enable pre-inlining of function call arguments in DGen
compiler.getConfig().addConfig(ConfigEntry("dgen:preinline_args", preinlineArguments));
// Set the C compiler to use for DGen
compiler.getConfig().addConfig(ConfigEntry("dgen:compiler", systemCC));
// Set the paths to the object files to link in
compiler.getConfig().addConfig(ConfigEntry("linker:link_files", bruh));
}

View File

@ -1286,7 +1286,8 @@ int main()
try
{
//NOTE: Change to system compiler (maybe, we need to choose a good C compiler)
string[] compileArgs = ["clang", "-o", "tlang.out", file.name()];
string systemCompiler = config.getConfig("dgen:compiler").getText();
string[] compileArgs = [systemCompiler, "-o", "tlang.out", file.name()];
// Check for object files to be linked in
string[] objectFilesLink;

View File

@ -212,6 +212,9 @@ public final class CompilerConfiguration
/* Set the mapping to hashing of entity names for DGen (TODO: This should be changed before release) */
config.addConfig(ConfigEntry("dgen:mapper", "hashmapper"));
/* Set the system C compiler for DGen to clang */
config.addConfig(ConfigEntry("dgen:compiler", "clang"));
/**
* Configure, at compile time, the system type aliases
*/