Skip to content

Commit

Permalink
add node-pre-gyp (#4)
Browse files Browse the repository at this point in the history
see #1
  • Loading branch information
geovie authored Sep 28, 2018
1 parent aabacf6 commit 41e01a5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
15 changes: 8 additions & 7 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
'targets': [
{
'target_name': 'noble-winrt-native',
'target_name': '<(module_name)',
'sources': [ 'src/noble_winrt.cc', 'src/napi_winrt.cc', 'src/peripheral_winrt.cc', 'src/radio_watcher.cc', 'src/notify_map.cc', 'src/ble_manager.cc', 'src/winrt_cpp.cc', 'src/callbacks.cc' ],
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")", "<!@(node -p \"require('napi-thread-safe-callback').include\")"],
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': 1,
'AdditionalOptions': ['/await', '/std:c++latest'],
},
'ExceptionHandling': 1,
'AdditionalOptions': ['/await', '/std:c++latest'],
},
},
'conditions': [
['OS=="win"', { 'defines': [ '_HAS_EXCEPTIONS=1' ] }]
]
'conditions': [
['OS=="win"', { 'defines': [ '_HAS_EXCEPTIONS=1' ] }]
],
'product_dir': '<(module_path)',
}
]
}
2 changes: 1 addition & 1 deletion lib/binding.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const events = require('events');
const util = require('util');

const NobleWinrt = require('../build/Release/noble-winrt-native').NobleWinrt;
const NobleWinrt = require('../native/noble_winrt').NobleWinrt;

util.inherits(NobleWinrt, events.EventEmitter);

Expand Down
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@
"dependencies": {
"napi-thread-safe-callback": "0.0.6",
"noble": "^1.9.1",
"node-addon-api": "^1.1.0"
"node-addon-api": "^1.1.0",
"node-pre-gyp": "^0.10.0"
},
"scripts": {
"install": "node-pre-gyp install --fallback-to-build",
"test": "node --napi-modules ./test/ci_test.js",
"test:bindings": "node --napi-modules ./test/test_binding.js",
"test:battery": "node --napi-modules ./test/test_battery.js"
},
"binary": {
"module_name": "noble_winrt",
"module_path": "./native/",
"host": "https://github.com/Timeular/noble-winrt/releases/download/",
"remote_path": "{version}"
}
}
3 changes: 3 additions & 0 deletions test/ci_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

// require winrt bindings they should be build
const winrtBindings = require('../lib/binding.js');

0 comments on commit 41e01a5

Please sign in to comment.