blob: e35687d149a0b5fff95780f1a14c3199d3e5c6bc [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",
Brian Silverman82a12b92019-01-19 21:52:10 -080067 "hal/src/main/native/athena/ctre/*.cpp",
68 "hal/src/main/native/shared/handles/*.cpp",
Austin Schuhf6b94632019-02-02 22:11:27 -080069 "hal/src/main/native/cpp/handles/*.cpp",
Brian Silverman82a12b92019-01-19 21:52:10 -080070 ],
71 exclude = ["**/%s.*" % d for d in _excluded_devices],
72 ),
73 hdrs = _hal_h_hdrs + _hal_hpp_hdrs + [
74 "hal/src/main/native/include/hal/FRCUsageReporting.h",
75 ],
76 copts = [
77 "-Wno-unused-parameter",
78 "-Wno-cast-align",
79 ],
80 defines = ["WPILIB2019=1"],
81 includes = _hal_header_dirs,
82 linkopts = ["-lpthread"],
83 restricted_to = ["//tools:roborio"],
84 visibility = ["//third_party:__pkg__"],
85 deps = [
86 "//aos/logging",
87 "//third_party/allwpilib_2019/wpiutil",
88 "@allwpilib_ni_libraries_2019//:ni-libraries",
89 ],
90)