From 5603d1f1c7db3f9b5b0a88e8eeabfdf55437aee5 Mon Sep 17 00:00:00 2001 From: Thad House Date: Fri, 14 Dec 2018 16:17:29 -0800 Subject: [PATCH] Use debug libraries for opencv and ni libraries (#253) * Use debug libraries for opencv and ni libraries opencv is becoming a requirement in beta 4, and ni libraries were a good idea. All debug things should be linked to debug * Fix rio cpp debug, and bad C++ link --- ToolchainPlugin/build.gradle | 4 +- build.gradle | 2 +- .../gradlerio/frc/FRCNativeArtifact.groovy | 2 +- .../wpi/dependencies/WPINativeDepRules.groovy | 62 +++++++++++-------- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/ToolchainPlugin/build.gradle b/ToolchainPlugin/build.gradle index 127f1608..4a05cd3b 100644 --- a/ToolchainPlugin/build.gradle +++ b/ToolchainPlugin/build.gradle @@ -16,7 +16,7 @@ repositories { dependencies { // For some utility classes. We don't actually apply EmbeddedTools to the FRCToolchain, // but we do in GradleRIO - compile 'jaci.gradle:EmbeddedTools:2018.12.06a' + compile 'jaci.gradle:EmbeddedTools:2018.12.14' compile 'de.undercouch:gradle-download-task:3.1.2' } @@ -42,4 +42,4 @@ gradlePlugin { implementationClass = 'edu.wpi.first.toolchain.ToolchainPlugin' } } -} \ No newline at end of file +} diff --git a/build.gradle b/build.gradle index 14ee72c0..a22ab7c9 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ archivesBaseName = "GradleRIO" allprojects { group = "edu.wpi.first" - version = "2019.1.1-beta-3b" + version = "2019.1.1-beta-4-pre2" if (project.hasProperty('publishVersion')) { version = project.publishVersion diff --git a/src/main/groovy/edu/wpi/first/gradlerio/frc/FRCNativeArtifact.groovy b/src/main/groovy/edu/wpi/first/gradlerio/frc/FRCNativeArtifact.groovy index f3dc3837..1c9eb32b 100644 --- a/src/main/groovy/edu/wpi/first/gradlerio/frc/FRCNativeArtifact.groovy +++ b/src/main/groovy/edu/wpi/first/gradlerio/frc/FRCNativeArtifact.groovy @@ -131,7 +131,7 @@ class FRCNativeArtifact extends NativeArtifact { def target = ip.host + ":" + debugPort // def toolchainD = project.plugins.getPlugin(WPIToolchainPlugin.class).discoverRoborioToolchain() - def toolchainD = project.extensions.getByType(ToolchainExtension).getByName('roborio').discover() + def toolchainD = project.extensions.getByType(ToolchainExtension).getByName('roboRio').discover() def gdbpath = toolchainD.gdbFile().get().absolutePath def sysroot = toolchainD.sysroot().orElse(null).absolutePath diff --git a/src/main/groovy/edu/wpi/first/gradlerio/wpi/dependencies/WPINativeDepRules.groovy b/src/main/groovy/edu/wpi/first/gradlerio/wpi/dependencies/WPINativeDepRules.groovy index ab4daeb6..5d6b3ad2 100644 --- a/src/main/groovy/edu/wpi/first/gradlerio/wpi/dependencies/WPINativeDepRules.groovy +++ b/src/main/groovy/edu/wpi/first/gradlerio/wpi/dependencies/WPINativeDepRules.groovy @@ -186,45 +186,51 @@ class WPINativeDepRules extends RuleSource { } as Action) } - // NI Libraries - libs.create('ni_chipobject_binaries', NativeLib, { NativeLib lib -> - common(lib) - lib.targetPlatforms << wpi.platforms.roborio - lib.buildTypes = ['debug', 'release'] - lib.sharedMatchers = ['**/*.so*'] - lib.dynamicMatchers = [] // NI Libs are not deployed to RRIO - lib.maven = "edu.wpi.first.ni-libraries:chipobject:${wpi.niLibrariesVersion}:${wpi.platforms.roborio}@zip" - lib.configuration = 'native_ni' - } as Action) - libs.create('ni_chipobject_headers', NativeLib, { NativeLib lib -> common(lib) lib.targetPlatforms << wpi.platforms.roborio - lib.buildTypes = ['debug', 'release'] lib.headerDirs << '' lib.maven = "edu.wpi.first.ni-libraries:chipobject:${wpi.niLibrariesVersion}:headers@zip" lib.configuration = 'native_ni' } as Action) - libs.create('ni_netcomm_binaries', NativeLib, { NativeLib lib -> - common(lib) - lib.targetPlatforms << wpi.platforms.roborio - lib.buildTypes = ['debug', 'release'] - lib.sharedMatchers = ['**/*.so*'] - lib.dynamicMatchers = [] // NI Libs are not deployed to RRIO - lib.maven = "edu.wpi.first.ni-libraries:netcomm:${wpi.niLibrariesVersion}:${wpi.platforms.roborio}@zip" - lib.configuration = 'native_ni' - } as Action) - libs.create('ni_netcomm_headers', NativeLib, { NativeLib lib -> common(lib) lib.targetPlatforms << wpi.platforms.roborio - lib.buildTypes = ['debug', 'release'] lib.headerDirs << '' lib.maven = "edu.wpi.first.ni-libraries:netcomm:${wpi.niLibrariesVersion}:headers@zip" lib.configuration = 'native_ni' } as Action) + ['debug', ''].each { String buildKind -> + String buildType = buildKind.contains('debug') ? 'debug' : 'release' + String config = "native_ni${buildKind}".toString() + + // NI Libraries + libs.create("ni_chipobject_binaries${buildKind}", NativeLib, { NativeLib lib -> + common(lib) + lib.targetPlatforms << wpi.platforms.roborio + lib.buildType = buildType + lib.libraryName = "ni_chipobject_binaries" + lib.sharedMatchers = ['**/*.so*'] + lib.dynamicMatchers = [] // NI Libs are not deployed to RRIO + lib.maven = "edu.wpi.first.ni-libraries:chipobject:${wpi.niLibrariesVersion}:${wpi.platforms.roborio}${buildKind}@zip" + lib.configuration = config + } as Action) + + libs.create("ni_netcomm_binaries${buildKind}", NativeLib, { NativeLib lib -> + common(lib) + lib.targetPlatforms << wpi.platforms.roborio + lib.buildType = buildType + lib.libraryName = "ni_netcomm_binaries" + lib.sharedMatchers = ['**/*.so*'] + lib.dynamicMatchers = [] // NI Libs are not deployed to RRIO + lib.maven = "edu.wpi.first.ni-libraries:netcomm:${wpi.niLibrariesVersion}:${wpi.platforms.roborio}${buildKind}@zip" + lib.configuration = config + } as Action) + + } + // Non-static combined libs libs.create('ni_libraries', CombinedNativeLib, { CombinedNativeLib lib -> lib.libs << 'ni_chipobject_binaries' << 'ni_chipobject_headers' << 'ni_netcomm_binaries' << 'ni_netcomm_headers' @@ -278,15 +284,16 @@ class WPINativeDepRules extends RuleSource { common(lib) if (isShared) { lib.sharedMatchers = ['**/shared/libopencv*.so.*'] + lib.sharedExcludes = ['**/shared/libopencv*.so.*.debug', '**/shared/*java*'] lib.dynamicMatchers = lib.sharedMatchers + lib.dynamicExcludes = lib.sharedExcludes } else { matchersStatic(lib, 'opencv', false) } lib.targetPlatforms << NativePlatforms.roborio lib.libraryName = "opencv${suf}_binaries" lib.buildType = buildType - // TODO: This was meant to be debug but the matcher keeps grabbing .so.debug. - lib.maven = "${mavenRoot}:${NativePlatforms.roborio}${linkSuff}@zip" + lib.maven = "${mavenRoot}:${NativePlatforms.roborio}${linkSuff}${buildKind}@zip" lib.configuration = config } as Action) @@ -294,7 +301,9 @@ class WPINativeDepRules extends RuleSource { common(lib) if (isShared) { lib.sharedMatchers = ['**/shared/*opencv*.so.*', '**/shared/*opencv*.*.dylib', '**/shared/*opencv*.lib'] + lib.sharedExcludes = ['**/shared/libopencv*.so.*.debug', '**/shared/*java*'] lib.dynamicMatchers = lib.sharedMatchers + '**/shared/*opencv*.dll' + lib.dynamicExcludes = lib.sharedExcludes } else { matchersStatic(lib, 'opencv', true) } @@ -309,6 +318,9 @@ class WPINativeDepRules extends RuleSource { common(lib) if (isShared) { lib.sharedMatchers = ['**/shared/*opencv*.so.*'] + lib.sharedExcludes = ['**/shared/libopencv*.so.*.debug', '**/shared/*java*'] + lib.dynamicMatchers = lib.sharedMatchers + lib.dynamicExcludes = lib.sharedExcludes } else { matchersStatic(lib, 'opencv', false) }