From dd962616f2030f61f32ab7bfd7cb2e66f63e244f Mon Sep 17 00:00:00 2001 From: Maxim Dzoba Date: Wed, 16 Aug 2017 17:52:28 -0400 Subject: Adding a build template for generic GYP build. --- templates/grpc.gyp.template | 157 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 templates/grpc.gyp.template (limited to 'templates/grpc.gyp.template') diff --git a/templates/grpc.gyp.template b/templates/grpc.gyp.template new file mode 100644 index 0000000000..3363082a83 --- /dev/null +++ b/templates/grpc.gyp.template @@ -0,0 +1,157 @@ +%YAML 1.2 +--- | + # GRPC GYP build file + + # This file has been automatically generated from a template file. + # Please look at the templates directory instead. + # This file can be regenerated from the template by running + # tools/buildgen/generate_projects.sh + + # Copyright 2015 gRPC authors. + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + + { + 'variables': { + # The openssl and zlib dependencies must be passed in as variables + # defined in an included gypi file, usually common.gypi. + 'openssl_gyp_target%': 'Please Define openssl_gyp_target variable', + 'zlib_gyp_target%': 'Please Define zlib_gyp_target variable', + + 'grpc_gcov%': 'false', + 'grpc_alpine%': 'false', + }, + 'target_defaults': { + 'configurations': { + % for name, args in configs.iteritems(): + % if name in ['dbg', 'opt']: + '${{'dbg':'Debug', 'opt': 'Release'}[name]}': { + % for arg, prop in [('CPPFLAGS', 'cflags'), ('DEFINES', 'defines')]: + % if args.get(arg, None) is not None: + '${prop}': [ + % for item in args.get(arg).split(): + '${item}', + % endfor + ], + % endif + % endfor + }, + % endif + % endfor + }, + % for arg, prop in [('CPPFLAGS', 'cflags'), ('LDFLAGS', 'ldflags')]: + % if defaults['global'].get(arg, None) is not None: + '${prop}': [ + % for item in defaults['global'].get(arg).split(): + '${item}', + % endfor + ], + % endif + % endfor + 'cflags_c': [ + '-Werror', + '-std=c99' + ], + 'cflags_cc': [ + '-Werror', + '-std=c++11' + ], + 'include_dirs': [ + '.', + '../..', + 'include', + ], + 'defines': [ + 'GRPC_ARES=0', + ], + 'dependencies': [ + '<(openssl_gyp_target)', + '<(zlib_gyp_target)', + ], + 'conditions': [ + ['grpc_gcov=="true"', { + % for arg, prop in [('CPPFLAGS', 'cflags'), ('DEFINES', 'defines'), ('LDFLAGS', 'ldflags')]: + % if configs['gcov'].get(arg, None) is not None: + '${prop}': [ + % for item in configs['gcov'].get(arg).split(): + '${item}', + % endfor + ], + % endif + % endfor + }], + ['grpc_alpine=="true"', { + 'defines': [ + 'GPR_MUSL_LIBC_COMPAT' + ] + }], + ['OS == "win"', { + 'defines': [ + '_WIN32_WINNT=0x0600', + 'WIN32_LEAN_AND_MEAN', + '_HAS_EXCEPTIONS=0', + 'UNICODE', + '_UNICODE', + 'NOMINMAX', + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': 1, # static debug + } + }, + "libraries": [ + "ws2_32" + ] + }], + ['OS == "mac"', { + 'xcode_settings': { + % if defaults['global'].get('CPPFLAGS', None) is not None: + 'OTHER_CFLAGS': [ + % for item in defaults['global'].get('CPPFLAGS').split(): + '${item}', + % endfor + ], + 'OTHER_CPLUSPLUSFLAGS': [ + % for item in defaults['global'].get('CPPFLAGS').split(): + '${item}', + % endfor + '-stdlib=libc++', + '-std=c++11', + '-Wno-error=deprecated-declarations' + ], + % endif + }, + }] + ] + }, + 'targets': [ + % for lib in libs: + % if getattr(lib, 'platforms', None) is None and lib.name != 'ares': + { + 'target_name': '${lib.name}', + 'type': 'static_library', + 'dependencies': [ + % for dep in getattr(lib, 'deps', []): + '${dep}', + % endfor + ], + 'sources': [ + % for source in lib.src: + '${source}', + % endfor + ], + }, + % endif + % endfor + ] + } -- cgit v1.2.3