John Park | 7eb9042 | 2018-01-27 12:04:57 -0800 | [diff] [blame] | 1 | import org.gradle.language.base.internal.ProjectLayout |
| 2 | |
| 3 | repositories { |
| 4 | mavenCentral() |
| 5 | } |
| 6 | |
| 7 | apply plugin: 'cpp' |
| 8 | apply plugin: 'java' |
| 9 | apply plugin: 'visual-studio' |
| 10 | apply plugin: 'edu.wpi.first.NativeUtils' |
| 11 | |
| 12 | apply from: '../config.gradle' |
| 13 | |
| 14 | dependencies { |
| 15 | compile project(':wpilibj') |
| 16 | compile 'edu.wpi.first.wpiutil:wpiutil-java:+' |
| 17 | compile 'edu.wpi.first.ntcore:ntcore-java:+' |
| 18 | } |
| 19 | |
| 20 | model { |
| 21 | dependencyConfigs { |
| 22 | wpiutil(DependencyConfig) { |
| 23 | groupId = 'edu.wpi.first.wpiutil' |
| 24 | artifactId = 'wpiutil-cpp' |
| 25 | headerClassifier = 'headers' |
| 26 | ext = 'zip' |
| 27 | version = '+' |
| 28 | sharedConfigs = [ FRCUserProgram: [] ] |
| 29 | } |
| 30 | ntcore(DependencyConfig) { |
| 31 | groupId = 'edu.wpi.first.ntcore' |
| 32 | artifactId = 'ntcore-cpp' |
| 33 | headerClassifier = 'headers' |
| 34 | ext = 'zip' |
| 35 | version = '+' |
| 36 | sharedConfigs = [ FRCUserProgram: [] ] |
| 37 | } |
| 38 | cscore(DependencyConfig) { |
| 39 | groupId = 'edu.wpi.first.cscore' |
| 40 | artifactId = 'cscore-cpp' |
| 41 | headerClassifier = 'headers' |
| 42 | ext = 'zip' |
| 43 | version = '+' |
| 44 | sharedConfigs = [ FRCUserProgram: [] ] |
| 45 | } |
| 46 | opencv(DependencyConfig) { |
| 47 | groupId = 'org.opencv' |
| 48 | artifactId = 'opencv-cpp' |
| 49 | headerClassifier = 'headers' |
| 50 | ext = 'zip' |
| 51 | version = '3.2.0' |
| 52 | sharedConfigs = [ FRCUserProgram: [] ] |
| 53 | } |
| 54 | } |
| 55 | components { |
| 56 | FRCUserProgram(NativeExecutableSpec) { |
| 57 | sources { |
| 58 | cpp { |
| 59 | source { |
| 60 | srcDirs = ['src/main/native/cpp'] |
| 61 | } |
| 62 | exportedHeaders { |
| 63 | srcDirs = ['src/main/native/headers'] |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | binaries.all { binary-> |
| 68 | project(':ni-libraries').addNiLibrariesToLinker(binary) |
| 69 | project(':hal').addHalToLinker(binary) |
| 70 | project(':wpilibc').addWpilibCCompilerArguments(binary) |
| 71 | project(':wpilibc').addWpilibCToLinker(binary) |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | tasks { |
| 76 | runCpp(Exec) { |
| 77 | def found = false |
| 78 | $.components.each { |
| 79 | if (it in NativeExecutableSpec && it.name == 'FRCUserProgram') { |
| 80 | it.binaries.each { |
| 81 | if (!found) { |
| 82 | def arch = it.targetPlatform.architecture.name |
| 83 | if (arch == 'x86-64' || arch == 'x86') { |
| 84 | dependsOn it.tasks.install |
| 85 | commandLine it.tasks.install.runScript |
| 86 | found = true |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | installAthena(Task) { |
| 94 | $.binaries.each { |
| 95 | if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena') { |
| 96 | dependsOn it.tasks.install |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | } |