Add pre compiled binaries for all 3 major platforms.

This commit is contained in:
edgarsilva 2014-11-03 11:09:08 -06:00
parent cf11a2100a
commit a903162a5c
7 changed files with 229 additions and 6 deletions

View File

@ -1,10 +1,68 @@
language: node_js
node_js:
- "0.10"
- "0.11"
- '0.10'
- '0.11'
compiler: clang
env:
global:
- secure: v7yz4KwR5+Iv7+oPs54wAK6/fYp7xnEDmbbr2z5F2i8NaG5Qvi4AGwfRuPTLNAeFhpapzL8wk8LI4NfxChUe2S1Rj9ytpW350wtHNcIEBiJXsbfKBeHCZQcZnlx+KofmuP//BRjO3kiVgilOxuLvVbdA9Ob/6ixAdKTHl0yk+NA=
- secure: ehjkxVYyBwL9dZAD1w/D3oEN2lWQebN44CnrftTYw0xVPiYsNeCKV0SpTs/RIlhhiVlQjZRmZbt+My213q32vYdKGEv4TGyyiSfy3BQz+hkXb5vCtxS0WZjfQpxcApYlh9bLh4LzvCcEXe6RrdLSApTXVh9PPiKVGBPtZjLXfZU=
before_install:
- sudo apt-get update
# Fix a problem with apt-get failing later, see http://docs.travis-ci.com/user/installing-dependencies/#Installing-Ubuntu-packages
- sudo apt-get update -qq
- sudo apt-get install libcv-dev
- sudo apt-get install libopencv-dev
- sudo apt-get install libhighgui-dev
# get commit message
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
# put local node-pre-gyp on PATH
- export PATH=./node_modules/.bin/:$PATH
# install node-pre-gyp so it is available for packaging and publishing
- npm install node-gyp -g
# install node-pre-gyp so it is available for packaging and publishing
- npm install node-pre-gyp
# install aws-sdk so it is available for publishing to AS3
- npm install aws-sdk
# figure out if we should publish
- PUBLISH_BINARY=false
# if we are building a tag then publish
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi;
# or if we put [publish binary] in the commit message
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi;
- platform=$(uname -s | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/")
install:
# ensure source install works
- npm install --build-from-source
# test our module
- npm test
- node lib/opencv.js
before_script:
- echo "Publishing native platform Binary Package? ->" $PUBLISH_BINARY
# if publishing, do it
- if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package publish; fi;
# cleanup
- node-pre-gyp clean
- node-gyp clean
- sudo apt-get purge libcv-dev
- sudo apt-get purge libopencv-dev
- sudo apt-get purge libhighgui-dev
script:
# if publishing, test installing from remote
- INSTALL_RESULT=0
- if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi;
# if install returned non zero (errored) then we first unpublish and then call false so travis will bail at this line
- if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";node-pre-gyp unpublish;false; fi
# If success then we arrive here so lets clean up
- node-pre-gyp clean
# Can't compile opencv 32bit in 64 bit env.
after_success:
# if success then query and display all published binaries
- node-pre-gyp info

103
appveyor.yml Normal file
View File

@ -0,0 +1,103 @@
# environment variables
environment:
node_pre_gyp_accessKeyId:
secure: hTQMi31kndQOPU0AZVkVXgH7Vc3EjJmvThFwMYhkno4=
node_pre_gyp_secretAccessKey:
secure: ZOsWmB5rxfiPgPW5bCuvkK1UUEupssSoHfK5jWcJBJsPuPWQHEWOr1lUteVbx2NV
# try on unstable version of the server to build node-opencv
os: unstable
# to add several platforms to build matrix:
platform:
- x64
install:
- cmd: ECHO "INSTALL OPENCV:"
- cmd: choco install OpenCV
- cmd: ECHO "APPVEYOR_REPO_COMMIT_MESSAGE ->"
- cmd: ECHO %APPVEYOR_REPO_COMMIT_MESSAGE%
- cmd: SET COMMIT_MSG="%APPVEYOR_REPO_COMMIT_MESSAGE%"
- cmd: SET PUBLISH_BINARY=false
# Check to verify the branch is the same than latest tag, if so
# then we publish the binaries if everything else is successful.
- cmd: git describe --tags --always HEAD > _git_tag.tmp
- cmd: SET /p GIT_TAG=<_git_tag.tmp
- cmd: ECHO "LATEST LOCAL TAG:"
- cmd: ECHO %GIT_TAG%
- cmd: ECHO "APPVEYOR REPO BRANCH/TAG:"
- cmd: ECHO %APPVEYOR_REPO_BRANCH%
- cmd: DEL _git_tag.tmp
- cmd: IF x%APPVEYOR_REPO_BRANCH%==x%GIT_TAG% SET PUBLISH_BINARY=true
# Or look for commit message containing `[publish binary]`
- cmd: IF not x%COMMIT_MSG:[publish binary]=%==x%COMMIT_MSG% SET PUBLISH_BINARY=true
- cmd: ECHO "Env Var PUBLISH_BINARY:"
- cmd: ECHO %PUBLISH_BINARY%
- cmd: git clone https://github.com/marcelklehr/nodist.git c:\nodist 2>&1
- cmd: SET PATH=C:\nodist\bin;%PATH%
- cmd: SET NODIST_PREFIX=C:\nodist
before_build:
- cmd: SET ARCH=x64
- cmd: SET NODIST_X64=1
- cmd: call nodist update
- cmd: call nodist stable
- cmd: npm install -g node-gyp
- cmd: SET APP_PATH=%CD%
- cmd: IF EXIST C:\OpenCV* CD C:\OpenCV*
- cmd: SET OPENCV_ROOT_PATH=%CD%\opencv
- cmd: CD %APP_PATH%
- cmd: SET OPENCV_DIR=%OPENCV_ROOT_PATH%\build\%ARCH%\vc12\bin
- cmd: SET PATH=%cd%\node_modules\.bin\;C:\MinGW\bin;C:\GTK\bin;C:\msys\1.0\bin;%OPENCV_DIR%;%PATH%
- cmd: SET PKG_CONFIG_PATH=C:\GTK\lib\pkgconfig
# Here we need to copy the opencv.pc file from the repo into PKG_CONFIG_PATH
# trick part is to check for the vc12 folder and use that one
- cmd: copy .\utils\opencv_x64.pc C:\GTK\lib\pkgconfig\opencv.pc
# to run your custom scripts instead of automatic MSBuild
build_script:
- cmd: ECHO "BUILDING x64 binary package:"
- cmd: npm install --build-from-source --msvs_version=2013
- cmd: npm test
- cmd: node lib/opencv.js
- cmd: ECHO "PUBLISH x64 binary package:"
- cmd: npm install aws-sdk
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp package publish 2>&1)
- cmd: node-pre-gyp clean
- cmd: node-gyp clean
- cmd: npm uninstall -g node-gyp
- cmd: rmdir /q /s node_modules
- cmd: DEL C:\GTK\lib\pkgconfig\opencv.pc
after_build:
- cmd: SET ARCH=x86
- cmd: SET OPENCV_DIR=%OPENCV_ROOT_PATH%\build\%ARCH%\vc12\bin
- cmd: SET PATH=%OPENCV_DIR%;%PATH%
- cmd: SET NODIST_X64=0
- cmd: call nodist update
- cmd: call nodist stable
- cmd: npm install -g node-gyp
- cmd: copy .\utils\opencv_x86.pc C:\GTK\lib\pkgconfig\opencv.pc
- cmd: ECHO "BUILDING x86 binary package:"
- cmd: npm install --build-from-source --msvs_version=2013
- cmd: npm test
- cmd: node lib/opencv.js
- cmd: ECHO "PUBLISH x86 binary package:"
- cmd: npm install aws-sdk
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp package publish 2>&1)
- cmd: node-pre-gyp clean
- cmd: node-gyp clean
- cmd: rmdir /q /s node_modules
on_success:
# test installing from binary package works
- cmd: ECHO "ON SUCCESS:"
- cmd: ECHO "Try installing from binary:"
#- cmd: IF %PUBLISH_BINARY%==true npm install --fallback-to-build=false
- cmd: npm install --fallback-to-build=false
# Print Available Binaries
- cmd: node-pre-gyp info
test: OFF
deploy: OFF

