| plugins { |
| id 'java' |
| id 'application' |
| id 'cpp' |
| id 'visual-studio' |
| } |
| |
| apply plugin: 'edu.wpi.first.NativeUtils' |
| |
| apply from: '../shared/config.gradle' |
| |
| ext { |
| sharedCvConfigs = [myRobotCpp: []] |
| staticCvConfigs = [myRobotCppStatic: []] |
| useJava = true |
| useCpp = true |
| skipDev = true |
| } |
| |
| ext { |
| chipObjectComponents = ['myRobotCpp', 'myRobotCppStatic'] |
| netCommComponents = ['myRobotCpp', 'myRobotCppStatic'] |
| useNiJava = true |
| } |
| |
| apply from: "${rootDir}/shared/nilibraries.gradle" |
| |
| apply from: "${rootDir}/shared/opencv.gradle" |
| |
| mainClassName = 'Main' |
| |
| apply plugin: 'com.github.johnrengelman.shadow' |
| |
| repositories { |
| mavenCentral() |
| } |
| |
| dependencies { |
| compile project(':wpilibj') |
| compile project(':hal') |
| compile project(':wpiutil') |
| compile project(':ntcore') |
| compile project(':cscore') |
| compile project(':cameraserver') |
| } |
| |
| jar { |
| manifest { attributes 'Robot-Class': 'MyRobot' } |
| } |
| |
| model { |
| components { |
| myRobotCpp(NativeExecutableSpec) { |
| targetBuildTypes 'debug' |
| baseName = 'FRCUserProgram' |
| sources { |
| cpp { |
| source { |
| srcDirs = ['src/main/native/cpp'] |
| includes = ['**/*.cpp'] |
| } |
| exportedHeaders { |
| srcDirs = ['src/main/native/include'] |
| includes = ['**/*.h'] |
| } |
| } |
| } |
| binaries.all { binary -> |
| lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' |
| lib project: ':ntcore', library: 'ntcore', linkage: 'shared' |
| lib project: ':cscore', library: 'cscore', linkage: 'shared' |
| project(':hal').addHalDependency(binary, 'shared') |
| lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' |
| lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' |
| } |
| } |
| myRobotCppStatic(NativeExecutableSpec) { |
| targetBuildTypes 'debug' |
| baseName = 'FRCUserProgram' |
| sources { |
| cpp { |
| source { |
| srcDirs = ['src/main/native/cpp'] |
| includes = ['**/*.cpp'] |
| } |
| exportedHeaders { |
| srcDirs = ['src/main/native/include'] |
| includes = ['**/*.h'] |
| } |
| } |
| } |
| binaries.all { binary -> |
| lib project: ':wpilibc', library: 'wpilibc', linkage: 'static' |
| lib project: ':ntcore', library: 'ntcore', linkage: 'static' |
| lib project: ':cscore', library: 'cscore', linkage: 'static' |
| project(':hal').addHalDependency(binary, 'static') |
| lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' |
| lib project: ':cameraserver', library: 'cameraserver', linkage: 'static' |
| } |
| } |
| } |
| tasks { |
| def c = $.components |
| project.tasks.create('runCpp', Exec) { |
| group = 'WPILib' |
| description = "Run the myRobotCpp executable" |
| def found = false |
| def systemArch = getCurrentArch() |
| c.each { |
| if (it in NativeExecutableSpec && it.name == "myRobotCpp") { |
| it.binaries.each { |
| if (!found) { |
| def arch = it.targetPlatform.architecture.name |
| if (arch == systemArch) { |
| dependsOn it.tasks.install |
| commandLine it.tasks.install.runScriptFile.get().asFile.toString() |
| def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib' |
| run.dependsOn it.tasks.install |
| run.systemProperty 'java.library.path', filePath |
| run.environment 'LD_LIBRARY_PATH', filePath |
| run.workingDir filePath |
| |
| found = true |
| } |
| } |
| } |
| } |
| } |
| } |
| installAthena(Task) { |
| $.binaries.each { |
| if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena' && it.component.name == 'myRobotCpp') { |
| dependsOn it.tasks.install |
| } |
| } |
| } |
| installAthenaStatic(Task) { |
| $.binaries.each { |
| if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena' && it.component.name == 'myRobotCppStatic') { |
| dependsOn it.tasks.install |
| } |
| } |
| } |
| } |
| } |