diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/CMakeLists.txt.template | 11 | ||||
-rw-r--r-- | templates/Makefile.template | 2 | ||||
-rw-r--r-- | templates/config.m4.template | 5 | ||||
-rw-r--r-- | templates/config.w32.template | 5 | ||||
-rw-r--r-- | templates/gRPC-C++.podspec.template | 8 | ||||
-rw-r--r-- | templates/gRPC-Core.podspec.template | 21 | ||||
-rw-r--r-- | templates/gRPC-ProtoRPC.podspec.template | 23 | ||||
-rw-r--r-- | templates/gRPC.podspec.template | 10 | ||||
-rw-r--r-- | templates/grpc.gyp.template | 1 | ||||
-rwxr-xr-x | templates/src/csharp/build_packages_dotnetcli.bat.template | 1 | ||||
-rwxr-xr-x | templates/src/csharp/build_packages_dotnetcli.sh.template | 1 |
11 files changed, 71 insertions, 17 deletions
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 06adb33739..de13d02e2a 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -35,7 +35,7 @@ def get_deps(target_dict): deps = [] - if target_dict.get('baselib', False): + if target_dict.get('baselib', False) or target_dict['name'] == 'address_sorting': deps.append("${_gRPC_BASELIB_LIBRARIES}") if target_dict.get('build', None) in ['protoc']: deps.append("${_gRPC_PROTOBUF_PROTOC_LIBRARIES}") @@ -87,6 +87,7 @@ # Options option(gRPC_BUILD_TESTS "Build tests" OFF) option(gRPC_BUILD_CODEGEN "Build codegen" ON) + option(gRPC_BUILD_CSHARP_EXT "Build C# extensions" ON) set(gRPC_INSTALL_default ON) if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) @@ -168,6 +169,7 @@ include(cmake/gflags.cmake) include(cmake/benchmark.cmake) include(cmake/address_sorting.cmake) + include(cmake/nanopb.cmake) if(NOT MSVC) set(CMAKE_C_FLAGS "<%text>${CMAKE_C_FLAGS}</%text> -std=c99") @@ -297,6 +299,11 @@ if (gRPC_BUILD_TESTS) ${cc_library(lib)} endif (gRPC_BUILD_TESTS) + % elif lib.name in ['grpc_csharp_ext']: + if (gRPC_BUILD_CSHARP_EXT) + ${cc_library(lib)} + ${cc_install(lib)} + endif (gRPC_BUILD_CSHARP_EXT) % else: ${cc_library(lib)} % if not lib.build in ["tool"]: @@ -383,6 +390,7 @@ PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}</%text> + PRIVATE <%text>${_gRPC_NANOPB_INCLUDE_DIR}</%text> % if lib.build in ['test', 'private'] and lib.language == 'c++': PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest @@ -464,6 +472,7 @@ PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR}</%text> PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}</%text> + PRIVATE <%text>${_gRPC_NANOPB_INCLUDE_DIR}</%text> % if tgt.build in ['test', 'private'] and tgt.language == 'c++': PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest diff --git a/templates/Makefile.template b/templates/Makefile.template index caf6c12646..1027851b7b 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -227,8 +227,6 @@ % endif % endfor - DEFINES += PB_FIELD_16BIT - CPPFLAGS += $(CPPFLAGS_$(CONFIG)) CFLAGS += $(CFLAGS_$(CONFIG)) CXXFLAGS += $(CXXFLAGS_$(CONFIG)) diff --git a/templates/config.m4.template b/templates/config.m4.template index cc19d98375..19f9904911 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -11,11 +11,12 @@ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb) LIBS="-lpthread $LIBS" - CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_16BIT=1" - CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_16BIT=1" + CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_32BIT=1" + CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_32BIT=1" GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_REQUIRE_CXX() PHP_ADD_LIBRARY(pthread) diff --git a/templates/config.w32.template b/templates/config.w32.template index ef25e55596..5e37cf568c 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -23,13 +23,14 @@ EXTENSION("grpc", grpc_source, null, "/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+ "/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+ - "/DPB_FIELD_16BIT "+ + "/DPB_FIELD_32BIT "+ "/I"+configure_module_dirname+" "+ "/I"+configure_module_dirname+"\\include "+ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\zlib "+ - "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include"); + "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+ + "/I"+configure_module_dirname+"\\third_party\\nanopb"); <% dirs = {} for lib in libs: diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index 12d5fc17d4..2853bb63ab 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -196,9 +196,9 @@ end s.prepare_command = <<-END_OF_COMMAND - find src/cpp/ -type f -exec sed -E -i'.back' 's;#include "third_party/nanopb/(.*)";#include <nanopb/\\1>;g' {} \\\; - find src/cpp/ -name "*.back" -type f -delete - find src/core/ -regex ".*\.h" -type f -exec sed -E -i'.back' 's;#include "third_party/nanopb/(.*)";#include <nanopb/\\1>;g' {} \\\; - find src/core/ -name "*.back" -type f -delete + find src/cpp/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include <nanopb/\\1>;g' + find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm + 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 END_OF_COMMAND end diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index af97d81834..5098f351db 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -68,6 +68,14 @@ excl = grpc_private_files(libs) return [file for file in out if not file in excl] + def cfstream_private_headers(libs): + out = grpc_lib_files(libs, ("grpc_cfstream",), ("own_headers",)) + return out + + def cfstream_private_files(libs): + out = grpc_lib_files(libs, ("grpc_cfstream",), ("own_src", "own_headers")) + return out + def ruby_multiline_list(files, indent): return (',\n' + indent*' ').join('\'%s\'' % f for f in files) %> @@ -175,6 +183,16 @@ ss.private_header_files = ${ruby_multiline_list(grpc_private_headers(libs), 30)} end + s.subspec 'CFStream-Implementation' do |ss| + ss.header_mappings_dir = '.' + ss.dependency "#{s.name}/Implementation", version + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + ss.source_files = ${ruby_multiline_list(cfstream_private_files(filegroups), 22)} + ss.private_header_files = ${ruby_multiline_list(cfstream_private_headers(filegroups), 30)} + end + s.subspec 'Cronet-Interface' do |ss| ss.header_mappings_dir = 'include/grpc' ss.source_files = ${ruby_multiline_list(grpc_cronet_public_headers(libs), 22)} @@ -202,6 +220,7 @@ # TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path? s.prepare_command = <<-END_OF_COMMAND - find src/core/ -type f ! -path '*.back*' -exec sed -E -i'.back' 's;#include "third_party/nanopb/(.*)";#include <nanopb/\\1>;g' {} \\\; + 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 END_OF_COMMAND end diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index d2dcc429ef..96966784f1 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -43,12 +43,25 @@ s.header_dir = name src_dir = 'src/objective-c/ProtoRPC' - s.source_files = "#{src_dir}/*.{h,m}" - s.header_mappings_dir = "#{src_dir}" - s.dependency 'gRPC', version - s.dependency 'gRPC-RxLibrary', version - s.dependency 'Protobuf', '~> 3.0' + s.default_subspec = 'Main' + + s.subspec 'Main' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.dependency 'gRPC', version + ss.dependency 'gRPC-RxLibrary', version + ss.dependency 'Protobuf', '~> 3.0' + + ss.source_files = "#{src_dir}/*.{h,m}" + end + s.subspec 'CFStream' do |ss| + ss.dependency 'gRPC/CFStream', version + ss.dependency "#{s.name}/Main", version + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + end + s.pod_target_xcconfig = { # This is needed by all pods that depend on Protobuf: 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 6616e74bd7..a3190c2d8e 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -65,6 +65,16 @@ ss.dependency 'gRPC-Core', version end + # This subspec is mutually exclusive with the `Main` subspec + s.subspec 'CFStream' do |ss| + ss.dependency 'gRPC-Core/CFStream-Implementation', version + ss.dependency "#{s.name}/Main", version + + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + end + s.subspec 'GID' do |ss| ss.ios.deployment_target = '7.0' diff --git a/templates/grpc.gyp.template b/templates/grpc.gyp.template index 2ea0d06ebd..d71de9f441 100644 --- a/templates/grpc.gyp.template +++ b/templates/grpc.gyp.template @@ -70,6 +70,7 @@ '.', '../..', 'include', + '../../third_party/nanopb', ], 'defines': [ 'GRPC_ARES=0', diff --git a/templates/src/csharp/build_packages_dotnetcli.bat.template b/templates/src/csharp/build_packages_dotnetcli.bat.template index 1bf78c4d23..45010fec74 100755 --- a/templates/src/csharp/build_packages_dotnetcli.bat.template +++ b/templates/src/csharp/build_packages_dotnetcli.bat.template @@ -49,6 +49,7 @@ %%DOTNET% pack --configuration Release Grpc.Reflection --output ..\..\..\artifacts || goto :error %%NUGET% pack Grpc.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts || goto :error + %%NUGET% pack Grpc.Core.NativeDebug.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts %%NUGET% pack Grpc.Tools.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts @rem copy resulting nuget packages to artifacts directory diff --git a/templates/src/csharp/build_packages_dotnetcli.sh.template b/templates/src/csharp/build_packages_dotnetcli.sh.template index ddfea74744..1172582ebd 100755 --- a/templates/src/csharp/build_packages_dotnetcli.sh.template +++ b/templates/src/csharp/build_packages_dotnetcli.sh.template @@ -48,6 +48,7 @@ dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts nuget pack Grpc.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts + nuget pack Grpc.Core.NativeDebug.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts nuget pack Grpc.Tools.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) |