View File

@ -32,6 +32,16 @@
, 'cflags!' : [ '-fno-exceptions']
, 'cflags_cc!': [ '-fno-rtti', '-fno-exceptions']
, "conditions": [
['OS=="win"',
{
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': '2',
'DisableSpecificWarnings': [ '4530', '4506', '4244' ],
},
},
},
],
['OS=="mac"', {
# cflags on OS X are stupid and have to be defined like this
'xcode_settings': {
@ -47,5 +57,16 @@
}]
]
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}]
}

View File

@ -1 +1,7 @@
module.exports = require('../build/Release/opencv.node');
var binary = require('node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
var binding = require(binding_path);
//module.exports = require('../build/Release/opencv.node');
module.exports = binding;

View File

@ -3,17 +3,21 @@
"description": "Node Bindings to OpenCV",
"author": "Peter Braden <peterbraden@peterbraden.co.uk>",
"dependencies": {
"node-pre-gyp": "0.5.31",
"buffers": "0.1.1",
"nan": "^1.3.0"
},
"version": "1.0.0",
"devDependencies": {
"tape": "^3.0.0"
"tape": "^3.0.0",
"aws-sdk": "~2.0.21"
},
"bundledDependencies":["node-pre-gyp"],
"license": "MIT",
"scripts": {
"build": "node-gyp build",
"test": "node test/unit.js"
"test": "node test/unit.js",
"install": "node-pre-gyp install --fallback-to-build"
},
"keywords": [
"opencv",
@ -28,5 +32,12 @@
},
"engines": {
"node": ">=0.10"
},
"binary": {
"module_name" : "opencv",
"module_path" : "./build/{module_name}/v{version}/{configuration}/{node_abi}-{platform}-{arch}/",
"remote_path" : "./{module_name}/v{version}/{configuration}/",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz",
"host" : "https://node-opencv.s3.amazonaws.com"
}
}

