Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native configurations for native artifacts #939

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/PlatformMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ fun javaCppClassifier(platform: NativePlatforms) = when (platform) {
LINUX -> "linux-x86_64"
}

/**
* Generates a classifier string for a platform-specific JavaCPP native library with CUDA
* acceleration.
*/
fun javaCppCudaClassifier(platform: NativePlatforms) = "${javaCppClassifier(platform)}-gpu"

/**
* Generates a classifier string for a platform-specific JavaFX artifact.
*/
Expand Down
13 changes: 6 additions & 7 deletions core/core.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@ application {
mainClassName = "edu.wpi.grip.core.Main"
}

val os = osdetector.classifier.replace("osx", "macosx").replace("x86_32", "x86")
val arch = osdetector.arch.replace("x86_64", "x64")

val withCuda = project.hasProperty("cuda") || project.hasProperty("WITH_CUDA")

if (withCuda) {
version = "$version-cuda"
}

createNativeConfigurations()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this method from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this added as part of a plugin?


dependencies {
api(project(":annotation"))
annotationProcessor(project(":annotation"))
api(group = "com.google.code.findbugs", name = "jsr305", version = "3.0.1")
api(group = "org.bytedeco", name = "javacv", version = "1.3")
api(group = "org.bytedeco.javacpp-presets", name = "opencv", version = "3.4.3-1.4.3")
api(group = "org.bytedeco.javacpp-presets", name = "opencv", version = "3.4.3-1.4.3", classifier = if (withCuda) "$os-gpu" else os)
api(group = "org.bytedeco.javacpp-presets", name = "videoinput", version = "0.200-1.1", classifier = os)
api(group = "org.bytedeco.javacpp-presets", name = "ffmpeg", version = "0.200-1.3", classifier = os)
native(group = "org.bytedeco.javacpp-presets", name = "opencv", version = "3.4.3-1.4.3", classifierFunction = ::javaCppCudaClassifier)
native(group = "org.bytedeco.javacpp-presets", name = "videoinput", version = "0.200-1.1", classifierFunction = ::javaCppClassifier)
native(group = "org.bytedeco.javacpp-presets", name = "ffmpeg", version = "0.200-1.3", classifierFunction = ::javaCppClassifier)
api(group = "org.python", name = "jython", version = "2.7.0")
api(group = "com.thoughtworks.xstream", name = "xstream", version = "1.4.10")
api(group = "org.apache.commons", name = "commons-lang3", version = "3.5")
Expand All @@ -55,7 +54,7 @@ dependencies {
api(group = "org.ros.rosjava_messages", name = "std_msgs", version = "+")
api(group = "org.ros.rosjava_messages", name = "grip_msgs", version = "0.0.1")
api(group = "edu.wpi.first.ntcore", name = "ntcore-java", version = "2019.2.1")
implementation(group = "edu.wpi.first.ntcore", name = "ntcore-jni", version = "2019.2.1", classifier = "all")
native(group = "edu.wpi.first.ntcore", name = "ntcore-jni", version = "2019.2.1", classifierFunction = ::wpilibClassifier)
implementation(group = "edu.wpi.first.wpiutil", name = "wpiutil-java", version = "2019.2.1")
}

Expand Down