Skip to content

Commit 8816b64

Browse files
committed
v2
1 parent da0ab81 commit 8816b64

File tree

14 files changed

+326
-278
lines changed

14 files changed

+326
-278
lines changed

.bazelrc

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,71 @@
22
# ld: warning: -undefined dynamic_lookup may not work with chained fixups
33
# temporary solution: https://github.com/bazelbuild/bazel/issues/16413
44
# build --linkopt=-Wl,-no_fixup_chains
5-
# build --platforms=//src:macos_arm64_platform
5+
build --platforms=//config/platforms:macos_arm64_platform
66

77
# Gcov config
88
# build:gcov --copt -fprofile-arcs
99
# build:gcov --copt -ftest-coverage
1010

11-
# test
11+
12+
###############################
13+
# test #
14+
###############################
15+
1216
test --test_verbose_timeout_warnings
1317
test --verbose_failures
1418
test --keep_going
1519
test --test_output=all
1620

17-
# coverage:
18-
coverage --instrument_test_targets
19-
coverage --instrumentation_filter="/tests[/test_:]"
20-
coverage --combined_report=lcov
21-
coverage --coverage_report_generator=@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main
22-
# coverage --incompatible_cc_coverage
23-
# coverage --experimental_cc_coverage
24-
# coverage --collect_code_coverage
25-
# coverage --nocache_test_results
26-
# coverage --experimental_split_coverage_postprocessing
27-
# coverage --experimental_fetch_all_coverage_outputs
28-
# coverage --remote_download_outputs=all
21+
###############################
22+
# sanitizer #
23+
###############################
24+
25+
build:asan --strip=never
26+
build:asan --copt -fsanitize=address
27+
build:asan --copt -DADDRESS_SANITIZER
28+
build:asan --copt -O1
29+
build:asan --copt -g
30+
build:asan --copt -fno-omit-frame-pointer
31+
build:asan --linkopt -fsanitize=address
32+
33+
# do not use in production code:
34+
build --config=asan
35+
36+
###############################
37+
# Profile #
38+
###############################
39+
40+
build --generate_json_trace_profile
41+
42+
###############################
43+
# macOS SDK Version #
44+
###############################
45+
46+
# build --macos_sdk_version=15.1
47+
48+
###############################
49+
# Output #
50+
###############################
51+
52+
# A more useful default output mode for bazel query, which
53+
# prints "ng_module rule //foo:bar" instead of just "//foo:bar".
54+
query --output=label_kind
55+
56+
###############################
57+
# Build Debug #
58+
###############################
59+
60+
# build --compilation_mode=dbg --spawn_strategy=local
61+
62+
###############################
63+
# Coverage #
64+
###############################
65+
66+
# # Use Clang as the compiler
67+
build --compiler=clang
68+
build --collect_code_coverage
69+
build --copt=-fprofile-instr-generate
70+
build --copt=-fcoverage-mapping
71+
build --linkopt=-fprofile-instr-generate
72+
build --linkopt=-fcoverage-mapping

