diff --git a/src/julec/compile.jule b/src/julec/compile.jule index d10cbfa12..0b4301856 100644 --- a/src/julec/compile.jule +++ b/src/julec/compile.jule @@ -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) } @@ -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") diff --git a/src/julec/init.jule b/src/julec/init.jule index 2081dcfb0..6c61c9a96 100644 --- a/src/julec/init.jule +++ b/src/julec/init.jule @@ -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++" }