-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBUILD
More file actions
78 lines (70 loc) · 2.31 KB
/
BUILD
File metadata and controls
78 lines (70 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@rules_cc//cc:defs.bzl", "cc_library")
CODSPEED_VERSION = "1.2.0"
config_setting(
name = "windows",
constraint_values = ["@platforms//os:windows"],
)
# Instrument-hooks library with warning suppressions
cc_library(
name = "instrument_hooks",
srcs = ["instrument-hooks/dist/core.c"],
hdrs = glob(["instrument-hooks/includes/*.h"]),
includes = ["instrument-hooks/includes"],
copts = select({
":windows": [
"/wd4101", # unreferenced local variable (equivalent to -Wno-unused-variable)
"/wd4189", # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable)
"/wd4100", # unreferenced formal parameter (equivalent to -Wno-unused-parameter)
"/wd4245", # signed/unsigned mismatch
"/wd4132", # const object should be initialized
"/wd4146", # unary minus operator applied to unsigned type
],
"//conditions:default": [
"-Wno-maybe-uninitialized",
"-Wno-unused-variable",
"-Wno-unused-parameter",
"-Wno-unused-but-set-variable",
"-Wno-type-limits",
],
}),
visibility = ["//visibility:public"],
)
# Define the codspeed library
cc_library(
name = "codspeed",
srcs = glob(["src/**/*.cpp"] + ["src/**/*.h"]),
hdrs = glob(["include/**/*.h"] + ["include/**/*.hpp"]),
includes = ["include"],
copts = select({
":windows": ["/std:c++17"],
"//conditions:default": [],
}),
defines = [
"CODSPEED_VERSION=\\\"{}\\\"".format(CODSPEED_VERSION),
] + select({
":instrumentation_mode": ["CODSPEED_ENABLED", "CODSPEED_INSTRUMENTATION"],
":walltime_mode": ["CODSPEED_ENABLED", "CODSPEED_WALLTIME"],
"//conditions:default": [],
}),
deps = [":instrument_hooks"],
visibility = ["//visibility:public"],
)
# Codspeed mode
string_flag(
name = "codspeed_mode",
build_setting_default = "off",
values = [
"off",
"instrumentation",
"walltime",
],
)
config_setting(
name = "instrumentation_mode",
flag_values = {":codspeed_mode": "instrumentation"},
)
config_setting(
name = "walltime_mode",
flag_values = {":codspeed_mode": "walltime"},
)