Skip to content

Commit

Permalink
Merge pull request #132 from UrielCh/dev
Browse files Browse the repository at this point in the history
fix compilation warning
  • Loading branch information
UrielCh authored Apr 16, 2024
2 parents 376aa53 + e33f00c commit c50f6e9
Show file tree
Hide file tree
Showing 50 changed files with 1,597 additions and 1,201 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/prebuild-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Use openCV from Apt

on:
push:
branches: [ "master", "dev" ]
paths:
- "cc/**"
- "install/**"
- "lib/**"
- "test/**"
- "typings/**"
- "package.json"
- ".github/workflows/prebuild-linux.yml"
pull_request:
branches: [ "master" ]
paths:
- "cc/**"
- "install/**"
- "lib/**"
- "test/**"
- "typings/**"
- "package.json"
- ".github/workflows/prebuild-linux.yml"

env:
OPENCV4NODEJS_DISABLE_AUTOBUILD: 1

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
opencv_version:
- 4
node_version:
# - 16
# - 18
- 20

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Install Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'

- name: Install OpenCV ${{ matrix.opencv_version }}
run: |
sudo apt update
sudo apt install libopencv-dev
- run: pnpm install --frozen-lockfile

- name: pnpm run prepack
run: pnpm run prepack

- name: build native code
run: npx node-gyp rebuild

- name: install deps in test
working-directory: ./test
run: pnpm install

- name: run test-appveyor test
working-directory: ./test
run: pnpm run test-appveyor
73 changes: 73 additions & 0 deletions .github/workflows/prebuild-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Use openCV from Brew

on:
push:
branches: [ "master", "dev" ]
paths:
- "cc/**"
- "install/**"
- "lib/**"
- "test/**"
- "typings/**"
- "package.json"
- ".github/workflows/prebuild-mac.yml"
pull_request:
branches: [ "master" ]
paths:
- "cc/**"
- "install/**"
- "lib/**"
- "test/**"
- "typings/**"
- "package.json"
- ".github/workflows/prebuild-mac.yml"

env:
OPENCV4NODEJS_DISABLE_AUTOBUILD: 1

permissions:
contents: read

jobs:
build:
runs-on: macos-latest
strategy:
matrix:
opencv_version:
- 4
node_version:
# - 16
# - 18
- 20

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Install Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'

- name: Install OpenCV ${{ matrix.opencv_version }}
run: |
brew install opencv@${{ matrix.opencv_version }}
- name: run pnpm install
run: pnpm install --frozen-lockfile

- name: pnpm run prepack
run: pnpm run prepack

- name: build native code
run: npx node-gyp rebuild

- name: install deps in test
working-directory: ./test
run: pnpm install --frozen-lockfile

- name: run test-appveyor test
working-directory: ./test
run: pnpm run test-appveyor
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Build using prebuild openCV
name: Use openCV from Chocolatey

on:
push:
branches: [ "master" ]
branches: [ "master", "dev" ]
paths:
- "cc/**"
- "install/**"
- "lib/**"
- "test/**"
- "typings/**"
- "package.json"
- ".github/workflows/prebuild.yml"
- ".github/workflows/prebuild-win64.yml"
pull_request:
branches: [ "master" ]
paths:
Expand All @@ -20,7 +20,7 @@ on:
- "test/**"
- "typings/**"
- "package.json"
- ".github/workflows/prebuild.yml"
- ".github/workflows/prebuild-win64.yml"

env:
# Path to the solution file relative to the root of the project.
Expand All @@ -30,6 +30,7 @@ env:
# OPENCV_LIB_DIR: c:\tools\opencv\build\x64\vc14\lib
# OPENCV_BIN_DIR: c:\tools\opencv\build\x64\vc14\bin
OPENCV4NODEJS_DISABLE_AUTOBUILD: 1
OPENCV_BUILD_ROOT: D:\a\opencv\
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
Expand All @@ -45,9 +46,9 @@ jobs:
matrix:
opencv_version:
- 4.9.0
- 4.8.0
- 4.7.0
- 4.6.0
# - 4.8.0
# - 4.7.0
# - 4.6.0
# - 4.5.5 # 2019-12-23 ubuntu 22.04
###- 4.5.1 # raspberry Pi version
# - 4.2.0 # 2019-12-23 ubuntu 20.04
Expand All @@ -60,34 +61,36 @@ jobs:
- x64
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8.15.3
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.architecture }}
cache: 'pnpm'

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v2

- name: Install OpenCV
run: |
choco install OpenCV -y --version ${{ matrix.opencv_version }}
- name: add path to PATH environment variable
uses: myci-actions/export-env-var-powershell@1
with:
name: PATH
value: $env:PATH;$env:OPENCV_BIN_DIR
choco install opencv -y --version ${{ matrix.opencv_version }}
# - name: add path to PATH environment variable
# uses: myci-actions/export-env-var-powershell@1
# with:
# name: PATH
# value: $env:PATH;$env:OPENCV_BIN_DIR

- name: run pnpm install
run: pnpm install --frozen-lockfile

- name: pnpm run prepack
run: pnpm run prepack

- name: build native code
run: npx node-gyp rebuild

- name: install deps in test
working-directory: ./test
run: pnpm install --frozen-lockfile
Expand Down
4 changes: 4 additions & 0 deletions bin/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node
import * as compileLib from "../install/compileLib";
const {argv} = process;
compileLib.compileLib(argv);
16 changes: 10 additions & 6 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"targets": [{
"target_name": "opencv4nodejs",
"defines": [
"<!@(node ./install/parseEnv.js OPENCV4NODEJS_DEFINES)",
"<!@(node ./bin/install.js OPENCV4NODEJS_DEFINES)",
],
"include_dirs" : [
"<!@(node ./install/parseEnv.js OPENCV4NODEJS_INCLUDES)",
"<!@(node ./bin/install.js OPENCV4NODEJS_INCLUDES)",
"cc",
"cc/core",
"<!(node -e \"require('nan')\")",
"cc/native-node-utils",
],
"libraries": [
"<!@(node ./install/parseEnv.js OPENCV4NODEJS_LIBRARIES)",
"<!@(node ./bin/install.js OPENCV4NODEJS_LIBRARIES)",
],
"sources": [
"cc/opencv4nodejs.cc",
Expand Down Expand Up @@ -121,16 +121,16 @@
"cc/highgui/highguiConstants.cc",
],
"cflags" : [
"-std=c++17"
"-std=c++17",
],
"cflags!" : [
"-std=c++17",
"-fno-exceptions"
"-fno-exceptions",
],
"cflags_cc!": [
"-std=c++17",
"-fno-rtti",
"-fno-exceptions"
"-fno-exceptions",
],
"ldflags" : [
"-Wl,-rpath,'$$ORIGIN'"
Expand Down Expand Up @@ -162,6 +162,10 @@
}],
["OS==\"mac\"",
{
"cflags": [
"-std=c++17",
"-Wno-error=deprecated-declarations"
],
"link_settings": {
"libraries": [
"-Wl,-rpath,@loader_path/../../../opencv-build/opencv/build/lib"
Expand Down
Loading

0 comments on commit c50f6e9

Please sign in to comment.