@@ -47,8 +47,15 @@ install_headers(
4747# Due to the Meson bug in https://github.com/mesonbuild/meson/issues/14905
4848# we need to special how the grpc_cpp_plugin resolution is handled
4949# when found on the system versus when built as a subproject
50- grpc_cpp_dep = dependency (' grpc++' , allow_fallback : false , required : false )
51- has_system_grpc = grpc_cpp_dep.found()
50+ # On Windows we always need to use a subproject, because Meson cannot
51+ # accurately detect if the system provides a shared/static library, and the
52+ # shared grpc files do not export symbols properly
53+ if host_machine .system() == ' windows'
54+ has_system_grpc = false
55+ else
56+ grpc_cpp_dep = dependency (' grpc++' , allow_fallback : false , required : false )
57+ has_system_grpc = grpc_cpp_dep.found()
58+ endif
5259if not has_system_grpc
5360 grpc_opts = []
5461 if cpp_compiler.get_id() == ' msvc'
@@ -57,7 +64,8 @@ if not has_system_grpc
5764 ' re2:default_library=static' , # re2 does not export symbols
5865 ]
5966 endif
60- grpc_cpp_dep = dependency (' grpc++' , default_options : grpc_opts)
67+ grpc_subproject = subproject (' grpc' , default_options : grpc_opts)
68+ grpc_cpp_dep = grpc_subproject.get_variable (' grpcpp_dep' )
6169endif
6270
6371protobuf_dep = dependency (' protobuf' )
0 commit comments