Skip to content

Commit a60a311

Browse files
committed
Merge remote-tracking branch 'origin/main' into martin4861/investigate-bazel8-x86_64-sysroots-linker-failures
2 parents 595c9f3 + 0237e4e commit a60a311

File tree

18 files changed

+340
-25
lines changed

18 files changed

+340
-25
lines changed

examples/small_world/.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ coverage --combined_report=lcov
1010
build:cov_mac --repo_env=GCOV=/Library/Developer/CommandLineTools/usr/bin/llvm-profdata
1111
build:cov_mac --test_env=LLVM_COV=/Library/Developer/CommandLineTools/usr/bin/llvm-cov
1212
build:cov_mac --copt=-ffile-compilation-dir=.
13+
14+
build:system-gcc --platforms=@rules_swiftnav//platforms:x86_64_linux_gcc11_system

examples/small_world/MODULE.bazel

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,37 @@ use_repo(
2020
)
2121

2222
register_toolchains(
23+
# llvm14
2324
"@rules_swiftnav//cc/toolchains/llvm/aarch64-darwin:cc-toolchain-aarch64-darwin",
25+
"@rules_swiftnav//cc/toolchains/llvm/x86_64-linux:cc-toolchain-x86_64-linux",
26+
# llvm20
2427
"@rules_swiftnav//cc/toolchains/llvm20/aarch64-darwin:cc-toolchain-aarch64-darwin",
2528
"@rules_swiftnav//cc/toolchains/llvm20/x86_64-darwin:cc-toolchain-x86_64-darwin",
2629
"@rules_swiftnav//cc/toolchains/llvm20/aarch64-linux:cc-toolchain-aarch64-linux",
2730
"@rules_swiftnav//cc/toolchains/llvm20/x86_64-linux:cc-toolchain-x86_64-linux",
31+
# system gcc
32+
"@rules_swiftnav//cc/toolchains/system_gcc/gcc11_x86_64-linux:system-cc-toolchain-x86_64-linux",
2833
)
2934

3035
bazel_dep(name = "googletest", version = "1.16.0", dev_dependency = True)
3136
bazel_dep(name = "lcov", version = "2.3.1", dev_dependency = True)
3237

38+
bazel_dep(name = "eigen", version = "5.0.0")
39+
3340
# Register the buildifier toolchain
3441
bazel_dep(
3542
name = "buildifier_prebuilt",
3643
version = "8.2.0.2",
3744
dev_dependency = True,
3845
)
46+
47+
# bazel run @hedron_compile_commands//:refresh_all
48+
# bazel run @hedron_compile_commands//:refresh_all -- --config=system-gcc
49+
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
50+
git_override(
51+
module_name = "hedron_compile_commands",
52+
commit = "4f28899228fb3ad0126897876f147ca15026151e",
53+
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
54+
# Replace the commit hash (above) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main).
55+
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
56+
)

examples/small_world/MODULE.bazel.lock

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
load("@rules_swiftnav//cc:defs.bzl", "UNIT", "swift_cc_library", "swift_cc_test")
22

33
swift_cc_library(
4-
name = "base_math",
5-
srcs = ["base_math.cc"],
6-
hdrs = ["base_math.hpp"],
4+
name = "add",
5+
srcs = ["add.cc"],
6+
hdrs = ["add.hpp"],
7+
standard = 20,
78
visibility = ["//visibility:public"],
89
)
910

1011
swift_cc_test(
11-
name = "base_math_test",
12-
srcs = ["base_math_test.cc"],
12+
name = "add_test",
13+
srcs = ["add_test.cc"],
1314
type = UNIT,
1415
deps = [
15-
":base_math",
16+
":add",
17+
"@googletest//:gtest_main",
18+
],
19+
)
20+
21+
swift_cc_library(
22+
name = "sign",
23+
srcs = ["sign.cc"],
24+
hdrs = ["sign.hpp"],
25+
standard = 20,
26+
visibility = ["//visibility:public"],
27+
)
28+
29+
swift_cc_test(
30+
name = "sign_test",
31+
srcs = ["sign_test.cc"],
32+
type = UNIT,
33+
deps = [
34+
":sign",
1635
"@googletest//:gtest_main",
1736
],
1837
)

examples/small_world/src/base_math/base_math.cc renamed to examples/small_world/src/base_math/add.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "base_math.hpp"
1+
#include "add.hpp"
22

33
int add(int x, int y) {
44
return x + y;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef ADD_HPP
2+
#define ADD_HPP
3+
4+
int add(int x, int y);
5+
6+
#endif
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
#include "base_math.hpp"
1+
#include "add.hpp"
22
#include "gtest/gtest.h"
33

44
TEST(BaseMathTest, Add) {
55
EXPECT_EQ(add(1, 2), 3);
66
EXPECT_EQ(add(-1, 1), 0);
77
EXPECT_EQ(add(-1, -1), -2);
88
}
9-
10-
TEST(BaseMathTest, SignPlus) {
11-
EXPECT_EQ(Math::sign(10), 1);
12-
//EXPECT_EQ(Math::sign(-10), -1);
13-
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "sign.hpp"
2+
3+
int add(int x, int y) {
4+
return x + y;
5+
}

examples/small_world/src/base_math/base_math.hpp renamed to examples/small_world/src/base_math/sign.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef BASE_MATH_HPP
2-
#define BASE_MATH_HPP
1+
#ifndef SIGN_HPP
2+
#define SIGN_HPP
33

44
int add(int x, int y);
55

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "sign.hpp"
2+
#include "gtest/gtest.h"
3+
4+
TEST(BaseMathTest, SignPlus) {
5+
EXPECT_EQ(Math::sign(10), 1);
6+
//EXPECT_EQ(Math::sign(-10), -1);
7+
}

0 commit comments

Comments
 (0)