Skip to content
Merged
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: 3 additions & 3 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
name: "wpiformat"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Fetch all history and metadata
run: |
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- uses: actions/setup-python@v4
- uses: actions/setup-python@v6
with:
python-version: 3.11
python-version: 3.14
- name: Install wpiformat
run: pip3 install wpiformat==2025.79
- name: Run
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
name: "mrcal-jni - Build - ${{ matrix.arch-name }}"

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
submodules: 'true'
fetch-depth: 0
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- run: find

# Push to dev release on pushes to master
- uses: pyTooling/Actions/releaser@r0
- uses: pyTooling/Actions/releaser@r6
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: 'Dev'
Expand Down
16 changes: 0 additions & 16 deletions .wpiformat
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
cppHeaderFileInclude {
\.h$
\.hpp$
\.inc$
\.inl$
}

cppSrcFileInclude {
\.cpp$
}

modifiableFileExclude {
\.jpg$
\.jpeg$
\.png$
\.gif$
\.so$
\.dll$
\.webp$
\.ico$
gradlew
mrcal/
libdogleg/
vnlog/
Expand Down
38 changes: 9 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.24)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(mrcal_jni LANGUAGES C CXX VERSION 1.0.0)

Expand Down Expand Up @@ -62,6 +62,13 @@ set(USE_LOCKING ON)
set(USE_THREAD OFF)
set(NOFORTRAN ON)

# ARMv8 is what our coprocessors run, but not the CI machines. Ensure we don't accidentally include ARMv9 instructions
if(
CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64"
AND CMAKE_SYSTEM_NAME STREQUAL "Linux"
)
set(TARGET ARMV8)
endif()
# We need PIC for this to work as a shared library
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand All @@ -83,28 +90,6 @@ if(NOT APPLE)
elseif(TARGET OpenBLAS)
set(OPENBLAS_TARGET OpenBLAS)
message(STATUS "Using OpenBLAS target")
elseif(TARGET libopenblas)
set(OPENBLAS_TARGET libopenblas)
message(STATUS "Using libopenblas target")
else()
# Fallback: find the library file manually
find_library(
OPENBLAS_LIB
NAMES openblas libopenblas
PATHS
${openblas_external_BINARY_DIR}
${openblas_external_BINARY_DIR}/lib
${openblas_external_BINARY_DIR}/lib/Release
NO_DEFAULT_PATH
REQUIRED
)
message(STATUS "Using OpenBLAS library file: ${OPENBLAS_LIB}")
add_library(openblas_imported STATIC IMPORTED)
set_target_properties(
openblas_imported
PROPERTIES IMPORTED_LOCATION ${OPENBLAS_LIB}
)
set(OPENBLAS_TARGET openblas_imported)
endif()
else()
set(BLA_VENDOR Apple)
Expand Down Expand Up @@ -142,12 +127,7 @@ else()
endif()

# And pull in JNI
find_package(JNI)
if(JNI_FOUND)
# Fixes odd AWT dependency
set(JNI_INCLUDE_DIRS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
message(STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
endif()
find_package(JNI REQUIRED COMPONENTS JVM)

# headers and sources
set(INCLUDE_HPP)
Expand Down
13 changes: 5 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "java"
id 'edu.wpi.first.WpilibTools' version '1.3.0'
id 'org.photonvision.tools.WpilibTools' version '2.3.1-photon'
id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2"
id "com.diffplug.spotless" version "6.22.0"
id "com.diffplug.spotless" version "8.1.0"
}

allprojects {
Expand All @@ -24,8 +24,8 @@ ext {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

dependencies {
Expand Down Expand Up @@ -57,10 +57,7 @@ test {
useJUnitPlatform()
}

ext.nativeName = wpilibTools.platformMapper.wpilibClassifier
.replace('windows', 'windows/')
.replace('osx', 'osx/')
.replace('linux', 'linux/')
def nativeName = wpilibTools.platformMapper.platformPath
ext.outputsFolder = file("$buildDir/outputs")

println("Building for $nativeName")
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=permwrapper/dists
zipStorePath=wrapper/dists
12 changes: 7 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# 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
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# 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_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -112,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -203,15 +205,15 @@ fi
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,
# * DEFAULT_JVM_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" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
26 changes: 14 additions & 12 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
4 changes: 2 additions & 2 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ publishing {
mavenJava(MavenPublication) {
groupId = artifactGroupId
artifactId = "${baseArtifactId}-java"
version = pubVersion;// + "-" + nativeName;
version = pubVersion;

from components.java
}
mavenJNI(MavenPublication) {
groupId = artifactGroupId
artifactId = "${baseArtifactId}-jni"
version = pubVersion;// + "-" + nativeName;
version = pubVersion;

artifact nativeLibraryJar
}
Expand Down
11 changes: 11 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pluginManagement {
repositories {
maven { url = "https://frcmaven.wpi.edu/artifactory/ex-mvn/" }
mavenCentral()
gradlePluginPortal()
maven {
url = uri('https://maven.photonvision.org/releases')
}
mavenLocal()
}
}