mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Fix MacOS OpenCV library loading and use wpi buildTools versions (#978)
* Bump to beta 2 * Reduce copy paste spam going forwards * Bump gradle * oops * fix gradlew * update gradle wrapper props * remove unused imports * Update node task * Fix shadowjar * fix more deps * ? * core works * revert changes to index * Formatting fixes * Update config.gradle * Fix PhotonLib gradle * fix tests and sim loading native libraries * re-enable macos build * fix? * Update build.gradle --------- Co-authored-by: Matt <matthew.morley.ca@gmail.com>
This commit is contained in:
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -119,7 +119,7 @@ jobs:
|
||||
path: build/html
|
||||
build-photonlib-host:
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.14
|
||||
MACOSX_DEPLOYMENT_TARGET: 11
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -127,9 +127,9 @@ jobs:
|
||||
- os: windows-2022
|
||||
artifact-name: Win64
|
||||
architecture: x64
|
||||
# Mac builds are broken due to opencv class loading issues -- disable for now
|
||||
# - os: macos-11
|
||||
# artifact-name: macOS
|
||||
- os: macos-12
|
||||
artifact-name: macOS
|
||||
architecture: x64
|
||||
- os: ubuntu-22.04
|
||||
artifact-name: Linux
|
||||
|
||||
|
||||
12
build.gradle
12
build.gradle
@@ -1,17 +1,11 @@
|
||||
plugins {
|
||||
id "com.diffplug.spotless" version "6.22.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||
id "com.github.node-gradle.node" version "3.1.1" apply false
|
||||
id "edu.wpi.first.GradleJni" version "1.1.0"
|
||||
id "edu.wpi.first.GradleVsCode" version "1.3.0"
|
||||
id "edu.wpi.first.NativeUtils" version "2024.2.0" apply false
|
||||
id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2"
|
||||
id "org.hidetake.ssh" version "2.10.1"
|
||||
id 'edu.wpi.first.WpilibTools' version '1.1.0'
|
||||
id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-2"
|
||||
id 'edu.wpi.first.WpilibTools' version '1.3.0'
|
||||
}
|
||||
|
||||
import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency;
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -93,5 +87,5 @@ spotless {
|
||||
}
|
||||
|
||||
wrapper {
|
||||
gradleVersion '8.3'
|
||||
gradleVersion '8.4'
|
||||
}
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
8
gradle/wrapper/gradle-wrapper.properties
vendored
8
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services\.gradle\.org/distributions/gradle-8\.4-bin\.zip
|
||||
distributionPath=permwrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStorePath=permwrapper/dists
|
||||
|
||||
84
gradlew
vendored
84
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright <EFBFBD> 2015-2021 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,50 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
@@ -36,15 +80,12 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -90,22 +131,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -150,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
@@ -162,6 +214,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
||||
15
gradlew.bat
vendored
15
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'edu.wpi.first.WpilibTools' version '1.1.0'
|
||||
id 'edu.wpi.first.WpilibTools' version '1.3.0'
|
||||
}
|
||||
|
||||
import java.nio.file.Path
|
||||
@@ -36,24 +36,3 @@ task writeCurrentVersionJava {
|
||||
}
|
||||
|
||||
build.dependsOn writeCurrentVersionJava
|
||||
|
||||
def testNativeConfigName = 'wpilibTestNative'
|
||||
def testNativeConfig = configurations.create(testNativeConfigName)
|
||||
|
||||
def folder = project.layout.buildDirectory.dir('NativeTest')
|
||||
|
||||
def testNativeTasks = wpilibTools.createExtractionTasks {
|
||||
taskPostfix = "Test"
|
||||
configurationName = testNativeConfigName
|
||||
rootTaskFolder.set(folder)
|
||||
}
|
||||
|
||||
testNativeTasks.addToSourceSetResources(sourceSets.test)
|
||||
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.cscore()
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("hal")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath")
|
||||
|
||||
@@ -22,12 +22,12 @@ import edu.wpi.first.apriltag.jni.AprilTagJNI;
|
||||
import edu.wpi.first.cscore.CameraServerCvJNI;
|
||||
import edu.wpi.first.cscore.CameraServerJNI;
|
||||
import edu.wpi.first.hal.JNIWrapper;
|
||||
import edu.wpi.first.math.WPIMathJNI;
|
||||
import edu.wpi.first.math.geometry.Translation2d;
|
||||
import edu.wpi.first.math.util.Units;
|
||||
import edu.wpi.first.net.WPINetJNI;
|
||||
import edu.wpi.first.networktables.NetworkTablesJNI;
|
||||
import edu.wpi.first.util.CombinedRuntimeLoader;
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
@@ -40,29 +40,27 @@ import org.photonvision.vision.calibration.CameraCalibrationCoefficients;
|
||||
|
||||
public class TestUtils {
|
||||
public static boolean loadLibraries() {
|
||||
JNIWrapper.Helper.setExtractOnStaticLoad(false);
|
||||
WPIUtilJNI.Helper.setExtractOnStaticLoad(false);
|
||||
NetworkTablesJNI.Helper.setExtractOnStaticLoad(false);
|
||||
WPINetJNI.Helper.setExtractOnStaticLoad(false);
|
||||
WPIUtilJNI.Helper.setExtractOnStaticLoad(false);
|
||||
WPIMathJNI.Helper.setExtractOnStaticLoad(false);
|
||||
CameraServerJNI.Helper.setExtractOnStaticLoad(false);
|
||||
CameraServerCvJNI.Helper.setExtractOnStaticLoad(false);
|
||||
JNIWrapper.Helper.setExtractOnStaticLoad(false);
|
||||
WPINetJNI.Helper.setExtractOnStaticLoad(false);
|
||||
AprilTagJNI.Helper.setExtractOnStaticLoad(false);
|
||||
|
||||
try {
|
||||
var loader =
|
||||
new RuntimeLoader<>(
|
||||
Core.NATIVE_LIBRARY_NAME, RuntimeLoader.getDefaultExtractionRoot(), Core.class);
|
||||
loader.loadLibrary();
|
||||
|
||||
CombinedRuntimeLoader.loadLibraries(
|
||||
TestUtils.class,
|
||||
"wpiutiljni",
|
||||
"wpimathjni",
|
||||
"ntcorejni",
|
||||
"wpinetjni",
|
||||
"wpiHaljni",
|
||||
Core.NATIVE_LIBRARY_NAME,
|
||||
"cscorejni",
|
||||
"cscorejnicvstatic",
|
||||
"apriltagjni");
|
||||
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
plugins {
|
||||
id 'edu.wpi.first.WpilibTools' version '1.1.0'
|
||||
id "java"
|
||||
id 'cpp'
|
||||
id "google-test-test-suite"
|
||||
id 'edu.wpi.first.WpilibTools' version '1.3.0'
|
||||
}
|
||||
|
||||
import java.nio.file.Path
|
||||
|
||||
apply plugin: "cpp"
|
||||
apply plugin: "java"
|
||||
apply plugin: "google-test-test-suite"
|
||||
apply plugin: "edu.wpi.first.NativeUtils"
|
||||
|
||||
apply from: "${rootDir}/shared/config.gradle"
|
||||
@@ -16,20 +16,14 @@ test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
wpilibTools.deps.wpilibVersion = wpilibVersion
|
||||
wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
|
||||
println("Building for WPILib ${wpilibTools.deps.wpilibVersion}")
|
||||
|
||||
// From wpilib shared/config.gradle:
|
||||
// NativeUtils adds the following OpenCV warning suppression for Linux, but not
|
||||
// for macOS
|
||||
// https://github.com/opencv/opencv/issues/20269
|
||||
nativeUtils.platformConfigs.osxuniversal.cppCompiler.args.add("-Wno-deprecated-anon-enum-enum-conversion")
|
||||
nativeUtils.platformConfigs.linuxathena.cppCompiler.args.add("-Wno-deprecated-anon-enum-enum-conversion")
|
||||
// nativeUtils.platformConfigs.linuxx64.cppCompiler.args.add("-Wno-deprecated-anon-enum-enum-conversion")
|
||||
|
||||
// Apply Java configuration
|
||||
dependencies {
|
||||
implementation project(":photon-targeting")
|
||||
@@ -44,16 +38,15 @@ dependencies {
|
||||
implementation wpilibTools.deps.wpilibJava("ntcore")
|
||||
implementation wpilibTools.deps.wpilibJava("wpilibj")
|
||||
implementation wpilibTools.deps.wpilibJava("apriltag")
|
||||
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
||||
|
||||
// Jackson
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:2.12.4"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:2.12.4"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:2.12.4"
|
||||
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: wpi.versions.jacksonVersion.get()
|
||||
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: wpi.versions.jacksonVersion.get()
|
||||
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: wpi.versions.jacksonVersion.get()
|
||||
|
||||
implementation "edu.wpi.first.thirdparty.frc2024.opencv:opencv-java:$openCVversion"
|
||||
implementation "edu.wpi.first.thirdparty.frc2024.opencv:opencv-jni:$openCVversion:$jniPlatform"
|
||||
|
||||
implementation "org.ejml:ejml-simple:0.42"
|
||||
implementation group: "org.ejml", name: "ejml-simple", version: wpi.versions.ejmlVersion.get()
|
||||
implementation group: "us.hebi.quickbuf", name: "quickbuf-runtime", version: wpi.versions.quickbufVersion.get();
|
||||
|
||||
// Junit
|
||||
testImplementation wpilibTools.deps.wpilibJava("cscore")
|
||||
@@ -167,10 +160,10 @@ def testNativeTasks = wpilibTools.createExtractionTasks {
|
||||
|
||||
testNativeTasks.addToSourceSetResources(sourceSets.test)
|
||||
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.cscore()
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("hal")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath")
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.cscore()
|
||||
testNativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
||||
|
||||
@@ -32,7 +32,7 @@ import edu.wpi.first.math.MathUtil;
|
||||
import edu.wpi.first.math.Pair;
|
||||
import edu.wpi.first.math.geometry.Pose3d;
|
||||
import edu.wpi.first.math.geometry.Rotation2d;
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
import edu.wpi.first.util.CombinedRuntimeLoader;
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -89,10 +89,7 @@ public class PhotonCameraSim implements AutoCloseable {
|
||||
|
||||
static {
|
||||
try {
|
||||
var loader =
|
||||
new RuntimeLoader<>(
|
||||
Core.NATIVE_LIBRARY_NAME, RuntimeLoader.getDefaultExtractionRoot(), Core.class);
|
||||
loader.loadLibrary();
|
||||
CombinedRuntimeLoader.loadLibraries(OpenCVHelp.class, Core.NATIVE_LIBRARY_NAME, "cscorejni");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to load native libraries!", e);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import edu.wpi.first.cscore.CvSource;
|
||||
import edu.wpi.first.math.geometry.Pose3d;
|
||||
import edu.wpi.first.math.geometry.Translation3d;
|
||||
import edu.wpi.first.math.util.Units;
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
import edu.wpi.first.util.CombinedRuntimeLoader;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -68,10 +68,7 @@ public class VideoSimUtil {
|
||||
|
||||
static {
|
||||
try {
|
||||
var loader =
|
||||
new RuntimeLoader<>(
|
||||
Core.NATIVE_LIBRARY_NAME, RuntimeLoader.getDefaultExtractionRoot(), Core.class);
|
||||
loader.loadLibrary();
|
||||
CombinedRuntimeLoader.loadLibraries(OpenCVHelp.class, Core.NATIVE_LIBRARY_NAME, "cscorejni");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to load native libraries!", e);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ import edu.wpi.first.net.WPINetJNI;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.networktables.NetworkTablesJNI;
|
||||
import edu.wpi.first.util.CombinedRuntimeLoader;
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -101,13 +100,9 @@ public class OpenCVTest {
|
||||
"ntcorejni",
|
||||
"wpinetjni",
|
||||
"wpiHaljni",
|
||||
Core.NATIVE_LIBRARY_NAME,
|
||||
"cscorejni",
|
||||
"cscorejnicvstatic");
|
||||
|
||||
var loader =
|
||||
new RuntimeLoader<>(
|
||||
Core.NATIVE_LIBRARY_NAME, RuntimeLoader.getDefaultExtractionRoot(), Core.class);
|
||||
loader.loadLibrary();
|
||||
"apriltagjni");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ import edu.wpi.first.net.WPINetJNI;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.networktables.NetworkTablesJNI;
|
||||
import edu.wpi.first.util.CombinedRuntimeLoader;
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -101,13 +100,9 @@ class VisionSystemSimTest {
|
||||
"ntcorejni",
|
||||
"wpinetjni",
|
||||
"wpiHaljni",
|
||||
Core.NATIVE_LIBRARY_NAME,
|
||||
"cscorejni",
|
||||
"cscorejnicvstatic");
|
||||
|
||||
var loader =
|
||||
new RuntimeLoader<>(
|
||||
Core.NATIVE_LIBRARY_NAME, RuntimeLoader.getDefaultExtractionRoot(), Core.class);
|
||||
loader.loadLibrary();
|
||||
"apriltagjni");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
plugins {
|
||||
id 'edu.wpi.first.WpilibTools' version '1.1.0'
|
||||
id "application"
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
id "com.github.node-gradle.node" version "7.0.1"
|
||||
id "org.hidetake.ssh" version "2.11.2"
|
||||
id 'edu.wpi.first.WpilibTools' version '1.3.0'
|
||||
}
|
||||
|
||||
apply plugin: "application"
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
apply plugin: "org.hidetake.ssh"
|
||||
|
||||
evaluationDependsOn(':photon-core')
|
||||
|
||||
mainClassName = 'org.photonvision.Main'
|
||||
@@ -15,26 +15,12 @@ version versionString + (project.hasProperty('pionly') ? "-raspi" : "")
|
||||
|
||||
apply from: "${rootDir}/shared/common.gradle"
|
||||
|
||||
def nativeConfigName = 'wpilibTestNative'
|
||||
def nativeConfig = configurations.create(nativeConfigName)
|
||||
|
||||
def nativeTasks = wpilibTools.createExtractionTasks { configurationName = nativeConfigName }
|
||||
|
||||
nativeTasks.addToSourceSetResources(sourceSets.main)
|
||||
|
||||
nativeConfig.dependencies.add wpilibTools.deps.cscore()
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath")
|
||||
|
||||
dependencies {
|
||||
implementation project(':photon-core')
|
||||
implementation project(':photon-targeting')
|
||||
|
||||
implementation "io.javalin:javalin:$javalinVersion"
|
||||
implementation "org.slf4j:slf4j-simple:2.0.7"
|
||||
|
||||
implementation wpilibTools.deps.wpilibJava("wpiutil")
|
||||
implementation wpilibTools.deps.wpilibJava("wpimath")
|
||||
@@ -42,43 +28,35 @@ dependencies {
|
||||
implementation wpilibTools.deps.wpilibJava("hal")
|
||||
implementation wpilibTools.deps.wpilibJava("ntcore")
|
||||
implementation wpilibTools.deps.wpilibJava("wpilibj")
|
||||
implementation wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
||||
|
||||
implementation "org.msgpack:msgpack-core:0.9.0"
|
||||
implementation "org.msgpack:jackson-dataformat-msgpack:0.9.0"
|
||||
|
||||
implementation "org.slf4j:slf4j-simple:2.0.7"
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveBaseName = "photonvision"
|
||||
archiveVersion = project.version as String
|
||||
archiveClassifier.set(wpilibTools.currentPlatform.platformName)
|
||||
configurations = [
|
||||
project.configurations.runtimeClasspath
|
||||
]
|
||||
String name = "photonvision-${project.version}"
|
||||
archiveClassifier.set(wpilibTools.platformMapper.currentPlatform.platformName)
|
||||
archiveBaseName = "photonvision"
|
||||
archiveVersion = project.version
|
||||
// archiveFileName.set("${name}.jar")
|
||||
}
|
||||
|
||||
task runNpmOnClient(type: Exec) {
|
||||
workingDir "${projectDir}/../photon-client"
|
||||
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
|
||||
commandLine 'cmd', '/c', 'npm run build'
|
||||
} else {
|
||||
commandLine 'npm', 'run', 'build'
|
||||
}
|
||||
|
||||
node {
|
||||
nodeProjectDir = file("${projectDir}/../photon-client")
|
||||
}
|
||||
|
||||
task copyClientUIToResources(type: Copy) {
|
||||
tasks.register('copyClientUIToResources', Copy) {
|
||||
from "${projectDir}/../photon-client/dist/"
|
||||
into "${projectDir}/src/main/resources/web/"
|
||||
}
|
||||
|
||||
task buildAndCopyUI {}
|
||||
|
||||
buildAndCopyUI.dependsOn copyClientUIToResources
|
||||
copyClientUIToResources.dependsOn runNpmOnClient
|
||||
copyClientUIToResources.shouldRunAfter runNpmOnClient
|
||||
tasks.register("buildAndCopyUI") {
|
||||
dependsOn "npm_run_build"
|
||||
finalizedBy "copyClientUIToResources"
|
||||
}
|
||||
|
||||
run {
|
||||
if (project.hasProperty("profile")) {
|
||||
@@ -108,9 +86,6 @@ remotes {
|
||||
}
|
||||
}
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
task findDeployTarget {
|
||||
doLast {
|
||||
if(project.hasProperty('tgtIP')){
|
||||
@@ -148,18 +123,9 @@ run {
|
||||
environment "PATH_PREFIX", "../"
|
||||
}
|
||||
|
||||
// task overrideToPi {
|
||||
// doLast {
|
||||
// project.setProperty('ArchOverride', 'linuxarm32')
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
task deploy {
|
||||
//dependsOn overrideToPi
|
||||
dependsOn assemble
|
||||
dependsOn findDeployTarget
|
||||
dependsOn assemble
|
||||
|
||||
doLast {
|
||||
println 'Starting deployment to ' + findDeployTarget.rmt.host
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
apply plugin: "java"
|
||||
plugins {
|
||||
id "java"
|
||||
id 'edu.wpi.first.WpilibTools' version '1.3.0'
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/shared/common.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation wpilibTools.deps.wpilibJava("wpimath")
|
||||
implementation wpilibTools.deps.wpilibJava("apriltag")
|
||||
implementation "org.ejml:ejml-simple:0.42"
|
||||
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
||||
|
||||
implementation group: "org.ejml", name: "ejml-simple", version: wpi.versions.ejmlVersion.get()
|
||||
|
||||
// Junit
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
||||
|
||||
@@ -26,7 +26,7 @@ import edu.wpi.first.math.geometry.Rotation3d;
|
||||
import edu.wpi.first.math.geometry.Transform3d;
|
||||
import edu.wpi.first.math.geometry.Translation3d;
|
||||
import edu.wpi.first.math.numbers.*;
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
import edu.wpi.first.util.CombinedRuntimeLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -54,10 +54,7 @@ public final class OpenCVHelp {
|
||||
|
||||
static {
|
||||
try {
|
||||
var loader =
|
||||
new RuntimeLoader<>(
|
||||
Core.NATIVE_LIBRARY_NAME, RuntimeLoader.getDefaultExtractionRoot(), Core.class);
|
||||
loader.loadLibrary();
|
||||
CombinedRuntimeLoader.loadLibraries(OpenCVHelp.class, Core.NATIVE_LIBRARY_NAME, "cscorejni");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to load native libraries!", e);
|
||||
}
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
import java.nio.file.Path
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
// Plugins
|
||||
apply plugin: "jacoco"
|
||||
apply plugin: "java"
|
||||
apply plugin: "jacoco"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
wpilibTools.deps.wpilibVersion = wpilibVersion
|
||||
wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
|
||||
|
||||
def nativeConfigName = 'wpilibTestNative'
|
||||
def nativeConfig = configurations.create(nativeConfigName)
|
||||
|
||||
def nativeTasks = wpilibTools.createExtractionTasks {
|
||||
configurationName = nativeConfigName
|
||||
}
|
||||
|
||||
nativeTasks.addToSourceSetResources(sourceSets.main)
|
||||
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal")
|
||||
nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
||||
|
||||
dependencies {
|
||||
// Jackson
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:2.12.4"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:2.12.4"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:2.12.4"
|
||||
|
||||
// Apache commons
|
||||
implementation group: "org.apache.commons", name: "commons-lang3", version: "3.12.0"
|
||||
implementation group: "commons-io", name: "commons-io", version: "2.11.0"
|
||||
implementation group: "commons-cli", name: "commons-cli", version: "1.5.0"
|
||||
implementation "org.apache.commons:commons-collections4:4.4"
|
||||
implementation "org.apache.commons:commons-exec:1.3"
|
||||
|
||||
// WPILib deps
|
||||
implementation wpilibTools.deps.wpilibJava("wpiutil")
|
||||
implementation wpilibTools.deps.wpilibJava("cameraserver")
|
||||
@@ -35,13 +37,23 @@ dependencies {
|
||||
implementation wpilibTools.deps.wpilibJava("ntcore")
|
||||
implementation wpilibTools.deps.wpilibJava("hal")
|
||||
implementation wpilibTools.deps.wpilibJava("wpilibj")
|
||||
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
||||
|
||||
implementation "edu.wpi.first.thirdparty.frc2024.opencv:opencv-java:$openCVversion"
|
||||
implementation "edu.wpi.first.thirdparty.frc2024.opencv:opencv-jni:$openCVversion:$jniPlatform"
|
||||
// Jackson
|
||||
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: wpi.versions.jacksonVersion.get()
|
||||
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: wpi.versions.jacksonVersion.get()
|
||||
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: wpi.versions.jacksonVersion.get()
|
||||
|
||||
implementation "org.ejml:ejml-simple:0.42"
|
||||
// Apache commons
|
||||
implementation group: "org.apache.commons", name: "commons-lang3", version: "3.12.0"
|
||||
implementation group: "commons-io", name: "commons-io", version: "2.11.0"
|
||||
implementation group: "commons-cli", name: "commons-cli", version: "1.5.0"
|
||||
implementation "org.apache.commons:commons-collections4:4.4"
|
||||
implementation "org.apache.commons:commons-exec:1.3"
|
||||
|
||||
implementation group: "org.ejml", name: "ejml-simple", version: wpi.versions.ejmlVersion.get()
|
||||
implementation group: "us.hebi.quickbuf", name: "quickbuf-runtime", version: wpi.versions.quickbufVersion.get();
|
||||
|
||||
// test stuff
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
|
||||
|
||||
// wpilib serde
|
||||
@@ -57,7 +69,7 @@ test {
|
||||
finalizedBy jacocoTestReport
|
||||
}
|
||||
|
||||
task testHeadless(type: Test) {
|
||||
tasks.register('testHeadless', Test) {
|
||||
group = "verification"
|
||||
systemProperty("java.awt.headless", "true")
|
||||
useJUnitPlatform()
|
||||
@@ -65,13 +77,12 @@ task testHeadless(type: Test) {
|
||||
workingDir = "../"
|
||||
}
|
||||
|
||||
task generateJavaDocs(type: Javadoc) {
|
||||
tasks.register('generateJavaDocs', Javadoc) {
|
||||
source = sourceSets.main.allJava
|
||||
classpath = sourceSets.main.compileClasspath
|
||||
destinationDir = file("${projectDir}/build/docs")
|
||||
}
|
||||
|
||||
|
||||
jacoco {
|
||||
toolVersion = "0.8.9"
|
||||
reportsDirectory = layout.buildDirectory.dir('customJacocoReportDir')
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
apply plugin: "edu.wpi.first.NativeUtils"
|
||||
|
||||
// Configure Native-Utils WPI Plugin
|
||||
nativeUtils.addWpiNativeUtils()
|
||||
nativeUtils.withCrossRoboRIO()
|
||||
@@ -6,15 +8,12 @@ nativeUtils.withCrossLinuxArm64()
|
||||
|
||||
// Configure WPI dependencies.
|
||||
nativeUtils.wpi.configureDependencies {
|
||||
opencvYear = 'frc2024'
|
||||
googleTestYear = "frc2023"
|
||||
|
||||
wpiVersion = wpilibVersion
|
||||
wpimathVersion = wpilibVersion
|
||||
niLibVersion = "2024.1.1"
|
||||
opencvYear = 'frc2024'
|
||||
opencvVersion = openCVversion
|
||||
googleTestYear = "frc2023"
|
||||
niLibVersion = "2024.1.1"
|
||||
googleTestVersion = "1.12.1-2"
|
||||
imguiVersion = "1.86-1"
|
||||
}
|
||||
|
||||
// Configure warnings and errors
|
||||
|
||||
Reference in New Issue
Block a user