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

Build in debug mode too #7

Open
wants to merge 1 commit into
base: main
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
63 changes: 42 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build-host:
strategy:
Expand All @@ -20,9 +16,15 @@ jobs:
include:
- os: ubuntu-22.04
arch-name: linuxx86-64
BUILD_TYPE: Release
publish-type: ""
- os: ubuntu-22.04
arch-name: linuxx86-64
BUILD_TYPE: Debug
publish-type: "debug"

runs-on: ${{ matrix.os }}
name: "mrcal-jni - Build - ${{ matrix.arch-name }}"
name: "mrcal-jni - Build - ${{ matrix.arch-name }}/${{matrix.publish-type}}"

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -52,30 +54,42 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=${{ matrix.arch-name }}
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DOPENCV_ARCH=${{ matrix.arch-name }}

- name: Build shared mrcal_jni
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/cmake_build --config ${{env.BUILD_TYPE}} ${{ (startsWith(matrix.arch-name, 'windowx86-64') && '--config Release') || '' }} -j --target mrcal_jni
run: cmake --build ${{github.workspace}}/cmake_build --config ${{matrix.BUILD_TYPE}} ${{ (startsWith(matrix.arch-name, 'windowx86-64') && '--config Release') || '' }} -j --target mrcal_jni

- name: Gradle build
# Build your program with the given configuration
run: ./gradlew build

- run: ./gradlew publish
- run: ./gradlew publish -PPublishType=${{ matrix.publish-type }}
name: Publish
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
if: github.event_name == 'push'

- uses: actions/upload-artifact@master
with:
name: libmrcal-jar-${{ matrix.arch-name }}
name: libmrcal-jar-${{ matrix.arch-name }}-${{matrix.BUILD_TYPE}}
path: |
${{ github.workspace }}/build/libs/*.jar

build-raspi:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- BUILD_TYPE: Release
publish-type: ""
- BUILD_TYPE: Debug
publish-type: "debug"

name: "mrcal-jni - Build - ${{ matrix.BUILD_TYPE }}/${{ matrix.publish-type }}"

steps:

- uses: actions/checkout@v3
Expand All @@ -95,27 +109,34 @@ jobs:
sudo bash -c "echo 'deb [trusted=yes] http://mrcal.secretsauce.net/packages/jammy/public/ jammy main' >> /etc/apt/sources.list"
sudo apt update
sudo apt install cmake default-jdk default-jre git gcc g++ libmrcal-dev mrbuild libsuitesparse-dev liblist-moreutils-perl -y
cmake -B cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=linuxarm64
cmake --build cmake_build --config ${{env.BUILD_TYPE}} -j --target mrcal_jni
cmake -B cmake_build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DOPENCV_ARCH=linuxarm64
cmake --build cmake_build --config ${{matrix.BUILD_TYPE}} -j --target mrcal_jni

- run: |
./gradlew build ${{ (startsWith(github.event_name, 'push') && 'publish') || '' }} -PArchOverride=linuxarm64
./gradlew build ${{ (startsWith(github.event_name, 'push') && 'publish') || '' }} -PArchOverride=linuxarm64 -PPublishType=${{ matrix.publish-type }}
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}

- uses: actions/upload-artifact@v3
name: Upload jar
with:
name: libmrcal-jar-pi
name: libmrcal-jar-pi-${{matrix.BUILD_TYPE}}
path: ${{ github.workspace }}/build/libs/*.jar

build-windows:
runs-on: windows-latest

name: "mrcal-jni - Build - Windows"
strategy:
fail-fast: false
matrix:
include:
- BUILD_TYPE: Release
publish-type: ""
- BUILD_TYPE: Debug
publish-type: "debug"

name: "mrcal-jni - Build Windows - ${{ matrix.BUILD_TYPE }}/${{matrix.publish-type}}"

env:
BUILD_TYPE: "Release"
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -144,25 +165,25 @@ jobs:
runVcpkgInstall: true

- name: Configure CMake
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=windowsx86-64 -T ClangCl -A x64 -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake"
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DOPENCV_ARCH=windowsx86-64 -T ClangCl -A x64 -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake"

- name: Build shared mrcal_jni
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/cmake_build --config ${{env.BUILD_TYPE}} -j --target mrcal_jni
run: cmake --build ${{github.workspace}}/cmake_build --config ${{matrix.BUILD_TYPE}} -j --target mrcal_jni

- name: Gradle build
# Build your program with the given configuration
run: ./gradlew build

- run: ./gradlew publish
- run: ./gradlew publish -PPublishType=${{ matrix.publish-type }}
name: Publish
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
if: github.event_name == 'push'

- uses: actions/upload-artifact@master
with:
name: libmrcal-jar-windowsx64
name: libmrcal-jar-windowsx64-${{matrix.BUILD_TYPE}}
path: ${{ github.workspace }}/build/libs/*.jar

release:
Expand Down
5 changes: 4 additions & 1 deletion publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ def nativeName = wpilibTools.platformMapper.currentPlatform.platformName;
def artifactGroupId = 'org.photonvision'
def baseArtifactId = "photon-mrcal"

def jniType = project.findProperty("PublishType") ?: "";
println("Building with JNI publish type: " + jniType);

task nativeLibraryJar(type: Jar, dependsOn: copyNativeLibrary) {
archiveClassifier = nativeName
archiveClassifier = nativeName + jniType
from outputsFolder
}
build.dependsOn nativeLibraryJar
Expand Down
Loading