12
utils/opencv_x64.pc Normal file
View File

@ -0,0 +1,12 @@
# Package Information for pkg-config
opencv_prefix=C:/OpenCV249/opencv/build/x64/vc12
exec_prefix=${opencv_prefix}/bin
libdir=${opencv_prefix}/lib
includedir=C:/OpenCV249/opencv/build/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.9
Cflags: ${includedir} ${includedir}/opencv
Libs: ${libdir}/opencv_core249 ${libdir}/opencv_imgproc249 ${libdir}/opencv_highgui249 ${libdir}/opencv_ml249 ${libdir}/opencv_video249 ${libdir}/opencv_features2d249 ${libdir}/opencv_calib3d249 ${libdir}/opencv_objdetect249 ${libdir}/opencv_contrib249 ${libdir}/opencv_legacy249 ${libdir}/opencv_flann249 ${libdir}/opencv_core249

12
utils/opencv_x86.pc Normal file
View File

@ -0,0 +1,12 @@
# Package Information for pkg-config
opencv_prefix=C:/OpenCV249/opencv/build/x86/vc12
exec_prefix=${opencv_prefix}/bin
libdir=${opencv_prefix}/lib
includedir=C:/OpenCV249/opencv/build/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.9
Cflags: ${includedir} ${includedir}/opencv
Libs: ${libdir}/opencv_core249 ${libdir}/opencv_imgproc249 ${libdir}/opencv_highgui249 ${libdir}/opencv_ml249 ${libdir}/opencv_video249 ${libdir}/opencv_features2d249 ${libdir}/opencv_calib3d249 ${libdir}/opencv_objdetect249 ${libdir}/opencv_contrib249 ${libdir}/opencv_legacy249 ${libdir}/opencv_flann249 ${libdir}/opencv_core249