Skip to content

Commit

Permalink
Add: 'cpp-compiler' runtime flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatgec committed Feb 17, 2021
1 parent d3f2d42 commit 7dbd803
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions example.kalem
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
!flag("cpp-standard=c++2a")
!flag("cpp-output=false")

// default=clang
!flag("cpp-compiler=default")

// Its type is not boolean.
!flag("cpp-flags=false")

Expand Down
1 change: 1 addition & 0 deletions include/Kalem_Codegen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef struct {
std::string kl_cpp_standard = "c++17";
std::string kl_cpp_flags = "-lstdc++fs";
std::string kl_cpp_include_dirs = "";
std::string kl_cpp_compiler = "clang++";

std::vector<std::string> kl_source_files;

Expand Down
3 changes: 2 additions & 1 deletion src/Kalem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ int main(int argc, char** argv) {
}

// TODO: Create !flag("stdflag=...")
_exec.RunFunction("clang++ "
_exec.RunFunction(__codegen_.kl_cpp_compiler
+ " "
+ __codegen_.kl_cpp_include_dirs
+ " -std="
+ __codegen_.kl_cpp_standard
Expand Down
5 changes: 5 additions & 0 deletions src/Kalem_Codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ Kalem_Codegen::Kl_Codegen(KALEM_TOKEN _token, std::string _variable, std::string
_codegen.kl_cpp_flags = append_flag;
}
}
else if(flag == "cpp-compiler") {
if(append_flag != "default") {
_codegen.kl_cpp_compiler = append_flag;
}
}

break;
}
Expand Down

0 comments on commit 7dbd803

Please sign in to comment.