mirror of https://github.com/lukechilds/node.git
Ryan Dahl
13 years ago
5 changed files with 72 additions and 0 deletions
@ -0,0 +1,17 @@ |
|||
#include <node.h> |
|||
#include <v8.h> |
|||
|
|||
using namespace v8; |
|||
|
|||
extern "C" { |
|||
void init(Handle<Object> target); |
|||
} |
|||
|
|||
Handle<Value> Method(const Arguments& args) { |
|||
HandleScope scope; |
|||
return scope.Close(String::New("world")); |
|||
} |
|||
|
|||
void init(Handle<Object> target) { |
|||
NODE_SET_METHOD(target, "hello", Method); |
|||
} |
@ -0,0 +1,8 @@ |
|||
{ |
|||
'targets': [ |
|||
{ |
|||
'target_name': 'binding', |
|||
'sources': [ 'binding.cc' ] |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,4 @@ |
|||
var assert = require('assert'); |
|||
var binding = require('./out/Release/binding'); |
|||
assert.equal('world', binding.hello()); |
|||
console.log('binding.hello() =', binding.hello()); |
@ -0,0 +1,17 @@ |
|||
{ |
|||
'target_defaults': { |
|||
'type': 'loadable_module', |
|||
'product_extension': 'node', |
|||
'include_dirs': [ |
|||
'../src', |
|||
'../deps/uv/include', |
|||
'../deps/v8/include' |
|||
], |
|||
|
|||
'conditions': [ |
|||
[ 'OS=="mac"', { |
|||
'libraries': [ '-undefined dynamic_lookup' ], |
|||
}] |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
#!/usr/bin/env python |
|||
import os |
|||
import sys |
|||
|
|||
script_dir = os.path.dirname(__file__) |
|||
node_root = os.path.normpath(os.path.join(script_dir, os.pardir)) |
|||
|
|||
sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib')) |
|||
import gyp |
|||
|
|||
if __name__ == '__main__': |
|||
args = sys.argv[1:] |
|||
addon_gypi = os.path.join(node_root, 'tools', 'addon.gypi') |
|||
common_gypi = os.path.join(node_root, 'common.gypi') |
|||
args.extend(['-I', addon_gypi]) |
|||
args.extend(['-I', common_gypi]) |
|||
args.extend(['-Dlibrary=shared_library']) |
|||
args.extend(['-Dvisibility=default']) |
|||
args.extend(['--depth=.']); |
|||
|
|||
gyp_args = list(args) |
|||
rc = gyp.main(gyp_args) |
|||
if rc != 0: |
|||
print 'Error running GYP' |
|||
sys.exit(rc) |
|||
|
Loading…
Reference in new issue