blob: 6c70541549eb92a6d24844a61806635268ac7b1c [file] [log] [blame]
Brian Silverman7011c452020-01-05 13:18:21 -08001licenses(["notice"])
2
3# Names of WPILib "devices" I don't want to deal with making trivial updates to
4# chop out various ugliness or have to vet for sanity.
5_excluded_devices = [
6 "AnalogGyro",
7 "SerialPort",
8 "SerialHelper",
9 "visa",
10]
11
12# Header files we don't want to have.
13_bad_hdrs = ([
14 "hal/include/HAL/LabVIEW/HAL.h",
15] + ["**/%s.*" % d for d in _excluded_devices])
16
17_hal_header_dirs = [
18 "hal/src/main/native/athena",
19 "hal/src/main/native/include",
20]
21
22_hal_h_hdrs = glob(
23 [d + "/**/*.h" for d in _hal_header_dirs],
24 exclude = _bad_hdrs,
25)
26
27_hal_hpp_hdrs = glob(
28 [d + "/**/*.hpp" for d in _hal_header_dirs],
29 exclude = _bad_hdrs,
30)
31
32py_binary(
33 name = "generate_FRCUsageReporting",
34 srcs = [
35 "generate_FRCUsageReporting.py",
36 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080037 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman7011c452020-01-05 13:18:21 -080038)
39
40genrule(
41 name = "do_generate_FRCUsageReporting",
42 srcs = [
43 "hal/src/generate/FRCUsageReporting.h.in",
44 "hal/src/generate/Instances.txt",
45 "hal/src/generate/ResourceType.txt",
46 ],
47 outs = [
48 "hal/src/main/native/include/hal/FRCUsageReporting.h",
49 ],
50 cmd = " ".join([
51 "$(location :generate_FRCUsageReporting)",
52 "$(location hal/src/generate/FRCUsageReporting.h.in)",
53 "$(location hal/src/generate/Instances.txt)",
54 "$(location hal/src/generate/ResourceType.txt)",
55 "$(location hal/src/main/native/include/hal/FRCUsageReporting.h)",
56 ]),
Philipp Schraderdada1072020-11-24 11:34:46 -080057 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman7011c452020-01-05 13:18:21 -080058 tools = [
59 ":generate_FRCUsageReporting",
60 ],
61)
62
63cc_library(
64 name = "hal",
65 srcs = glob(
66 include = [
67 "hal/src/main/native/athena/*.cpp",
Austin Schuh9950f682021-11-06 15:27:58 -070068 "hal/src/main/native/athena/rev/*.cpp",
Brian Silverman7011c452020-01-05 13:18:21 -080069 "hal/src/main/native/cpp/cpp/*.cpp",
70 "hal/src/main/native/cpp/*.cpp",
71 "hal/src/main/native/athena/ctre/*.cpp",
72 "hal/src/main/native/shared/handles/*.cpp",
73 "hal/src/main/native/cpp/handles/*.cpp",
74 ],
75 exclude = ["**/%s.*" % d for d in _excluded_devices],
76 ),
77 hdrs = _hal_h_hdrs + _hal_hpp_hdrs + [
78 "hal/src/main/native/include/hal/FRCUsageReporting.h",
79 ],
80 copts = [
81 "-Wno-unused-parameter",
82 "-Wno-cast-align",
83 ],
Brian Silverman7011c452020-01-05 13:18:21 -080084 includes = _hal_header_dirs,
Philipp Schraderdada1072020-11-24 11:34:46 -080085 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Brian Silverman7011c452020-01-05 13:18:21 -080086 visibility = ["//third_party:__pkg__"],
87 deps = [
88 "//aos/logging",
89 "//third_party/allwpilib/wpiutil",
90 "@allwpilib_ni_libraries//:ni-libraries",
91 ],
92)