Skip to content

Commit fb284ff

Browse files
authored
Unify matrix and swap to wpilib compatible layout
1 parent 21cab6d commit fb284ff

File tree

2 files changed

+14
-65
lines changed

2 files changed

+14
-65
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ on:
1010

1111
env:
1212
BUILD_TYPE: Release
13-
# Keep in sync with
14-
# https://github.com/PhotonVision/photonvision/blob/main/.github/workflows/build.yml
15-
IMAGE_VERSION: v2026.0.3
1613

1714
jobs:
1815
build-host:
@@ -24,12 +21,15 @@ jobs:
2421
arch-name: linuxx86-64
2522
- os: ubuntu-22.04-arm
2623
arch-name: linuxarm64
24+
- os: windows-latest
25+
arch-name: windowsx86-64
26+
extra-flags: -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl
2727

2828
runs-on: ${{ matrix.os }}
2929
name: "mrcal-jni - Build - ${{ matrix.arch-name }}"
3030

3131
steps:
32-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v5
3333
with:
3434
submodules: 'true'
3535
fetch-depth: 0
@@ -39,67 +39,21 @@ jobs:
3939
- run: git describe --tags
4040

4141
- name: Install Java 17
42-
uses: actions/setup-java@v3
42+
uses: actions/setup-java@v5
4343
with:
4444
java-version: 17
4545
distribution: temurin
4646

4747
- name: Install deps
48+
if: runner.os == "Linux"
4849
run: |
4950
sudo apt update
50-
sudo apt-get install -y cmake gcc g++ liblist-moreutils-perl
51+
sudo apt-get install -y cmake ninja-build gcc g++ liblist-moreutils-perl
5152
5253
- name: Configure CMake
5354
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
5455
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
55-
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=${{ matrix.arch-name }}
56-
57-
- name: Build shared mrcal_jni
58-
# Build your program with the given configuration
59-
run: cmake --build ${{github.workspace}}/cmake_build --config ${{env.BUILD_TYPE}} ${{ (startsWith(matrix.arch-name, 'windowx86-64') && '--config Release') || '' }} -j --target mrcal_jni
60-
61-
- name: Gradle build
62-
# Build your program with the given configuration
63-
run: ./gradlew build
64-
65-
- run: ./gradlew publish
66-
name: Publish
67-
env:
68-
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
69-
if: github.event_name == 'push'
70-
71-
- uses: actions/upload-artifact@v4
72-
with:
73-
name: libmrcal-jar-${{ matrix.arch-name }}
74-
path: |
75-
${{ github.workspace }}/build/libs/*.jar
76-
77-
build-windows:
78-
runs-on: windows-latest
79-
80-
name: "mrcal-jni - Build - Windows"
81-
82-
env:
83-
BUILD_TYPE: "Release"
84-
85-
steps:
86-
- uses: actions/checkout@v3
87-
with:
88-
submodules: 'true'
89-
fetch-depth: 0
90-
91-
- name: Fetch tags
92-
run: git fetch --tags --force
93-
- run: git describe --tags
94-
95-
- name: Install Java 17
96-
uses: actions/setup-java@v3
97-
with:
98-
java-version: 17
99-
distribution: temurin
100-
101-
- name: Configure CMake
102-
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=windowsx86-64 -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -G Ninja
56+
run: cmake -B ${{github.workspace}}/cmake_build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=${{ matrix.arch-name }} ${{ matrix.extra-flags }}
10357

10458
- name: Build shared mrcal_jni
10559
# Build your program with the given configuration
@@ -115,18 +69,18 @@ jobs:
11569
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
11670
if: github.event_name == 'push'
11771

118-
- uses: actions/upload-artifact@v4
72+
- uses: actions/upload-artifact@v5
11973
with:
120-
name: libmrcal-jar-windowsx64
74+
name: libmrcal-jar-${{ matrix.arch-name }}
12175
path: ${{ github.workspace }}/build/libs/*.jar
12276

12377
release:
124-
needs: [build-host, build-windows]
78+
needs: [build-host]
12579
runs-on: ubuntu-22.04
12680
steps:
12781
# Download literally every single artifact. This also downloads client and docs,
12882
# but the filtering below won't pick these up (I hope)
129-
- uses: actions/download-artifact@v4
83+
- uses: actions/download-artifact@v5
13084

13185
- run: find
13286

build.gradle

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,16 @@ test {
5757
useJUnitPlatform()
5858
}
5959

60-
ext.nativeName = wpilibTools.platformMapper.currentPlatform.platformName;
60+
ext.nativeName = wpilibTools.platformMapper.currentPlatform.platformName.replace('win', 'windows/').replace('mac', 'osx/').replace('linux', 'linux/').replace('x64', 'x86-64');
6161
ext.outputsFolder = file("$buildDir/outputs")
6262

6363
println("Building for $nativeName")
6464

6565
tasks.register('copyNativeLibrary', Sync) {
6666
from "${projectDir}/cmake_build/bin/"
6767
from "${projectDir}/cmake_build/lib/"
68-
into "${outputsFolder}/nativelibraries/${nativeName}/"
68+
into "${outputsFolder}/${nativeName}/"
6969
include "**/*.dll", "**/*.so"
70-
71-
// And flatten, since windows is stupid
72-
eachFile {
73-
path = name
74-
}
7570
includeEmptyDirs = false
7671

7772
build.dependsOn it

0 commit comments

Comments
 (0)