aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/CMakeLists.txt.template37
-rw-r--r--templates/README.md39
-rw-r--r--templates/gRPC-Core.podspec.template3
-rw-r--r--templates/src/objective-c/BoringSSL-GRPC.podspec.template5
-rw-r--r--templates/tools/dockerfile/csharp_deps.include7
-rw-r--r--templates/tools/dockerfile/interoptest/grpc_interop_dart/Dockerfile.template2
6 files changed, 58 insertions, 35 deletions
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
index 2a514ed7b6..1628493d00 100644
--- a/templates/CMakeLists.txt.template
+++ b/templates/CMakeLists.txt.template
@@ -88,6 +88,7 @@
option(gRPC_BUILD_TESTS "Build tests" OFF)
option(gRPC_BUILD_CODEGEN "Build codegen" ON)
option(gRPC_BUILD_CSHARP_EXT "Build C# extensions" ON)
+ option(gRPC_BACKWARDS_COMPATIBILITY_MODE "Build libraries that are binary compatible across a larger number of OS and libc versions" OFF)
set(gRPC_INSTALL_default ON)
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -164,6 +165,25 @@
set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf")
endif()
+ if(gRPC_BACKWARDS_COMPATIBILITY_MODE)
+ add_definitions(-DGPR_BACKWARDS_COMPATIBILITY_MODE)
+ if (_gRPC_PLATFORM_MAC)
+ # some C++11 constructs not supported before OS X 10.9
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
+ endif()
+ endif()
+
+ if (_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC)
+ # C core has C++ source code, but should not depend on libstc++ (for better portability).
+ # We need to use a few tricks to convince cmake to do that.
+ # https://stackoverflow.com/questions/15058403/how-to-stop-cmake-from-linking-against-libstdc
+ set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
+ # Exceptions and RTTI must be off to avoid dependency on libstdc++
+ set(_gRPC_CORE_NOSTDCXX_FLAGS -fno-exceptions -fno-rtti)
+ else()
+ set(_gRPC_CORE_NOSTDCXX_FLAGS "")
+ endif()
+
include(cmake/zlib.cmake)
include(cmake/cares.cmake)
include(cmake/protobuf.cmake)
@@ -403,7 +423,14 @@
PRIVATE <%text>${_gRPC_PROTO_GENS_DIR}</%text>
% endif
)
-
+ % if lib.language in ['c', 'csharp']:
+ # avoid dependency on libstdc++
+ if (_gRPC_CORE_NOSTDCXX_FLAGS)
+ set_target_properties(${lib.name} PROPERTIES LINKER_LANGUAGE C)
+ # only use the flags for C++ source files
+ target_compile_options(${lib.name} PRIVATE <%text>$<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}></%text>)
+ endif()
+ % endif
% if len(get_deps(lib)) > 0:
target_link_libraries(${lib.name}
% for dep in get_deps(lib):
@@ -492,6 +519,14 @@
${dep}
% endfor
)
+
+ % if tgt.language in ['c', 'csharp']:
+ # avoid dependency on libstdc++
+ if (_gRPC_CORE_NOSTDCXX_FLAGS)
+ set_target_properties(${tgt.name} PROPERTIES LINKER_LANGUAGE C)
+ target_compile_options(${tgt.name} PRIVATE <%text>$<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}></%text>)
+ endif()
+ % endif
% endif
</%def>
diff --git a/templates/README.md b/templates/README.md
index c837b5b260..a7aeec26c7 100644
--- a/templates/README.md
+++ b/templates/README.md
@@ -1,9 +1,13 @@
# Regenerating project files
-Prerequisites: `python`, `pip install mako`, `go`
+Prerequisites
+- `python`
+- `pip install mako` (the template processor)
+- `pip install pyyaml` (to read the yaml files)
+- `go` (required by boringssl dependency)
```
-# Regenerate the projects files using templates
+# Regenerate the projects files (and other generated files) using templates
tools/buildgen/generate_projects.sh
```
@@ -19,25 +23,13 @@ So instead we decided to work the following way:
targets and files needed to build grpc and its tests, as well as a basic system
for dependency description.
-* Each project file (Makefile, Visual Studio project files, Bazel's BUILD) is
-a [YAML](http://yaml.org) file used by the `build.yaml` file to generate the
-final output file.
+* Most of the build systems supported by gRPC (e.g. Makefile, cmake, XCode) have a template defined in this directory. The templates use the information from the `build.yaml` file to generate the project files specific to a given build system.
This way we can maintain as many project system as we see fit, without having
to manually maintain them when we add or remove new code to the repository.
Only the structure of the project file is relevant to the template. The actual
list of source code and targets isn't.
-We currently have template files for GNU Make, Visual Studio 2013,
-[Bazel](http://bazel.io) and [gyp](https://gyp.gsrc.io/) (albeit only for
-Node.js). In the future, we
-would like to expand to also generate [cmake](https://cmake.org)
-project files, XCode project files, and an Android.mk file allowing to compile
-gRPC using Android's NDK.
-
-We'll gladly accept contribution that'd create additional project files
-using that system.
-
# Structure of `build.yaml`
The `build.yaml` file has the following structure:
@@ -87,7 +79,6 @@ src: # list of files to compile
secure: boolean, # see below
baselib: boolean, # this is a low level library that has system
# dependencies
-vs_project_guid: '{...}', # Visual Studio's unique guid for that project
filegroups: # list of filegroups to merge to that project
# note that this will be expanded automatically
deps: # list of libraries this target depends on
@@ -95,12 +86,6 @@ deps_linkage: "..." # "static" or "dynamic". Used by the Makefile only to
# determine the way dependencies are linkned. Defaults
# to "dynamic".
dll: "..." # see below.
-dll_def: "..." # Visual Studio's dll definition file.
-vs_props: # List of property sheets to attach to that project.
-vs_config_type: "..." # DynamicLibrary/StaticLibrary. Used only when
- # creating a library. Specifies if we're building a
- # static library or a dll. Use in conjunction with `dll_def`.
-vs_packages: # List of nuget packages this project depends on.
```
## The `"build"` tag
@@ -137,23 +122,17 @@ protobuf is for `"c++"` ones.
## The `"dll"` tag
-Used only by Visual Studio's project files. "true" means the project will be
+Currently only used by cmake. "true" means the project will be
built with both static and dynamic runtimes. "false" means it'll only be built
with static runtime. "only" means it'll only be built with the dll runtime.
-## The `"dll_def"` tag
-
-Specifies the visual studio's dll definition file. When creating a DLL, you
-sometimes (not always) need a def file (see grpc.def).
-
# The template system
We're currently using the [mako templates](http://www.makotemplates.org/)
renderer. That choice enables us to simply render text files without dragging
with us a lot of other features. Feel free to explore the current templates
-in that directory. The simplest one is probably [BUILD.template](BUILD.template)
-which is used to create the [Bazel](http://bazel.io/) project file.
+in that directory.
## The renderer engine
diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template
index f912154301..98b6344a4b 100644
--- a/templates/gRPC-Core.podspec.template
+++ b/templates/gRPC-Core.podspec.template
@@ -174,7 +174,7 @@
ss.header_mappings_dir = '.'
ss.libraries = 'z'
ss.dependency "#{s.name}/Interface", version
- ss.dependency 'BoringSSL-GRPC', '0.0.1'
+ ss.dependency 'BoringSSL-GRPC', '0.0.2'
ss.dependency 'nanopb', '~> 0.3'
ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS'
@@ -223,5 +223,6 @@
s.prepare_command = <<-END_OF_COMMAND
find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include <nanopb/\\1>;g'
find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm
+ find src/core/ -type f \\( -path '*.h' -or -path '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <openssl/;#include <openssl_grpc/;g'
END_OF_COMMAND
end
diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template
index 986216fdbf..2b3bb8d97a 100644
--- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template
+++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template
@@ -43,7 +43,7 @@
Pod::Spec.new do |s|
s.name = 'BoringSSL-GRPC'
- version = '0.0.1'
+ version = '0.0.2'
s.version = version
s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google\'s needs.'
# Adapted from the homepage:
@@ -86,7 +86,7 @@
s.ios.deployment_target = '5.0'
s.osx.deployment_target = '10.7'
- name = 'openssl'
+ name = 'openssl_grpc'
# When creating a dynamic framework, name it openssl.framework instead of BoringSSL.framework.
# This lets users write their includes like `#include <openssl/ssl.h>` as opposed to `#include
@@ -1551,6 +1551,7 @@
sed -i'.back' '/^#define \\([A-Za-z0-9_]*\\) \\1/d' include/openssl/ssl.h
sed -i'.back' 'N;/^#define \\([A-Za-z0-9_]*\\) *\\\\\\n *\\1/d' include/openssl/ssl.h
sed -i'.back' 's/#ifndef md5_block_data_order/#ifndef GRPC_SHADOW_md5_block_data_order/g' crypto/fipsmodule/md5/md5.c
+ find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <openssl/;#include <openssl_grpc/;g'
END_OF_COMMAND
# Redefine symbols to avoid conflict when the same app also depends on OpenSSL. The list of
diff --git a/templates/tools/dockerfile/csharp_deps.include b/templates/tools/dockerfile/csharp_deps.include
index 3a40711e37..7ed0074867 100644
--- a/templates/tools/dockerfile/csharp_deps.include
+++ b/templates/tools/dockerfile/csharp_deps.include
@@ -15,3 +15,10 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y ${'\\'}
&& apt-get clean
RUN nuget update -self
+
+#=================
+# Use cmake 3.6 from jessie-backports
+# needed to build grpc_csharp_ext with cmake
+
+RUN echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
+RUN apt-get update && apt-get install -t jessie-backports -y cmake && apt-get clean
diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_dart/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_dart/Dockerfile.template
index 4fb7b4642d..34ea645cfa 100644
--- a/templates/tools/dockerfile/interoptest/grpc_interop_dart/Dockerfile.template
+++ b/templates/tools/dockerfile/interoptest/grpc_interop_dart/Dockerfile.template
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- FROM google/dart:latest
+ FROM google/dart:2.0
# Upgrade Dart to version 2.
RUN apt-get update && apt-get upgrade -y dart