• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%YAML 1.2
2--- |
3  # GRPC GYP build file
4
5  # 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 gRPC authors.
11  #
12  # Licensed under the Apache License, Version 2.0 (the "License");
13  # you may not use this file except in compliance with the License.
14  # You may obtain a copy of the License at
15  #
16  #     http://www.apache.org/licenses/LICENSE-2.0
17  #
18  # Unless required by applicable law or agreed to in writing, software
19  # distributed under the License is distributed on an "AS IS" BASIS,
20  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  # See the License for the specific language governing permissions and
22  # limitations under the License.
23
24  {
25    'variables': {
26     # The openssl and zlib dependencies must be passed in as variables
27     # defined in an included gypi file, usually common.gypi.
28     'openssl_gyp_target%': 'Please Define openssl_gyp_target variable',
29     'zlib_gyp_target%': 'Please Define zlib_gyp_target variable',
30
31     'grpc_gcov%': 'false',
32     'grpc_alpine%': 'false',
33    },
34    'target_defaults': {
35      'configurations': {
36        % for name, args in configs.iteritems():
37        %  if name in ['dbg', 'opt']:
38        '${{'dbg':'Debug', 'opt': 'Release'}[name]}': {
39          % for arg, prop in [('CPPFLAGS', 'cflags'), ('DEFINES', 'defines')]:
40          %  if args.get(arg, None) is not None:
41          '${prop}': [
42            % for item in args.get(arg).split():
43            '${item}',
44            % endfor
45          ],
46          %  endif
47          % endfor
48        },
49        %  endif
50        % endfor
51      },
52      % for arg, prop in [('CPPFLAGS', 'cflags'), ('LDFLAGS', 'ldflags')]:
53      %  if defaults['global'].get(arg, None) is not None:
54      '${prop}': [
55        % for item in defaults['global'].get(arg).split():
56        '${item}',
57        % endfor
58      ],
59      %  endif
60      % endfor
61      'cflags_c': [
62        '-Werror',
63        '-std=c99',
64      ],
65      'cflags_cc': [
66        '-Werror',
67        '-std=c++11',
68      ],
69      'include_dirs': [
70        '.',
71        '../..',
72        'include',
73        '../../third_party/nanopb',
74      ],
75      'defines': [
76        'GRPC_ARES=0',
77      ],
78      'dependencies': [
79        '<(openssl_gyp_target)',
80        '<(zlib_gyp_target)',
81      ],
82      'conditions': [
83        ['grpc_gcov=="true"', {
84          % for arg, prop in [('CPPFLAGS', 'cflags'), ('DEFINES', 'defines'), ('LDFLAGS', 'ldflags')]:
85          %  if configs['gcov'].get(arg, None) is not None:
86          '${prop}': [
87            % for item in configs['gcov'].get(arg).split():
88            '${item}',
89            % endfor
90          ],
91          %  endif
92          % endfor
93        }],
94        ['grpc_alpine=="true"', {
95          'defines': [
96            'GPR_MUSL_LIBC_COMPAT'
97          ]
98        }],
99        ['OS == "win"', {
100          'defines': [
101            '_WIN32_WINNT=0x0600',
102            'WIN32_LEAN_AND_MEAN',
103            '_HAS_EXCEPTIONS=0',
104            'UNICODE',
105            '_UNICODE',
106            'NOMINMAX',
107          ],
108          'msvs_settings': {
109            'VCCLCompilerTool': {
110              'RuntimeLibrary': 1, # static debug
111            }
112          },
113          "libraries": [
114            "ws2_32"
115          ]
116        }],
117        ['OS == "mac"', {
118          'xcode_settings': {
119            % if defaults['global'].get('CPPFLAGS', None) is not None:
120            'OTHER_CFLAGS': [
121              % for item in defaults['global'].get('CPPFLAGS').split():
122              '${item}',
123              % endfor
124            ],
125            'OTHER_CPLUSPLUSFLAGS': [
126              % for item in defaults['global'].get('CPPFLAGS').split():
127              '${item}',
128              % endfor
129              '-stdlib=libc++',
130              '-std=c++11',
131              '-Wno-error=deprecated-declarations',
132            ],
133            % endif
134          },
135        }]
136      ]
137    },
138    'targets': [
139      % for lib in libs:
140      %  if getattr(lib, 'platforms', None) is None and lib.name != 'ares':
141      {
142        'target_name': '${lib.name}',
143        'type': 'static_library',
144        'dependencies': [
145          % for dep in getattr(lib, 'deps', []):
146          '${dep}',
147          % endfor
148        ],
149        'sources': [
150          % for source in lib.src:
151          '${source}',
152          % endfor
153        ],
154      },
155      %  endif
156      % endfor
157    ]
158  }
159