Brian Silverman | e48dbc1 | 2017-02-04 20:06:29 -0800 | [diff] [blame^] | 1 | licenses(['notice']) |
| 2 | |
| 3 | genrule( |
| 4 | name = 'wpilib_version', |
| 5 | outs = ['shared/src/WPILibVersion.cpp'], |
| 6 | cmd = '\n'.join([ |
| 7 | "cat > \"$@\" << EOF", |
| 8 | "// Autogenerated file! Do not manually edit this file.", |
| 9 | "#include \"WPILibVersion.h\"", |
| 10 | "const char *WPILibVersion = \"2017-frc971\";", |
| 11 | "EOF", |
| 12 | ]), |
| 13 | ) |
| 14 | |
| 15 | _header_dirs = [ |
| 16 | 'wpilibc/shared/include', |
| 17 | 'wpilibc/athena/include', |
| 18 | 'hal/include', |
| 19 | 'hal/lib/athena', |
| 20 | ] |
| 21 | |
| 22 | # Names of WPILib "devices" I don't want to deal with making trivial updates to |
| 23 | # chop out various ugliness or have to vet for sanity. |
| 24 | _excluded_devices = [ |
| 25 | 'ADXL345_I2C', |
| 26 | 'GearTooth', |
| 27 | 'Ultrasonic', |
| 28 | 'Victor', |
| 29 | 'TalonSRX', |
| 30 | 'CANTalon', |
| 31 | 'CANJaguar', |
| 32 | 'PIDController', |
| 33 | 'Spark', |
| 34 | 'Servo', |
| 35 | 'VictorSP', |
| 36 | 'SD540', |
| 37 | 'RobotDrive', |
| 38 | 'Jaguar', |
| 39 | 'ADXL345_SPI', |
| 40 | 'DoubleSolenoid', |
| 41 | 'AnalogPotentiometer', |
| 42 | 'ADXL362', |
| 43 | 'AnalogGyro', |
| 44 | 'AnalogAccelerometer', |
| 45 | 'CameraServer', |
| 46 | 'ADXRS450_Gyro', |
| 47 | 'GyroBase', |
| 48 | 'IterativeRobot', |
| 49 | ] |
| 50 | |
| 51 | # Whole subdirectories of WPILib we don't want around. |
| 52 | _excluded_shared_directories = [ |
| 53 | 'SmartDashboard', |
| 54 | 'LiveWindow', |
| 55 | 'Commands', |
| 56 | 'Buttons', |
| 57 | 'Filters', |
| 58 | ] |
| 59 | |
| 60 | # Header files we don't want to have. |
| 61 | _bad_hdrs = ([ |
| 62 | 'wpilibc/athena/include/WPILib.h', |
| 63 | ] + ['wpilibc/shared/include/%s/**/*' % d |
| 64 | for d in _excluded_shared_directories] + |
| 65 | ['wpilibc/*/include/%s.h' % d for d in _excluded_devices]) |
| 66 | _h_hdrs = glob([d + '/**/*.h' for d in _header_dirs], exclude=_bad_hdrs) |
| 67 | _hpp_hdrs = glob([d + '/**/*.hpp' for d in _header_dirs], exclude=_bad_hdrs) |
| 68 | |
| 69 | cc_library( |
| 70 | name = 'wpilib', |
| 71 | visibility = ['//third_party:__pkg__'], |
| 72 | srcs = glob([ |
| 73 | 'wpilibc/athena/src/*.cpp', |
| 74 | 'wpilibc/athena/src/Internal/*.cpp', |
| 75 | 'wpilibc/shared/src/**/*.cpp', |
| 76 | |
| 77 | 'hal/lib/athena/*.cpp', |
| 78 | 'hal/lib/athena/cpp/*.cpp', |
| 79 | 'hal/lib/athena/ctre/*.cpp', |
| 80 | 'hal/lib/shared/handles/*.cpp', |
| 81 | ], exclude = ( |
| 82 | ['wpilibc/shared/src/%s/**/*' % d for d in _excluded_shared_directories] + |
| 83 | ['wpilibc/*/src/%s.cpp' % d for d in _excluded_devices] |
| 84 | )) + [ |
| 85 | ':wpilib_version', |
| 86 | ], |
| 87 | copts = [ |
| 88 | '-Wno-unused-parameter', |
| 89 | '-Wno-switch-enum', |
| 90 | '-Wno-attributes', |
| 91 | '-Wno-cast-align', |
| 92 | '-Wno-cast-qual', |
| 93 | '-Wno-deprecated-declarations', |
| 94 | '-Wno-error', |
| 95 | '-Wno-unused-const-variable', |
| 96 | ], |
| 97 | deps = [ |
| 98 | '//third_party/ntcore_2017:ntcore', |
| 99 | '//external:ni-libraries-2017', |
| 100 | '//aos/common/logging', |
| 101 | ], |
| 102 | hdrs = _h_hdrs + _hpp_hdrs + [ |
| 103 | 'wpilibc/shared/include/CircularBuffer.inc', |
| 104 | 'wpilibc/athena/include/Task.inc', |
| 105 | ], |
| 106 | includes = _header_dirs, |
| 107 | linkopts = [ |
| 108 | '-lpthread', |
| 109 | ], |
| 110 | defines = [ |
| 111 | 'WPILIB2017=1', |
| 112 | ], |
| 113 | ) |