BUILD

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
load("@phst_license_test//:def.bzl", "license_test")
2-
load("//tools/bazel/install:def.bzl", "installer")
3-
41
# identify missing license headers "bazel run //:license_test"
52
license_test(
63
name = "license_test",

MODULE.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ bazel_dep(name = "rules_cc", version = "0.1.1")
2121
bazel_dep(name = "bazel_skylib", version = "1.7.1")
2222
bazel_dep(name = "cgrindel_bazel_starlib", version = "0.25.0")
2323
bazel_dep(name = "rules_shell", version = "0.4.0")
24-
bazel_dep(name = "google_benchmark", version = "1.9.2")
2524

2625
bazel_dep(name = "depend_on_what_you_use", version = "0.8.0")
2726

MODULE.bazel.lock

Lines changed: 81 additions & 260 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/platforms/BUILD

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
platform(
2+
name = "linux_x86_64_platform",
3+
constraint_values = [
4+
"@platforms//os:linux",
5+
"@platforms//cpu:x86_64",
6+
],
7+
visibility = ["//visibility:public"],
8+
)
9+
10+
platform(
11+
name = "macos_arm64_platform",
12+
constraint_values = [
13+
"@platforms//os:macos",
14+
"@platforms//cpu:arm64",
15+
],
16+
visibility = ["//visibility:public"],
17+
)
18+
19+
platform(
20+
name = "windows_x86_64_platform",
21+
constraint_values = [
22+
"@platforms//os:windows",
23+
"@platforms//cpu:x86_64",
24+
],
25+
visibility = ["//visibility:public"],
26+
)
27+
28+
constraint_setting(name = "gpu_type")
29+
30+
constraint_value(
31+
name = "cuda",
32+
constraint_setting = ":gpu_type",
33+
)
34+
35+
platform(
36+
name = "cuda_linux_x86_64_platform",
37+
constraint_values = [
38+
"@platforms//os:linux",
39+
"@platforms//cpu:x86_64",
40+
":cuda",
41+
],
42+
visibility = ["//visibility:public"],
43+
)

config/toolchain/BUILD

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
load(":build_defs.bzl", "gcc_toolchain_config")
2+
load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
3+
4+
package(default_visibility = ["//visibility:public"])
5+
6+
config_setting(
7+
name = "linux_x86_64",
8+
values = {
9+
"cpu": "linux_x86_64",
10+
},
11+
)
12+
13+
config_setting(
14+
name = "linux_x86_64_gcc_5.4.0",
15+
values = {
16+
"cpu": "linux_x86_64",
17+
"compiler": "gcc-5.4.0",
18+
},
19+
)
20+
21+
config_setting(
22+
name = "linux_x86_64_gcc_4.9.4",
23+
values = {
24+
"cpu": "linux_x86_64",
25+
"compiler": "gcc-4.9.4",
26+
},
27+
)
28+
29+
config_setting(
30+
name = "linux_arm_32v7",
31+
values = {"cpu": "linux_arm_32v7"},
32+
)
33+
34+
config_setting(
35+
name = "linux_arm_64v8",
36+
values = {"cpu": "linux_arm_64v8"},
37+
)
38+
39+
config_setting(
40+
name = "macos_x86_64",
41+
values = {"cpu": "darwin_x86_64"},
42+
)
43+
44+
config_setting(
45+
name = "windows_x86_64",
46+
values = {"cpu": "x64_windows"},
47+
)
48+
49+
filegroup(
50+
name = "empty",
51+
srcs = [],
52+
)
53+
54+
cc_toolchain(
55+
name = "cc-linux_x86_64-gcc_5.4.0",
56+
all_files = "//crosstool_ng/linux_x86_64-gcc_5.4.0:all_files",
57+
compiler_files = "//crosstool_ng/linux_x86_64-gcc_5.4.0:compiler_files",
58+
dwp_files = ":empty",
59+
linker_files = "//crosstool_ng/linux_x86_64-gcc_5.4.0:linker_files",
60+
objcopy_files = "//crosstool_ng/linux_x86_64-gcc_5.4.0:objcopy",
61+
strip_files = "//crosstool_ng/linux_x86_64-gcc_5.4.0:strip",
62+
supports_param_files = 1,
63+
toolchain_config = ":cc_linux_x86_64-gcc_5.4.0",
64+
toolchain_identifier = "gcc-linux_x86_64",
65+
)
66+
67+
cc_toolchain(
68+
name = "cc-linux_x86_64-gcc_4.9.4",
69+
all_files = "//crosstool_ng/linux_x86_64-gcc_4.9.4:all_files",
70+
compiler_files = "//crosstool_ng/linux_x86_64-gcc_4.9.4:compiler_files",
71+
dwp_files = ":empty",
72+
linker_files = "//crosstool_ng/linux_x86_64-gcc_4.9.4:linker_files",
73+
objcopy_files = "//crosstool_ng/linux_x86_64-gcc_4.9.4:objcopy",
74+
strip_files = "//crosstool_ng/linux_x86_64-gcc_4.9.4:strip",
75+
supports_param_files = 1,
76+
toolchain_config = ":cc_linux_x86_64-gcc_4.9.4",
77+
toolchain_identifier = "gcc-linux_x86_64-gcc_4.9.4",
78+
)
79+
80+
gcc_toolchain_config(
81+
name = "cc_linux_x86_64-gcc_4.9.4",
82+
libc_version = "glibc_2.19",
83+
target = "linux_x86_64",
84+
version = "4.9.4",
85+
)
86+
87+
gcc_toolchain_config(
88+
name = "cc_linux_x86_64-gcc_5.4.0",
89+
libc_version = "glibc_2.23",
90+
target = "linux_x86_64",
91+
version = "5.4.0",
92+
)

config/toolchain/linux/BUILD

Whitespace-only changes.

config/toolchain/linux/gcc_toolchain.bzl

Whitespace-only changes.

config/toolchain/macos/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
load(":brew_clang_toolchain.bzl", "define_brew_clang_toolchain")
2+
3+
define_brew_clang_toolchain()
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "cc_toolchain_config")
2+
3+
def define_brew_clang_toolchain():
4+
cc_toolchain_config(
5+
name = "brew_clang_toolchain",
6+
toolchain_identifier = "brew-clang",
7+
host_system_name = "local",
8+
target_system_name = "macos",
9+
target_cpu = "darwin_arm64",
10+
target_libc = "unknown",
11+
compiler = "clang",
12+
abi_version = "local",
13+
abi_libc_version = "local",
14+
builtin_sysroot = None,
15+
tool_paths = [
16+
("gcc", "/opt/homebrew/opt/llvm/bin/clang"),
17+
("g++", "/opt/homebrew/opt/llvm/bin/clang++"),
18+
("ld", "/opt/homebrew/opt/llvm/bin/ld.lld"),
19+
("cpp", "/opt/homebrew/opt/llvm/bin/clang -E"),
20+
("ar", "/opt/homebrew/opt/llvm/bin/llvm-ar"),
21+
("strip", "/opt/homebrew/opt/llvm/bin/llvm-strip"),
22+
("nm", "/opt/homebrew/opt/llvm/bin/llvm-nm"),
23+
("objdump", "/opt/homebrew/opt/llvm/bin/llvm-objdump"),
24+
("objcopy", "/opt/homebrew/opt/llvm/bin/llvm-objcopy"),
25+
("dwp", "/opt/homebrew/opt/llvm/bin/llvm-dwp"),
26+
],
27+
cxx_builtin_include_directories = [
28+
"/opt/homebrew/opt/llvm/include/c++/v1",
29+
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include",
30+
],
31+
compile_flags = ["-Wall", "-Wextra", "-no-canonical-prefixes"],
32+
cxx_flags = ["-std=c++17"],
33+
link_flags = ["-lc++", "-fuse-ld=lld"],
34+
dbg_mode_compile_flags = ["-g"],
35+
opt_mode_compile_flags = ["-O3"],
36+
coverage_compile_flags = ["--coverage"],
37+
coverage_link_flags = ["--coverage"],
38+
)

0 commit comments

Comments
 (0)