aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/CMakeLists.txt.template37
-rw-r--r--templates/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template2
-rw-r--r--templates/tools/dockerfile/csharp_deps.include7
3 files changed, 44 insertions, 2 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/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template b/templates/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template
index 8ce2a57323..774fc2c56f 100644
--- a/templates/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template
+++ b/templates/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs.template
@@ -73,7 +73,7 @@
'void grpcsharp_redirect_log(GprLogDelegate callback)',
'CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor)',
'void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails)',
- 'ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth)',
+ 'ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, SslClientCertificateRequestType clientCertificateRequest)',
'void grpcsharp_server_credentials_release(IntPtr credentials)',
'ServerSafeHandle grpcsharp_server_create(ChannelArgsSafeHandle args)',
'void grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq)',
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