Skip to content

Commit 8728e6a

Browse files
committed
Initial native addon setup
1 parent a78bd9e commit 8728e6a

10 files changed

Lines changed: 57 additions & 28 deletions

File tree

.gitignore

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
1-
# Logs
2-
logs
3-
*.log
4-
5-
# Runtime data
6-
pids
7-
*.pid
8-
*.seed
9-
10-
# Directory for instrumented libs generated by jscoverage/JSCover
11-
lib-cov
12-
13-
# Coverage directory used by tools like istanbul
14-
coverage
15-
16-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17-
.grunt
18-
19-
# node-waf configuration
20-
.lock-wscript
21-
22-
# Compiled binary addons (http://nodejs.org/api/addons.html)
23-
build/Release
24-
25-
# Dependency directory
26-
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27-
node_modules
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Compiled binary addons (http://nodejs.org/api/addons.html)
6+
build
7+
8+
# Dependency directory
9+
node_modules

LICENSE.md renamed to LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright {yyyy} {name of copyright owner}
189+
Copyright 2015 The node-tensorflow Authors. All rights reserved.
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

binding.gyp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
'targets': [{
3+
'target_name': 'node-tensorflow',
4+
'sources': ['./src/node-tensorflow.cc'],
5+
"include_dirs" : [
6+
"<!(node -e \"require('nan')\")"
7+
]
8+
}]
9+
}

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This is the entry file for Node.js API
2+
3+
var bindings = require('bindings');
4+
var addon = bindings('node-tensorflow');
5+
6+
addon.print();

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "node-tensorflow",
33
"description": "Node-tensorflow is a NodeJS API for utilizing Google's machine learning library TensorFlow.",
44
"version": "0.0.1",
5+
"main": "index.js",
56
"keywords": [
67
"tensorflow",
78
"node-tensorflow"
@@ -15,6 +16,10 @@
1516
"url": "https://github.com/node-tensorflow/node-tensorflow.git"
1617
}
1718
],
19+
"dependencies": {
20+
"bindings": "^1.2.1",
21+
"nan": "^2.1.0"
22+
},
1823
"licenses": [
1924
{
2025
"name": "Apache License 2.0",

src/README.md

Whitespace-only changes.

src/node-tensorflow.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <nan.h>
2+
3+
using namespace v8;
4+
5+
NAN_METHOD(Print) {
6+
printf("This is a sample Node.js addon\n");
7+
}
8+
9+
NAN_MODULE_INIT(Init) {
10+
Nan::Set(target, Nan::New("print").ToLocalChecked(),
11+
Nan::GetFunction(Nan::New<FunctionTemplate>(Print)).ToLocalChecked());
12+
}
13+
14+
NODE_MODULE(myaddon, Init);

tools/docker/Dockerfile

Whitespace-only changes.

tools/docker/LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2015 The node-tensorflow Authors. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

tools/docker/README.md

Whitespace-only changes.

0 commit comments

Comments
 (0)