Brian Silverman | 82a12b9 | 2019-01-19 21:52:10 -0800 | [diff] [blame] | 1 | licenses(["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 | |
| 32 | py_binary( |
| 33 | name = "generate_FRCUsageReporting", |
| 34 | srcs = [ |
| 35 | "generate_FRCUsageReporting.py", |
| 36 | ], |
| 37 | ) |
| 38 | |
| 39 | genrule( |
| 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 | |
| 61 | cc_library( |
| 62 | name = "hal", |
| 63 | srcs = glob( |
| 64 | include = [ |
| 65 | "hal/src/main/native/athena/*.cpp", |
Austin Schuh | f6b9463 | 2019-02-02 22:11:27 -0800 | [diff] [blame] | 66 | "hal/src/main/native/cpp/cpp/*.cpp", |
James Kuszmaul | 3ae4226 | 2019-11-08 12:33:41 -0800 | [diff] [blame^] | 67 | "hal/src/main/native/cpp/*.cpp", |
Brian Silverman | 82a12b9 | 2019-01-19 21:52:10 -0800 | [diff] [blame] | 68 | "hal/src/main/native/athena/ctre/*.cpp", |
| 69 | "hal/src/main/native/shared/handles/*.cpp", |
Austin Schuh | f6b9463 | 2019-02-02 22:11:27 -0800 | [diff] [blame] | 70 | "hal/src/main/native/cpp/handles/*.cpp", |
Brian Silverman | 82a12b9 | 2019-01-19 21:52:10 -0800 | [diff] [blame] | 71 | ], |
| 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 | ) |