Skip to content

Commit

Permalink
added new build option to build without dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
cansik committed Dec 16, 2022
1 parent 250fdda commit 4f3927d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: Build
on:
workflow_dispatch:
inputs:
tag:
description: 'Version Tag'
required: false
default: '0.6.6'
publishReleases:
description: 'Publish to Releases'
required: false
Expand All @@ -25,19 +21,33 @@ jobs:
java-version: '11'
- uses: gradle/gradle-build-action@v2

- name: Get Library Version
id: get_version
run: |
lib_version="$(./gradlew properties | grep ^version: | cut -d' ' -f2)"
echo "Library Version: $lib_version"
echo "version=$lib_version" >> $GITHUB_OUTPUT
echo "v_version=v$lib_version" >> $GITHUB_OUTPUT
shell: bash

- name: Build Release Package
run: |
./gradlew releaseProcessingLib --no-daemon
- name: Build Bare Release Package
run: |
./gradlew releaseProcessingLib -Pdisable-fatjar -Pbare -PoutputNamePostfix=-bare --no-daemon
# upload dist
- name: Upload binaries to release
if: ${{ github.event.inputs.publishReleases == 'true' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/*
tag: "v${{ github.event.inputs.tag }}"
release_name: "Version ${{ github.event.inputs.tag }}"
body: "Prebuilt opencv-processing libs version ${{ github.event.inputs.tag }}."
tag: "${{ steps.get_version.outputs.v_version }}"
release_name: "Version ${{ steps.get_version.outputs.version }}"
body: "Prebuilt opencv-processing libs version ${{ steps.get_version.outputs.version }}."
overwrite: true
file_glob: true
prerelease: true
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See the included examples below for an overview of what's possible and links to

**[OpenCV for Processing reference](http://atduskgreg.github.io/opencv-processing/reference/)**

OpenCV for Processing is based on the officially supported [OpenCV Java API](http://docs.opencv.org/java/), currently at version 4.5.5. In addition to using the wrapped functionality, you can import OpenCV modules and use any of its documented functions: [OpenCV javadocs](http://docs.opencv.org/java/). See the advanced examples (HistogramSkinDetection, DepthFromStereo, and Marker Detection) below for details. (This style of API was inspired by Kyle McDonald's [ofxCv addon](https://github.com/kylemcdonald/ofxCv) for OpenFrameworks.)
OpenCV for Processing is based on the officially supported [OpenCV Java API](http://docs.opencv.org/java/), currently at version `4.6.0`. In addition to using the wrapped functionality, you can import OpenCV modules and use any of its documented functions: [OpenCV javadocs](http://docs.opencv.org/java/). See the advanced examples (HistogramSkinDetection, DepthFromStereo, and Marker Detection) below for details. (This style of API was inspired by Kyle McDonald's [ofxCv addon](https://github.com/kylemcdonald/ofxCv) for OpenFrameworks.)

Contributions welcome.

Expand All @@ -38,6 +38,11 @@ To build only on a specific platform use the property `javacppPlatform`:
gradlew.bat releaseProcessingLib -PjavacppPlatform=linux-x86_64,macosx-x86_64,macosx-arm64,windows-x86_64,linux-armhf,linux-arm64
```

#### Build Options

- `-Pdisable-fatjar` - Disable fat jar building (all dependencies as separate files)
- `-Pbare` - Do not include dependencies (opencv, openblas). This allows other libraries to provide the opencv implementation.

### Installing

OpenCV for Processing currently supports Mac OSX, 32-bit and 64-bit Windows, 32- and 64-bit Linux. Android support is hopefully coming soon (pull requests welcome).
Expand Down
12 changes: 7 additions & 5 deletions processing-library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ task releaseProcessingLib {
into "$releaseDirectory/library"
}

println "copy dependencies..."
project.copy {
from configurations.runtimeClasspath
into "$releaseDirectory/library"
if (!project.hasProperty("bare")) {
println "copy dependencies..."
project.copy {
from configurations.runtimeClasspath
into "$releaseDirectory/library"
}
}

// Need to delete the Processing jar explicilty, at least when including them as fileTree dependencies
// Need to delete the Processing jar explicitly, at least when including them as fileTree dependencies
delete "$releaseDirectory/library/core.jar"
delete "$releaseDirectory/library/jogl-all-main.jar"
delete "$releaseDirectory/library/gluegen-rt-main.jar"
Expand Down

0 comments on commit 4f3927d

Please sign in to comment.