Skip to content

Commit 7a811b1

Browse files
committed
Very simple build
1 parent 1644bbf commit 7a811b1

5 files changed

Lines changed: 15 additions & 13 deletions

File tree

binding.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"lib/tensorflow/bazel-tensorflow/external",
1919
"lib/tensorflow/bazel-tensorflow/external/eigen_archive",
2020
"lib/tensorflow",
21+
"lib/tensorflow/bazel-tensorflow/google/protobuf/src/",
2122

2223
# Include NAN
2324
"<!(node -e \"require('nan')\")"

index.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
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.version();
7-
8-
addon.test();
1+
module.exports = require('./build/Release/node-tensorflow.node')
2+
console.log(module.exports.version())

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"dependencies": {
2020
"bindings": "^1.2.1",
21-
"nan": "^2.1.0"
21+
"nan": "^2.2.0"
2222
},
2323
"licenses": [
2424
{

src/api.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33

44
#include "tensorflow/core/public/version.h"
55

6+
using namespace v8;
67

8+
/*
79
#include <fstream>
810
911
// #include "tensorflow/core/lib/core/stringpiece.h"
1012
1113
1214
#include "tensorflow/cc/ops/const_op.h"
13-
#include "tensorflow/cc/ops/image_ops.h"
14-
#include "tensorflow/cc/ops/standard_ops.h"
15+
#include "tensorflow/core/ops/image_ops.h"
16+
//#include "tensorflow/cc/ops/standard_ops.h"
1517
#include "tensorflow/core/framework/graph.pb.h"
1618
#include "tensorflow/core/graph/default_device.h"
1719
#include "tensorflow/core/graph/graph_def_builder.h"
@@ -219,7 +221,6 @@ Status CheckTopLabel(const std::vector<Tensor>& outputs, int expected,
219221
return Status::OK();
220222
}
221223
222-
using namespace v8;
223224
224225
int runTests() {
225226
// We need to call this to set up global state for TensorFlow.
@@ -290,10 +291,12 @@ int runTests() {
290291
291292
292293
294+
293295
NAN_METHOD(RunTest) {
294296
printf("\nRunning Test\n");
295297
runTests();
296298
}
299+
*/
297300

298301
NAN_METHOD(Version) {
299302
printf("%s\n", TF_VERSION_STRING);
@@ -309,9 +312,10 @@ NAN_MODULE_INIT(Init) {
309312

310313
Nan::Set(target, Nan::New("version").ToLocalChecked(),
311314
Nan::GetFunction(Nan::New<FunctionTemplate>(Version)).ToLocalChecked());
312-
315+
/*
313316
Nan::Set(target, Nan::New("test").ToLocalChecked(),
314317
Nan::GetFunction(Nan::New<FunctionTemplate>(RunTest)).ToLocalChecked());
318+
*/
315319
}
316320

317321
NODE_MODULE(myaddon, Init);

tools/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ echo "\n" | ./configure
66
bazel build --verbose_failures=1 -c opt //tensorflow/cc:libtensorflow.so
77
#bazel build --verbose_failures=2 //tensorflow/cc:cc_ops //tensorflow/core:protos_all_cc //tensorflow/core:tensorflow
88

9+
cd ./lib/tensorflow/bazel-tensorflow/tensorflow
10+
#protoc ./tensorflow/core/framework/*.proto --cpp_out .
11+
protoc ./tensorflow/core/**/*.proto --cpp_out .

0 commit comments

Comments
 (0)