apply plugin: 'cpp' apply plugin: 'google-test-test-suite' apply plugin: 'visual-studio' apply plugin: 'edu.wpi.first.NativeUtils' apply plugin: SingleNativeBuild apply plugin: ExtraTasks ext { nativeName = 'lowfi_sim' } apply from: "${rootDir}/shared/config.gradle" if (!project.hasProperty('onlylinuxathena')) { ext.skiplinuxathena = true ext { sharedCvConfigs = [lowfi_simTest: []] staticCvConfigs = [:] useJava = false useCpp = true } apply from: "${rootDir}/shared/opencv.gradle" ext { staticGtestConfigs = [:] } staticGtestConfigs["${nativeName}Test"] = [] apply from: "${rootDir}/shared/googletest.gradle" project(':').libraryBuild.dependsOn build nativeUtils.exportsConfigs { lowfi_sim { x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure', '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure', '_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range', '_TI3?AVout_of_range', '_CT??_R0?AVbad_cast'] x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure', '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure', '_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range', '_TI3?AVout_of_range', '_CT??_R0?AVbad_cast'] } } model { components { "${nativeName}Base"(NativeLibrarySpec) { sources { cpp { source { srcDirs = ['src/main/native/cpp'] include '**/*.cpp' } exportedHeaders { srcDirs 'src/main/native/include' } } } binaries.all { if (it instanceof SharedLibraryBinarySpec) { it.buildable = false return } if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { it.buildable = false return } project(':hal').addHalDependency(it, 'shared') lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' } } "${nativeName}"(NativeLibrarySpec) { sources { cpp { source { srcDirs "${rootDir}/shared/singlelib" include '**/*.cpp' } exportedHeaders { srcDirs 'src/main/native/include' } } } binaries.all { if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { it.buildable = false return } project(':hal').addHalDependency(it, 'shared') lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' } } // By default, a development executable will be generated. This is to help the case of // testing specific functionality of the library. "${nativeName}Dev"(NativeExecutableSpec) { targetBuildTypes 'debug' sources { cpp { source { srcDirs 'src/dev/native/cpp' include '**/*.cpp' lib library: "${nativeName}" } exportedHeaders { srcDirs 'src/dev/native/include' } } } binaries.all { if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { it.buildable = false return } project(':hal').addHalDependency(it, 'shared') lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib library: nativeName, linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') } } } } binaries { withType(GoogleTestTestSuiteBinarySpec) { lib project: ':ntcore', library: 'ntcore', linkage: 'shared' lib project: ':cscore', library: 'cscore', linkage: 'shared' project(':hal').addHalDependency(it, 'shared') lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' lib library: nativeName, linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') } } } } apply from: "publish.gradle" } model { testSuites { if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) { "${nativeName}Test"(GoogleTestTestSuiteSpec) { for(NativeComponentSpec c : $.components) { if (c.name == nativeName) { testing c break } } sources { cpp { source { srcDirs 'src/test/native/cpp' include '**/*.cpp' } exportedHeaders { srcDirs 'src/test/native/include', 'src/main/native/cpp' } } } } } } tasks { def c = $.components project.tasks.create('runCpp', Exec) { def found = false c.each { if (it in NativeExecutableSpec && it.name == "${nativeName}Dev") { it.binaries.each { if (!found) { def arch = it.targetPlatform.architecture.name if (arch == 'x86-64' || arch == 'x86') { dependsOn it.tasks.install commandLine it.tasks.install.runScriptFile.get().asFile.toString() found = true } } } } } } } } tasks.withType(RunTestExecutable) { args "--gtest_output=xml:test_detail.xml" outputs.dir outputDir }