blob: cfae703e4831940d3ba2f89132409d6e4a93ee12 [file] [log] [blame]
Brian Silverman82a12b92019-01-19 21:52:10 -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 ],
37)
38
39genrule(
40 name = "do_generate_FRCUsageReporting",
41 srcs = [
42 "hal/src/generate/FRCUsageReporting.h.in",
43 "hal/src/generate/Instances.txt",
44 "hal/src/generate/ResourceType.txt",
45 ],
46 outs = [
47 "hal/src/main/native/include/hal/FRCUsageReporting.h",
48 ],
49 cmd = " ".join([
50 "$(location :generate_FRCUsageReporting)",
51 "$(location hal/src/generate/FRCUsageReporting.h.in)",
52 "$(location hal/src/generate/Instances.txt)",
53 "$(location hal/src/generate/ResourceType.txt)",
54 "$(location hal/src/main/native/include/hal/FRCUsageReporting.h)",
55 ]),
56 tools = [
57 ":generate_FRCUsageReporting",
58 ],
59)
60
61cc_library(
62 name = "hal",
63 srcs = glob(
64 include = [
65 "hal/src/main/native/athena/*.cpp",
Austin Schuhf6b94632019-02-02 22:11:27 -080066 "hal/src/main/native/cpp/cpp/*.cpp",
James Kuszmaul3ae42262019-11-08 12:33:41 -080067 "hal/src/main/native/cpp/*.cpp",
Brian Silverman82a12b92019-01-19 21:52:10 -080068 "hal/src/main/native/athena/ctre/*.cpp",
69 "hal/src/main/native/shared/handles/*.cpp",
Austin Schuhf6b94632019-02-02 22:11:27 -080070 "hal/src/main/native/cpp/handles/*.cpp",
Brian Silverman82a12b92019-01-19 21:52:10 -080071 ],
72 exclude = ["**/%s.*" % d for d in _excluded_devices],
73 ),
74 hdrs = _hal_h_hdrs + _hal_hpp_hdrs + [
75 "hal/src/main/native/include/hal/FRCUsageReporting.h",
76 ],
77 copts = [
78 "-Wno-unused-parameter",
79 "-Wno-cast-align",
80 ],
81 defines = ["WPILIB2019=1"],
82 includes = _hal_header_dirs,
83 linkopts = ["-lpthread"],
84 restricted_to = ["//tools:roborio"],
85 visibility = ["//third_party:__pkg__"],
86 deps = [
87 "//aos/logging",
88 "//third_party/allwpilib_2019/wpiutil",
89 "@allwpilib_ni_libraries_2019//:ni-libraries",
90 ],
91)