Files
PhotonVision/photonlib-cpp-examples/build.gradle
Prateek Machiraju 951c038f19 Clean up buildscripts (#238)
Cleans up gradle buildscripts.
2021-01-18 19:12:57 -08:00

65 lines
2.1 KiB
Groovy

apply plugin: "cpp"
apply plugin: "java"
apply plugin: "google-test-test-suite"
apply plugin: "edu.wpi.first.GradleVsCode"
apply plugin: "edu.wpi.first.NativeUtils"
apply from: "${rootDir}/shared/config.gradle"
ext.examplesMap = [:]
File examplesTree = file("$projectDir/src/main/cpp/examples")
examplesTree.list(new FilenameFilter() {
@Override
public boolean accept(File current, String name) {
return new File(current, name).isDirectory();
}
}).each {
examplesMap.put(it, [])
}
nativeUtils.platformConfigs.named(nativeUtils.wpi.platforms.roborio).configure {
cppCompiler.args.remove('-Wno-error=deprecated-declarations')
cppCompiler.args.add('-Werror=deprecated-declarations')
}
ext {
sharedCvConfigs = examplesMap
staticCvConfigs = [:]
useJava = false
useCpp = true
}
model {
components {
examplesMap.each { key, value ->
"${key}"(NativeExecutableSpec) {
targetBuildTypes 'debug'
binaries.all { binary ->
lib project: ':photon-lib', library: 'Photon', linkage: 'shared'
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared')
}
}
sources {
cpp {
source {
srcDirs 'src/main/cpp/examples/' + "${key}" + "/cpp"
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/main/cpp/examples/' + "${key}" + "/include"
include '**/*.h'
}
}
}
nativeUtils.useRequiredLibrary(it, 'wpilib_executable_shared')
}
}
}
}
ext {
exampleDirectory = new File("$projectDir/src/main/java/edu/wpi/first/wpilibj/examples/")
exampleFile = new File("$projectDir/src/main/java/edu/wpi/first/wpilibj/examples/examples.json")
}