lgy514

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.https://hub.fastgit.org/grpc/grpc.git

2.补充thirdparty

git Submodule Update 

如果速度太慢可以更改 .gitmodules 然后再 git Submodule Update 

[submodule "third_party/zlib"]
    path = third_party/zlib
    url = https://gitclone.com/github.com/madler/zlib
    # When using CMake to build, the zlib submodule ends up with a
    # generated file that makes Git consider the submodule dirty. This
    # state can be ignored for day-to-day development on gRPC.
    ignore = dirty
[submodule "third_party/protobuf"]
    path = third_party/protobuf
    url = https://hub.fastgit.org/protocolbuffers/protobuf
[submodule "third_party/googletest"]
    path = third_party/googletest
    url = https://hub.fastgit.org/github.com/google/googletest.git
[submodule "third_party/benchmark"]
    path = third_party/benchmark
    url = https://gitclone.com/github.com/google/benchmark
[submodule "third_party/boringssl-with-bazel"]
    path = third_party/boringssl-with-bazel
    url = https://github.com/google/boringssl.git
[submodule "third_party/re2"]
    path = third_party/re2
    url = https://hub.fastgit.org/google/re2.git
[submodule "third_party/cares/cares"]
    path = third_party/cares/cares
    url = https://gitclone.com/github.com/c-ares/c-ares.git
    branch = cares-1_12_0
[submodule "third_party/bloaty"]
    path = third_party/bloaty
    url = https://gitclone.com/github.com/google/bloaty.git
[submodule "third_party/abseil-cpp"]
    path = third_party/abseil-cpp
    url = https://hub.fastgit.org/abseil/abseil-cpp.git
    branch = lts_2020_02_25
[submodule "third_party/envoy-api"]
    path = third_party/envoy-api
    url = https://gitclone.com/github.com/envoyproxy/data-plane-api.git
[submodule "third_party/googleapis"]
    path = third_party/googleapis
    url = https://hub.fastgit.org/googleapis/googleapis
[submodule "third_party/protoc-gen-validate"]
    path = third_party/protoc-gen-validate
    url = https://hub.fastgit.org/envoyproxy/protoc-gen-validate.git
[submodule "third_party/udpa"]
    path = third_party/udpa
    url = https://gitclone.com/github.com/cncf/udpa.git
[submodule "third_party/libuv"]
    path = third_party/libuv
    url = https://hub.fastgit.org/libuv/libuv
[submodule "third_party/opencensus-proto"]
    path = third_party/opencensus-proto
    url = https://hub.fastgit.org/census-instrumentation/opencensus-proto.git

如果不想麻烦源文件打包下载 : 

链接:https://pan.baidu.com/s/193q7oFRfPH3MHO9j0lrl0Q?pwd=s3dw
提取码:s3dw


3.perl go git nasm cmake安装


4.cmake

5.打开vs

6.右键 ->all_build ->生成

如果出现:无法打开包括文件: “openssl/x509.h”: No such file or directory

右键项目->属性->vc++目录->包含目录->添加 D:\work\grpc2\grpc\third_party\boringssl-with-bazel\include

 

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C1083 无法打开包括文件: “ares.h”: No such file or directory grpc D:\work\grpc2\grpc\src\core\ext\filters\client_channel\resolver\dns\c_ares\grpc_ares_wrapper.h 24

右键项目->属性->vc++目录->包含目录->添加 D:\work\grpc2\grpc\third_party\cares\cares

 

无法打开包括文件: “ares.h”: No such file or directory

右键项目->属性->vc++目录->包含目录->添加 D:\work\grpc2\grpc\third_party\cares

 

如果怕麻烦,这里有编译好的的bug版本 

链接:https://pan.baidu.com/s/1HTcz_lPzMrAgKfoILJ47Ug?pwd=q8nu
提取码:q8nu

 

7.运行例子

Cmakelist.txt

# Minimum CMake required
cmake_minimum_required(VERSION 3.15)

