Skip to content

Commit

Permalink
fix: Force clang to compile in c++
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelwan committed May 10, 2024
1 parent 133a845 commit b9ff92b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ecsact/cli/commands/build/cc_compiler_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ auto ecsact::cli::get_compiler_type_by_path( //
if(compiler_filename == "clang") {
return ecsact::cli::cc_compiler_type::clang;
}

if(compiler_filename == "clang++") {
return ecsact::cli::cc_compiler_type::clang;
}

if(compiler_filename == "gcc") {
return ecsact::cli::cc_compiler_type::gcc;
}
Expand Down
3 changes: 3 additions & 0 deletions ecsact/cli/commands/build/recipe/cook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ auto clang_gcc_compile(compile_options options) -> int {
auto compile_proc_args = std::vector<std::string>{};

compile_proc_args.push_back("-c");
compile_proc_args.push_back("-x");
compile_proc_args.push_back("c++");

#if !defined(_WIN32)
compile_proc_args.push_back("-fPIC");
#endif
Expand Down
4 changes: 2 additions & 2 deletions test/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions test/build_recipe/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@bazel_skylib//rules:native_binary.bzl", "native_test")
load("@ecsact_cli//bazel:copts.bzl", "copts")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_ecsact//ecsact:defs.bzl", "ecsact_binary", "ecsact_build_recipe")
load("@rules_cc//cc:defs.bzl", "cc_test")

cc_test(
name = "test_build_recipe",
Expand All @@ -10,8 +8,8 @@ cc_test(
data = [
"ecsact_build_test.cc",
"ecsact_build_test_merge.cc",
"test-recipe.yml",
"test-merge-recipe.yml",
"test-recipe.yml",
"//:test.ecsact",
"//:test_codegen_plugin",
"@ecsact_cli",
Expand All @@ -21,7 +19,6 @@ cc_test(
"@llvm_toolchain_llvm//:bin/clang",
],
}),
tags = ["no-sandbox"],
env = select({
"@platforms//os:windows": {
"TEST_ECSACT_CLI": "$(rootpath @ecsact_cli)",
Expand Down Expand Up @@ -57,6 +54,7 @@ cc_test(
],
"//conditions:default": [],
}),
tags = ["no-sandbox"],
deps = [
"@ecsact_cli//ecsact/cli/commands:build",
"@googletest//:gtest",
Expand All @@ -71,8 +69,8 @@ cc_test(
data = [
"ecsact_build_test.cc",
"ecsact_build_test_merge.cc",
"test-recipe.yml",
"test-merge-recipe.yml",
"test-recipe.yml",
"//:test.ecsact",
"//:test_codegen_plugin",
"@ecsact_cli",
Expand All @@ -82,7 +80,6 @@ cc_test(
"@llvm_toolchain_llvm//:bin/clang",
],
}),
tags = ["no-sandbox"],
env = select({
"@platforms//os:windows": {
"TEST_ECSACT_CLI": "$(rootpath @ecsact_cli)",
Expand Down Expand Up @@ -118,6 +115,7 @@ cc_test(
],
"//conditions:default": [],
}),
tags = ["no-sandbox"],
deps = [
"@ecsact_cli//ecsact/cli/commands:build",
"@ecsact_cli//ecsact/cli/commands:recipe-bundle",
Expand Down

0 comments on commit b9ff92b

Please sign in to comment.