[grpc-c++] sample cmake makefile for windows

1,183 views
Skip to first unread message

Selcuk Bozdag

unread,
Oct 31, 2017, 2:21:39 PM10/31/17
to grpc.io
Hi,

After getting grpc built on my Windows using VS2015, I created a proto file and generated a service code. However I could not manage to compile it. It is a bit because I'm not so familiar with MS tools. So I decided to get Cmake on stage and create a building script which looks much more reasonable to me. 

Has anyone in the group a working example of CMakeList file that successfully builds a gRPC c++ project on Windows? 

I would greatly appreciate for any help

Thanks

Jan Tattermusch

unread,
Nov 1, 2017, 8:29:50 AM11/1/17
to grpc.io
cmake is the official way to build gRPC on Windows - so we do have an official CMakeLists.txt file in our repository and we also have instructions how to build:

We do have tests running continously for cmake build, so you really should be able to build using that approach without issues.
I have some in-progress work to demonstrate how a simple C++ project that uses gRPC can be built on Windows - but it's not quite ready yet (we have such example for Helloworld C++ on linux here https://github.com/grpc/grpc/blob/master/examples/cpp/helloworld/CMakeLists.txt)

andrea....@gmail.com

unread,
Feb 27, 2018, 9:25:08 AM2/27/18
to grpc.io
Have you some news about the compilation of a simple C++ project using grpc on Windows?
Following the instruction I am able to compile the library itself but I am not able to compile the greeter_client/greeter_server examples.

I am able to compile the helloworld.proto, the generated helloworld.pb.cc and helloworld.grpc.pb.cc,  greeter_server.cc and greeter_client.cc but as soon as I try to link them to obtain the client and the server I find a lot of unresolved.

My linker command lines are:

link greeter_server.obj helloworld.pb.obj helloworld.grpc.pb.obj libprotobufd.lib libprotocd.lib grpc.lib gpr.lib grpc++.lib ws2_32.lib -LIBPATH:C:\grpc\.build\Debug -LIBPATH:C:\grpc\.build\third_party\protobuf\debug

link greeter_client.obj helloworld.pb.obj helloworld.grpc.pb.obj libprotobufd.lib libprotocd.lib grpc.lib gpr.lib grpc++.lib ws2_32.lib -LIBPATH:C:\grpc\.build\Debug -LIBPATH:C:\grpc\.build\third_party\protobuf\debug

What am I missing?
Reply all
Reply to author
Forward
0 new messages