Skip to content

Commit

Permalink
compiler: add the --compiler-path option
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Feb 26, 2024
1 parent 3575249 commit 247ab84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/julec/compile.jule
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,13 @@ fn check_compiler_flag() {
| "":
throw("missing option value: --compiler")
| "clang":
env::COMPILER_PATH = "clang++"
if env::COMPILER_PATH == "" {
env::COMPILER_PATH = "clang++"
}
| "gcc":
env::COMPILER_PATH = "g++"
if env::COMPILER_PATH == "" {
env::COMPILER_PATH = "g++"
}
|:
throw("invalid option value for --compiler: " + env::COMPILER)
}
Expand Down Expand Up @@ -311,6 +315,7 @@ fn check_flags(&args: []str): []str {
fs.add_var[bool](unsafe { (&bool)(&env::SHADOWING) }, "shadowing", 0, "Allow shadowing")
fs.add_var[bool](unsafe { (&bool)(&env::TRANSPILATION) }, "transpile", 't', "Transpile code")
fs.add_var[str](unsafe { (&str)(&env::COMPILER) }, "compiler", 0, "Backend compiler")
fs.add_var[str](unsafe { (&str)(&env::COMPILER_PATH) }, "compiler-path", 0, "Path of backend compiler")
fs.add_var[bool](unsafe { (&bool)(&env::PRODUCTION) }, "production", 'p', "Compile for production")
fs.add_var[bool](unsafe { (&bool)(&env::RC) }, "disable-rc", 0, "Disable reference counting")
fs.add_var[bool](unsafe { (&bool)(&env::SAFETY) }, "disable-safety", 0, "Disable safety")
Expand Down
2 changes: 1 addition & 1 deletion src/julec/init.jule
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ use env
// These codes should be executed on all platforms.
fn __init_common() {
// Configure compiler to default by platform
// Compiler path will be set by compiler before compilation if still unassigned.
env::COMPILER = "clang"
env::COMPILER_PATH = "clang++"
}

0 comments on commit 247ab84

Please sign in to comment.