1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | {
|
19 | 'variables' : {
|
20 | 'tensorflow_include_dir' : '<(module_root_dir)/deps/include',
|
21 | 'tensorflow_headers' : [
|
22 | '<@(tensorflow_include_dir)/tensorflow/c/c_api.h',
|
23 | '<@(tensorflow_include_dir)/tensorflow/c/eager/c_api.h',
|
24 | ],
|
25 | 'tensorflow-library-action': 'move'
|
26 | },
|
27 | 'targets' : [{
|
28 | 'target_name' : 'tfjs_binding',
|
29 | 'sources' : [
|
30 | 'binding/tfjs_backend.cc',
|
31 | 'binding/tfjs_binding.cc'
|
32 | ],
|
33 | 'include_dirs' : [ '..', '<(tensorflow_include_dir)' ],
|
34 | 'conditions' : [
|
35 | [
|
36 | 'OS=="linux"', {
|
37 | 'libraries' : [
|
38 | '-Wl,-rpath,\$$ORIGIN/../../deps/lib',
|
39 | '-ltensorflow',
|
40 | '-ltensorflow_framework',
|
41 | ],
|
42 | 'library_dirs' : ['<(module_root_dir)/deps/lib'],
|
43 | }
|
44 | ],
|
45 | [
|
46 | 'OS=="mac"', {
|
47 | 'libraries' : [
|
48 | '<(module_root_dir)/deps/lib/libtensorflow.dylib',
|
49 | '<(module_root_dir)/deps/lib/libtensorflow_framework.dylib',
|
50 | ],
|
51 | 'postbuilds': [
|
52 | {
|
53 | 'postbuild_name': 'Adjust libtensorflow load path',
|
54 | 'action': [
|
55 | 'install_name_tool',
|
56 | "-change",
|
57 | "@rpath/libtensorflow.1.dylib",
|
58 | "@loader_path/../../deps/lib/libtensorflow.dylib",
|
59 | "<(PRODUCT_DIR)/tfjs_binding.node"
|
60 | ]
|
61 | },
|
62 | {
|
63 | 'postbuild_name': 'Adjust libtensorflow_framework load path',
|
64 | 'action': [
|
65 | 'install_name_tool',
|
66 | "-change",
|
67 | "@rpath/libtensorflow_framework.1.dylib",
|
68 | "@loader_path/../../deps/lib/libtensorflow_framework.dylib",
|
69 | "<(PRODUCT_DIR)/tfjs_binding.node"
|
70 | ]
|
71 | }
|
72 | ],
|
73 | }
|
74 | ],
|
75 | [
|
76 | 'OS=="win"', {
|
77 | 'defines': ['COMPILER_MSVC'],
|
78 | 'libraries': ['tensorflow'],
|
79 | 'library_dirs' : ['<(module_root_dir)/deps/lib'],
|
80 | 'variables': {
|
81 | 'tensorflow-library-target': 'windows'
|
82 | },
|
83 | 'msvs_disabled_warnings': [
|
84 |
|
85 |
|
86 |
|
87 | 4190
|
88 | ]
|
89 | },
|
90 | ]
|
91 | ],
|
92 | }
|
93 | , {
|
94 | "target_name": "action_after_build",
|
95 | "type": "none",
|
96 | "dependencies": [ "<(module_name)" ],
|
97 | "copies": [
|
98 | {
|
99 | "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
100 | "destination": "<(module_path)"
|
101 | }
|
102 | ]
|
103 | }
|
104 | ],
|
105 | "defines": [
|
106 | "NAPI_VERSION=<(napi_build_version)"
|
107 | ]
|
108 | }
|