blob: 2be275b5852e872fe7f35da228a9eed04566ec3b [file] [log] [blame]
murgatroid992d6d3302015-09-21 13:29:40 -07001%YAML 1.2
2--- |
murgatroid99fd994f12015-10-09 14:02:28 -07003 # GRPC Node gyp file
4 # This currently builds the Node extension and dependencies
murgatroid992d6d3302015-09-21 13:29:40 -07005 # This file has been automatically generated from a template file.
6 # Please look at the templates directory instead.
7 # This file can be regenerated from the template by running
8 # tools/buildgen/generate_projects.sh
9
10 # Copyright 2015, Google Inc.
11 # All rights reserved.
12 #
13 # Redistribution and use in source and binary forms, with or without
14 # modification, are permitted provided that the following conditions are
15 # met:
16 #
17 # * Redistributions of source code must retain the above copyright
18 # notice, this list of conditions and the following disclaimer.
19 # * Redistributions in binary form must reproduce the above
20 # copyright notice, this list of conditions and the following disclaimer
21 # in the documentation and/or other materials provided with the
22 # distribution.
23 # * Neither the name of Google Inc. nor the names of its
24 # contributors may be used to endorse or promote products derived from
25 # this software without specific prior written permission.
26 #
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
39 # Some of this file is built with the help of
40 # https://n8.io/converting-a-c-library-to-gyp/
41 {
murgatroid99fd994f12015-10-09 14:02:28 -070042 'variables': {
43 'config': '<!(echo $CONFIG)'
44 },
murgatroid9938745ef2015-09-21 16:39:37 -070045 # TODO: Finish windows support
murgatroid992d6d3302015-09-21 13:29:40 -070046 'target_defaults': {
murgatroid99e7540792015-10-09 15:43:14 -070047 # Empirically, Node only exports ALPN symbols if its major version is >0.
murgatroid99fd994f12015-10-09 14:02:28 -070048 # io.js always reports versions >0 and always exports ALPN symbols.
murgatroid9915def982015-10-09 14:11:02 -070049 # Therefore, Node's major version will be truthy if and only if it
50 # supports ALPN. The output of "node -v" is v[major].[minor].[patch],
murgatroid99c07c7342015-10-19 17:41:03 -070051 # like "v4.1.1" in a recent version. We use cut to split by period and
52 # take the first field (resulting in "v[major]"), then use cut again
53 # to take all but the first character, removing the "v".
murgatroid99ca9db402015-09-21 14:39:09 -070054 'defines': [
murgatroid99c07c7342015-10-19 17:41:03 -070055 'TSI_OPENSSL_ALPN_SUPPORT=<!(node --version | cut -d. -f1 | cut -c2-)'
murgatroid99ca9db402015-09-21 14:39:09 -070056 ],
murgatroid992d6d3302015-09-21 13:29:40 -070057 'include_dirs': [
murgatroid99ca9db402015-09-21 14:39:09 -070058 '.',
murgatroid992d6d3302015-09-21 13:29:40 -070059 'include'
murgatroid99a89d9e72015-10-13 16:03:16 -070060 ],
61 'conditions': [
62 ['OS != "win"', {
63 'conditions': [
64 ['config=="gcov"', {
65 'cflags': [
66 '-ftest-coverage',
67 '-fprofile-arcs',
68 '-O0'
69 ],
70 'ldflags': [
71 '-ftest-coverage',
72 '-fprofile-arcs'
73 ]
74 }
75 ]
76 ]
77 }],
murgatroid99fd994f12015-10-09 14:02:28 -070078 ]
murgatroid992d6d3302015-09-21 13:29:40 -070079 },
80 'targets': [
81 % for lib in libs:
murgatroid99db5b1602015-10-01 13:20:11 -070082 % if lib.name == 'gpr' or lib.name == 'grpc':
murgatroid992d6d3302015-09-21 13:29:40 -070083 {
84 'target_name': '${lib.name}',
85 'product_prefix': 'lib',
86 'type': 'static_library',
87 'dependencies': [
88 % for dep in getattr(lib, 'deps', []):
89 '${dep}',
90 % endfor
91 ],
92 'sources': [
93 % for source in lib.src:
murgatroid99ca9db402015-09-21 14:39:09 -070094 '${source}',
murgatroid992d6d3302015-09-21 13:29:40 -070095 % endfor
murgatroid99ca9db402015-09-21 14:39:09 -070096 ],
murgatroid996ffdb942015-10-22 16:10:05 -070097 "conditions": [
98 ['OS == "mac"', {
99 'xcode_settings': {
100 'MACOSX_DEPLOYMENT_TARGET': '10.9',
101 'OTHER_CFLAGS': [
102 '-stdlib=libc++'
103 ]
104 }
105 }]
106 ],
murgatroid992d6d3302015-09-21 13:29:40 -0700107 },
murgatroid99ca9db402015-09-21 14:39:09 -0700108 % endif
murgatroid992d6d3302015-09-21 13:29:40 -0700109 % endfor
murgatroid99fd994f12015-10-09 14:02:28 -0700110 {
111 'include_dirs': [
112 "<!(node -e \"require('nan')\")"
113 ],
114 'cflags': [
115 '-std=c++0x',
116 '-Wall',
117 '-pthread',
118 '-g',
119 '-zdefs',
120 '-Werror',
121 '-Wno-error=deprecated-declarations'
122 ],
123 'ldflags': [
124 '-g'
125 ],
126 "conditions": [
murgatroid99fd994f12015-10-09 14:02:28 -0700127 ['OS == "mac"', {
128 'xcode_settings': {
129 'MACOSX_DEPLOYMENT_TARGET': '10.9',
130 'OTHER_CFLAGS': [
131 '-std=c++11',
132 '-stdlib=libc++'
133 ]
134 }
135 }]
136 ],
137 "target_name": "grpc_node",
138 "sources": [
139 "src/node/ext/byte_buffer.cc",
140 "src/node/ext/call.cc",
141 "src/node/ext/call_credentials.cc",
142 "src/node/ext/channel.cc",
143 "src/node/ext/channel_credentials.cc",
144 "src/node/ext/completion_queue_async_worker.cc",
145 "src/node/ext/node_grpc.cc",
146 "src/node/ext/server.cc",
147 "src/node/ext/server_credentials.cc",
148 "src/node/ext/timeval.cc"
149 ],
150 "dependencies": [
151 "grpc"
152 ]
153 }
murgatroid992d6d3302015-09-21 13:29:40 -0700154 ]
155 }