# Project
project(stringreverse)

set(CMAKE_PREFIX_PATH  
# ${CMAKE_CURRENT_SOURCE_DIR}
C:\\grpc\\bin
C:\\grpc\\lib
C:\\grpc\\cmake
C:\\grpc\\lib\\cmake\\grpc
)

include_directories("C:\\grpc\\include")
link_directories("C:\\grpc\\lib")
set(protosrc helloworld.grpc.pb.cc helloworld.pb.cc helloworld.grpc.pb.h helloworld.pb.h)
add_executable(client greeter_client.cc ${protosrc})
add_executable(server greeter_server.cc ${protosrc})
link_directories(
    C:\\grpc\\lib
)

set(libs_debug
    absl_bad_any_cast_impl.lib
    absl_bad_optional_access.lib
    absl_bad_variant_access.lib
    absl_base.lib
    absl_city.lib
    absl_civil_time.lib
    absl_cord.lib
    absl_cordz_functions.lib
    absl_cordz_handle.lib
    absl_cordz_info.lib
    absl_cordz_sample_token.lib
    absl_cord_internal.lib
    absl_debugging_internal.lib
    absl_demangle_internal.lib
    absl_examine_stack.lib
    absl_exponential_biased.lib
    absl_failure_signal_handler.lib
    absl_flags.lib
    absl_flags_commandlineflag.lib
    absl_flags_commandlineflag_internal.lib
    absl_flags_config.lib
    absl_flags_internal.lib
    absl_flags_marshalling.lib
    absl_flags_parse.lib
    absl_flags_private_handle_accessor.lib
    absl_flags_program_name.lib
    absl_flags_reflection.lib
    absl_flags_usage.lib
    absl_flags_usage_internal.lib
    absl_graphcycles_internal.lib
    absl_hash.lib
    absl_hashtablez_sampler.lib
    absl_int128.lib
    absl_leak_check.lib
    absl_leak_check_disable.lib
    absl_log_severity.lib
    absl_low_level_hash.lib
    absl_malloc_internal.lib
    absl_periodic_sampler.lib
    absl_random_distributions.lib
    absl_random_internal_distribution_test_util.lib
    absl_random_internal_platform.lib
    absl_random_internal_pool_urbg.lib
    absl_random_internal_randen.lib
    absl_random_internal_randen_hwaes.lib
    absl_random_internal_randen_hwaes_impl.lib
    absl_random_internal_randen_slow.lib
    absl_random_internal_seed_material.lib
    absl_random_seed_gen_exception.lib
    absl_random_seed_sequences.lib
    absl_raw_hash_set.lib
    absl_raw_logging_internal.lib
    absl_scoped_set_env.lib
    absl_spinlock_wait.lib
    absl_stacktrace.lib
    absl_status.lib
    absl_statusor.lib
    absl_strerror.lib
    absl_strings.lib
    absl_strings_internal.lib
    absl_str_format_internal.lib
    absl_symbolize.lib
    absl_synchronization.lib
    absl_throw_delegate.lib
    absl_time.lib
    absl_time_zone.lib
    address_sorting.lib
    cares.lib
    crypto.lib
    gpr.lib
    grpc++.lib
    grpc++_alts.lib
    grpc++_error_details.lib
    grpc++_reflection.lib
    grpc++_unsecure.lib
    grpc.lib
    grpcpp_channelz.lib
    grpc_plugin_support.lib
    grpc_unsecure.lib
    libprotobuf-lited.lib
    libprotobufd.lib
    libprotocd.lib
    re2.lib
    ssl.lib
    upb.lib
    zlibd.lib
    zlibstaticd.lib
    )

#set(CUR_LIB debug ${libs_debug} optimized ${libs_release})

target_link_libraries(client  ${libs_debug} )
target_link_libraries(server  ${libs_debug} )

复制zlibd.dll 到exe运行目录

执行exe文件

posted on 2022-01-13 15:31  lgy514  阅读(255)  评论(0编辑  收藏  举报