Skip to content

Commit

Permalink
Merge pull request abandonware#8 from Timeular/feature/native-mac-bin…
Browse files Browse the repository at this point in the history
…dings-abandonware

Native mac bindings
  • Loading branch information
rzr authored Apr 15, 2019
2 parents 354d6ba + 556f5fb commit b78e8ea
Show file tree
Hide file tree
Showing 23 changed files with 1,383 additions and 3,055 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ results
build/
node_modules/
npm-debug.log

lib/mac/native
14 changes: 14 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
'targets': [
{
'target_name': 'noble',
'conditions': [
['OS=="mac"', {
'dependencies': [
'lib/mac/binding.gyp:binding',
],
}],
],
},
],
}
26 changes: 26 additions & 0 deletions lib/mac/binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'src/noble_mac.mm', 'src/napi_objc.mm', 'src/ble_manager.mm', 'src/objc_cpp.mm', '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' ],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7',
'OTHER_CFLAGS': [
'-fobjc-arc',
],
},
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/CoreBluetooth.framework',
]
},
'product_dir': '../lib/mac/native',
}
]
}
20 changes: 8 additions & 12 deletions lib/mac/bindings.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
var os = require('os');
var osRelease = parseFloat(os.release());

if (osRelease < 13 ) {
module.exports = require('./legacy');
} else if (osRelease < 14) {
module.exports = require('./mavericks');
} else if (osRelease < 17) {
module.exports = require('./yosemite');
} else {
module.exports = require('./highsierra');
}
var events = require('events');
var util = require('util');

var NobleMac = require('./native/binding').NobleMac;

util.inherits(NobleMac, events.EventEmitter);

module.exports = new NobleMac();
Loading

0 comments on commit b78e8ea

Please sign in to comment.