OLD | NEW |
(Empty) | |
| 1 This directory contains MS Visual Studio project & solution files. |
| 2 |
| 3 #Supported Visual Studio versions |
| 4 |
| 5 Currently supported versions are Visual Studio 2013 (our primary focus) and 2010
. |
| 6 |
| 7 #Building |
| 8 We are using [NuGet](http://www.nuget.org) to pull zlib and openssl dependencies
. |
| 9 If you don't have Visual Studio NuGet plugin installed, you'll need to |
| 10 download nuget.exe from the web and manually restore the NuGet packages. |
| 11 |
| 12 ``` |
| 13 > REM Run from this directory. |
| 14 > REM No need to do this if you have NuGet visual studio extension. |
| 15 > nuget restore grpc.sln |
| 16 ``` |
| 17 |
| 18 After that, you can build the solution using one of these options: |
| 19 1. open `grpc.sln` with Visual Studio and hit "Build". |
| 20 2. build from commandline using `msbuild grpc.sln /p:Configuration=Debug` |
| 21 |
| 22 #C/C++ Test Dependencies |
| 23 * gtest isn't available as a git repo like the other dependencies. download
it and add it to `/third_party/gtest/` (the folder will end up with `/build-aux/
`, `/cmake/`, `/codegear/`, etc. folders in it). |
| 24 * if using vs2013: open/import the gtest solution in `/msvc/`, and save over
the first solution (you will have to change it from read-only). change all pro
jects to use `/MDd` (Property Pages - C/C++ - Code Generation - Runtime Library)
and build. This is a "multithreaded debug" setting and it needs to match grpc. |
| 25 * build all |
| 26 * open protobuf solution in `/third_party/protobuf/vsprojects` |
| 27 * if using vs2013: on import the gtest stuff will probably fail, I think the
paths are interpreted wrong. it's ok. |
| 28 * tests and test_plugin will fail when built. also ok |
| 29 * build all |
| 30 * gflags is automatically imported as a git submodule but it needs to have C
Make run on it to be ready for a specific platform |
| 31 * download [CMake](http://www.cmake.org/) windows installer; install |
| 32 * open visual studio developer command prompt (not sure if dev command promp
t is necessary) |
| 33 * run `cmake <path to gtest directory>` |
| 34 * this will build a `.sln` and fill up the `/third_party/gflags/include/gfla
gs/` directory with headers |
| 35 * build all |
| 36 * install [NuGet](http://www.nuget.org) |
| 37 * nuget should automatically bring in built versions of zlib and openssl whe
n building grpc.sln (the versions in `/third_party/` are not used). If it doesn
't work use `tools->nuget...->manage...`. The packages are put in `/vsprojects/
packages/` |
| 38 |
| 39 #C/C++ Test Solution/Project Build Steps |
| 40 * A basic git version of grpc only has templates for non-test items. This ch
ecklist adds test items to grpc.sln and makes individual vs projects for them |
| 41 * set up dependencies (above) |
| 42 * add `"debug": true,` to the top of build.json. This is the base file for a
ll build tracking, see [templates](https://github.com/grpc/grpc/tree/master/temp
lates) for more information |
| 43 * `"debug": true,` gets picked up by `/tools/buildgen/plugins/generate_vspro
jects.py`. It tells the script to add visual studio GUIDs to all projects. Oth
erwise only the projects that already have GUIDs in build.json will be built |
| 44 * run `/templates/vsprojects/generate_debug_projects.sh` to make debug templa
tes/projects. This runs a regular visual studio buildgen process, which creates
the `.sln` file with all of the new debug projects, then uses git diff to find
the new project names from the `.sln` that need templates added. It builds the
new templates based on the diff, then re-runs the visual studio buildgen, which
builds the vs projects for each of the new debug targets |
| 45 * copy over the `/vsprojects/` folder to your windows build setup (assuming
this was built on linux in order to have easy access to python/mako and shell sc
ripts) |
| 46 * run `/templates/vsprojects/build_test_protos.sh` |
| 47 * this builds all `.proto` files in `/test/` in-place. there might be a bet
ter place to put them that mirrors what happens in the linux build process (todo
) |
| 48 * each `.proto` file gets built into a `.grpc.pb.cc`, .`grpc.pb.h`, `.pb.cc`
, and `.pb.h`. These are included in each test project in lieu of the `.proto`
includes specified in `build.json`. This substitution is done by `/templates/vs
projects/vcxproj_defs.include` |
| 49 * copy over the `/test/` folder in order to get the new files (assuming this
was built on linux in order to have an easy protobuf+grpc plugin installation) |
| 50 |
| 51 #Making and running tests with `/tools/run_tests/run_tests.py` or `/vsprojects/m
ake.bat` |
| 52 `run_tests.py` and `make.bat` both rely on `/vsprojects/grpc.mak`, an NMAKE scri
pt that includes C/C++ tests in addition to the base grpc projects. It builds t
he base projects by calling grpc.sln, but most things are built with a command l
ine similar to a makefile workflow. |
| 53 |
| 54 arguments for `/vsprojects/make.bat`: |
| 55 |
| 56 * no options or `all` or `buildtests`: builds all tests |
| 57 * `buildtests_c`: just c tests |
| 58 * `buildtests_cxx`: just c++ tests |
| 59 * names of individual tests: just those tests (example: `make.bat gpr_string_te
st`) |
| 60 |
| 61 using `run_tests.py` on windows: |
| 62 |
| 63 * when `run_tests.py` detects that it's running on windows it calls `make.bat`
to build the tests and expects to find tests in `/vsprojects/test_bins/` |
| 64 |
| 65 `run_tests.py` options: |
| 66 |
| 67 * `run_tests.py --help` |
| 68 * `run_tests.py -l c`: run c language tests |
| 69 * `run_tests.py -l c++`: run c++ language tests |
| 70 * note: `run_tests.py` doesn't normally show build steps, so if a build fails i
t is best to fall back to `make.bat` |
| 71 * if `make.bat` fails, it might be easier to open up the `.sln` file in the vis
ual studio gui (see above for how to build the test projects) and build the offe
nding test from its project file. The `.mak` and project file templates are sli
ghtly different, so it's possible that a project will build one way and not anot
her. Please report this if it happens. |
| 72 |
| 73 It can be helpful to disable the firewall when running tests so that 400 connect
ion warnings don't pop up. |
| 74 |
| 75 Individual tests can be run by directly running the executable in `/vsprojects/r
un_tests/` (this is `/bins/opt/` on linux). Many C tests have no output; they e
ither pass or fail internally and communicate this with their exit code (`0=pass
`, `nonzero=fail`) |
| 76 |
| 77 `run_tests.py` will fail if it can't build something, so not-building tests are
disabled with a "platforms = posix" note in build.json. The buildgen tools will
not add a test to a windows build unless it is marked "windows" or has no platf
orms identified. As tests are ported they will get this mark removed. |
| 78 |
| 79 # Building protoc plugins |
| 80 For generating service stub code, gRPC relies on plugins for `protoc` (the proto
col buffer compiler). The solution `grpc_protoc_plugins.sln` allows you to build |
| 81 Windows .exe binaries of gRPC protoc plugins. |
| 82 |
| 83 1. Follow instructions in `third_party\protobuf\cmake\README.md` to create Visua
l Studio 2013 projects for protobuf. |
| 84 ``` |
| 85 $ cd third_party/protobuf/cmake |
| 86 $ cmake -G "Visual Studio 12 2013" |
| 87 ``` |
| 88 |
| 89 2. Open solution `third_party\protobuf\cmake\protobuf.sln` and build it in Relea
se mode. That will build libraries `libprotobuf.lib` and `libprotoc.lib` needed
for the next step. |
| 90 |
| 91 3. Open solution `vsprojects\grpc_protoc_plugins.sln` and build it in Release mo
de. As a result, you should obtain a set of gRPC protoc plugin binaries (`grpc_c
pp_plugin.exe`, `grpc_csharp_plugin.exe`, ...) |
OLD | NEW |