diff options
Diffstat (limited to 'vsprojects')
-rw-r--r-- | vsprojects/README.md | 65 | ||||
-rw-r--r-- | vsprojects/cpptest.props | 18 | ||||
-rw-r--r-- | vsprojects/global.props | 6 | ||||
-rw-r--r-- | vsprojects/grpc++/grpc++.vcxproj | 3 | ||||
-rw-r--r-- | vsprojects/grpc++/grpc++.vcxproj.filters | 6 | ||||
-rw-r--r-- | vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj | 3 | ||||
-rw-r--r-- | vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters | 6 | ||||
-rw-r--r-- | vsprojects/make.bat | 5 |
8 files changed, 96 insertions, 16 deletions
diff --git a/vsprojects/README.md b/vsprojects/README.md index dade9e500e..e6cbf83359 100644 --- a/vsprojects/README.md +++ b/vsprojects/README.md @@ -19,19 +19,62 @@ After that, you can build the solution using one of these options: 1. open `grpc.sln` with Visual Studio and hit "Build". 2. build from commandline using `msbuild grpc.sln /p:Configuration=Debug` -#Testing +#C/C++ Test Dependencies + * 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). + * 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 projects 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. + * build all + * open protobuf solution in `/third_party/protobuf/vsprojects` + * if using vs2013: on import the gtest stuff will probably fail, I think the paths are interpreted wrong. it's ok. + * tests and test_plugin will fail when built. also ok + * build all + * gflags is automatically imported as a git submodule but it needs to have CMake run on it to be ready for a specific platform + * download [CMake](http://www.cmake.org/) windows installer; install + * open visual studio developer command prompt (not sure if dev command prompt is necessary) + * run `cmake <path to gtest directory>` + * this will build a `.sln` and fill up the `/third_party/gflags/include/gflags/` directory with headers + * build all + * install [NuGet](http://www.nuget.org) + * nuget should automatically bring in built versions of zlib and openssl when 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/` -Use `run_tests.py`, that also supports Windows (with a bit limited experience). -``` -> REM Run from repository root. -> python tools\run_tests\run_tests.py -l c -``` +#C/C++ Test Solution/Project Build Steps + * A basic git version of grpc only has templates for non-test items. This checklist adds test items to grpc.sln and makes individual vs projects for them + * set up dependencies (above) + * add `"debug": true,` to the top of build.json. This is the base file for all build tracking, see [templates](https://github.com/grpc/grpc/tree/master/templates) for more information + * `"debug": true,` gets picked up by `/tools/buildgen/plugins/generate_vsprojects.py`. It tells the script to add visual studio GUIDs to all projects. Otherwise only the projects that already have GUIDs in build.json will be built + * run `/templates/vsprojects/generate_debug_projects.sh` to make debug templates/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 + * 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 scripts) + * run `/templates/vsprojects/build_test_protos.sh` + * this builds all `.proto` files in `/test/` in-place. there might be a better place to put them that mirrors what happens in the linux build process (todo) + * 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/vsprojects/vcxproj_defs.include` + * 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) -Also, you can `make.bat` directly to build and run gRPC tests. -``` -> REM Run from this directory. -> make.bat alarm_test -``` +#Making and running tests with `/tools/run_tests/run_tests.py` or `/vsprojects/make.bat` +`run_tests.py` and `make.bat` both rely on `/vsprojects/grpc.mak`, an NMAKE script that includes C/C++ tests in addition to the base grpc projects. It builds the base projects by calling grpc.sln, but most things are built with a command line similar to a makefile workflow. + + arguments for `/vsprojects/make.bat`: + + * no options or `all` or `buildtests`: builds all tests + * `buildtests_c`: just c tests + * `buildtests_cxx`: just c++ tests + * names of individual tests: just those tests (example: `make.bat gpr_string_test`) + +using `run_tests.py` on windows: + + * 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/` + +`run_tests.py` options: + + * `run_tests.py --help` + * `run_tests.py -l c`: run c language tests + * `run_tests.py -l c++`: run c++ language tests + * note: `run_tests.py` doesn't normally show build steps, so if a build fails it is best to fall back to `make.bat` + * if `make.bat` fails, it might be easier to open up the `.sln` file in the visual studio gui (see above for how to build the test projects) and build the offending test from its project file. The `.mak` and project file templates are slightly different, so it's possible that a project will build one way and not another. Please report this if it happens. + +It can be helpful to disable the firewall when running tests so that 400 connection warnings don't pop up. + +Individual tests can be run by directly running the executable in `/vsprojects/run_tests/` (this is `/bins/opt/` on linux). Many C tests have no output; they either pass or fail internally and communicate this with their exit code (`0=pass`, `nonzero=fail`) + +`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 platforms identified. As tests are ported they will get this mark removed. # Building protoc plugins For generating service stub code, gRPC relies on plugins for `protoc` (the protocol buffer compiler). The solution `grpc_protoc_plugins.sln` allows you to build diff --git a/vsprojects/cpptest.props b/vsprojects/cpptest.props new file mode 100644 index 0000000000..c5ffd54f99 --- /dev/null +++ b/vsprojects/cpptest.props @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\third_party\protobuf\src;$(ProjectDir)\..\..\third_party\gtest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <WarningLevel>EnableAllWarnings</WarningLevel> + </ClCompile> + <Link> + <AdditionalDependencies>grpc++_test_util.lib;grpc_test_util.lib;gpr_test_util.lib;gtestd.lib;gflags.lib;shlwapi.lib;gpr.lib;grpc.lib;grpc++.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(ProjectDir)\..\..\third_party\gtest\msvc\gtest\Debug;$(ProjectDir)\..\..\third_party\gflags\lib\Debug;$(ProjectDir)\..\Debug;$(ProjectDir)\..\packages\grpc.dependencies.openssl.1.0.2.2\build\native\lib\$(PlatformToolset)\$(Platform)\$(Configuration)\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemGroup /> +</Project> diff --git a/vsprojects/global.props b/vsprojects/global.props index 14acf4668b..6858bd7b9d 100644 --- a/vsprojects/global.props +++ b/vsprojects/global.props @@ -5,10 +5,10 @@ <PropertyGroup /> <ItemDefinitionGroup> <ClCompile> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\third_party\protobuf\src;$(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\third_party\protobuf\src;$(ProjectDir)\..\packages\grpc.dependencies.openssl.1.0.2.2\build\native\include;$(ProjectDir)\..\..\third_party\gflags\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WarningLevel>EnableAllWarnings</WarningLevel> </ClCompile> </ItemDefinitionGroup> <ItemGroup /> -</Project>
\ No newline at end of file +</Project> diff --git a/vsprojects/grpc++/grpc++.vcxproj b/vsprojects/grpc++/grpc++.vcxproj index 2d13bf046b..51b91c6434 100644 --- a/vsprojects/grpc++/grpc++.vcxproj +++ b/vsprojects/grpc++/grpc++.vcxproj @@ -159,6 +159,7 @@ <ClInclude Include="..\..\include\grpc++\config_protobuf.h" /> <ClInclude Include="..\..\include\grpc++\create_channel.h" /> <ClInclude Include="..\..\include\grpc++\credentials.h" /> + <ClInclude Include="..\..\include\grpc++\dynamic_thread_pool.h" /> <ClInclude Include="..\..\include\grpc++\fixed_size_thread_pool.h" /> <ClInclude Include="..\..\include\grpc++\generic_stub.h" /> <ClInclude Include="..\..\include\grpc++\impl\call.h" /> @@ -235,6 +236,8 @@ </ClCompile> <ClCompile Include="..\..\src\cpp\server\create_default_thread_pool.cc"> </ClCompile> + <ClCompile Include="..\..\src\cpp\server\dynamic_thread_pool.cc"> + </ClCompile> <ClCompile Include="..\..\src\cpp\server\fixed_size_thread_pool.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\server\insecure_server_credentials.cc"> diff --git a/vsprojects/grpc++/grpc++.vcxproj.filters b/vsprojects/grpc++/grpc++.vcxproj.filters index c5d8db57ae..85b743a8fb 100644 --- a/vsprojects/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/grpc++/grpc++.vcxproj.filters @@ -61,6 +61,9 @@ <ClCompile Include="..\..\src\cpp\server\create_default_thread_pool.cc"> <Filter>src\cpp\server</Filter> </ClCompile> + <ClCompile Include="..\..\src\cpp\server\dynamic_thread_pool.cc"> + <Filter>src\cpp\server</Filter> + </ClCompile> <ClCompile Include="..\..\src\cpp\server\fixed_size_thread_pool.cc"> <Filter>src\cpp\server</Filter> </ClCompile> @@ -132,6 +135,9 @@ <ClInclude Include="..\..\include\grpc++\credentials.h"> <Filter>include\grpc++</Filter> </ClInclude> + <ClInclude Include="..\..\include\grpc++\dynamic_thread_pool.h"> + <Filter>include\grpc++</Filter> + </ClInclude> <ClInclude Include="..\..\include\grpc++\fixed_size_thread_pool.h"> <Filter>include\grpc++</Filter> </ClInclude> diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj index f03715b353..6886bbc2a0 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -159,6 +159,7 @@ <ClInclude Include="..\..\include\grpc++\config_protobuf.h" /> <ClInclude Include="..\..\include\grpc++\create_channel.h" /> <ClInclude Include="..\..\include\grpc++\credentials.h" /> + <ClInclude Include="..\..\include\grpc++\dynamic_thread_pool.h" /> <ClInclude Include="..\..\include\grpc++\fixed_size_thread_pool.h" /> <ClInclude Include="..\..\include\grpc++\generic_stub.h" /> <ClInclude Include="..\..\include\grpc++\impl\call.h" /> @@ -222,6 +223,8 @@ </ClCompile> <ClCompile Include="..\..\src\cpp\server\create_default_thread_pool.cc"> </ClCompile> + <ClCompile Include="..\..\src\cpp\server\dynamic_thread_pool.cc"> + </ClCompile> <ClCompile Include="..\..\src\cpp\server\fixed_size_thread_pool.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\server\insecure_server_credentials.cc"> diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 8f7f3bcd5e..7f109a2557 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -46,6 +46,9 @@ <ClCompile Include="..\..\src\cpp\server\create_default_thread_pool.cc"> <Filter>src\cpp\server</Filter> </ClCompile> + <ClCompile Include="..\..\src\cpp\server\dynamic_thread_pool.cc"> + <Filter>src\cpp\server</Filter> + </ClCompile> <ClCompile Include="..\..\src\cpp\server\fixed_size_thread_pool.cc"> <Filter>src\cpp\server</Filter> </ClCompile> @@ -117,6 +120,9 @@ <ClInclude Include="..\..\include\grpc++\credentials.h"> <Filter>include\grpc++</Filter> </ClInclude> + <ClInclude Include="..\..\include\grpc++\dynamic_thread_pool.h"> + <Filter>include\grpc++</Filter> + </ClInclude> <ClInclude Include="..\..\include\grpc++\fixed_size_thread_pool.h"> <Filter>include\grpc++</Filter> </ClInclude> diff --git a/vsprojects/make.bat b/vsprojects/make.bat index 04737aeefc..08c97bcd21 100644 --- a/vsprojects/make.bat +++ b/vsprojects/make.bat @@ -5,6 +5,7 @@ setlocal @rem Set VS variables (uses Visual Studio 2013) @call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86 -nmake /f Grpc.mak %* +@rem /K: continue on error +nmake /K /f Grpc.mak %* exit /b %ERRORLEVEL% -endlocal
\ No newline at end of file +endlocal |