diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2017-08-28 11:18:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 11:18:25 +0200 |
commit | f769bf12737bcff22b98b7265c5d4cd6c7bebd4d (patch) | |
tree | 818d9cf9583dbcf94b8c9958aa193e4f7c5c5da6 /tools | |
parent | ff4f2db4b978ea7264a4ab94711667456d017ed8 (diff) | |
parent | 07d2092c79147c4b01b03589105847535e10f533 (diff) |
Merge pull request #12264 from jtattermusch/cmake_vs2017
Add support for building with cmake+VS2017
Diffstat (limited to 'tools')
-rw-r--r-- | tools/run_tests/helper_scripts/pre_build_cmake.bat | 5 | ||||
-rwxr-xr-x | tools/run_tests/run_tests.py | 38 | ||||
-rwxr-xr-x | tools/run_tests/run_tests_matrix.py | 30 |
3 files changed, 36 insertions, 37 deletions
diff --git a/tools/run_tests/helper_scripts/pre_build_cmake.bat b/tools/run_tests/helper_scripts/pre_build_cmake.bat index a770aa8118..d89fc5fec2 100644 --- a/tools/run_tests/helper_scripts/pre_build_cmake.bat +++ b/tools/run_tests/helper_scripts/pre_build_cmake.bat @@ -14,7 +14,8 @@ setlocal -set ARCHITECTURE=%1 +set GENERATOR=%1 +set ARCHITECTURE=%2 cd /d %~dp0\..\..\.. @@ -27,7 +28,7 @@ cd build @rem If yasm is not on the path, use hardcoded path instead. yasm --version || set USE_HARDCODED_YASM_PATH_MAYBE=-DCMAKE_ASM_NASM_COMPILER="C:/Program Files (x86)/yasm/yasm.exe" -cmake -G "Visual Studio 14 2015" -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=ON %USE_HARDCODED_YASM_PATH_MAYBE% ../.. || goto :error +cmake -G %GENERATOR% -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=ON %USE_HARDCODED_YASM_PATH_MAYBE% ../.. || goto :error endlocal diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index d874b2a320..4311e53839 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -235,8 +235,10 @@ class CLanguage(object): self.config = config self.args = args if self.platform == 'windows': - _check_compiler(self.args.compiler, ['default', 'cmake']) + _check_compiler(self.args.compiler, ['default', 'cmake', 'cmake_vs2015', + 'cmake_vs2017']) _check_arch(self.args.arch, ['default', 'x64', 'x86']) + self._cmake_generator_option = 'Visual Studio 15 2017' if self.args.compiler == 'cmake_vs2017' else 'Visual Studio 14 2015' self._cmake_arch_option = 'x64' if self.args.arch == 'x64' else 'Win32' self._use_cmake = True self._make_options = [] @@ -363,11 +365,13 @@ class CLanguage(object): 'check_epollexclusive'] def make_options(self): - return self._make_options; + return self._make_options def pre_build_steps(self): if self.platform == 'windows': - return [['tools\\run_tests\\helper_scripts\\pre_build_cmake.bat', self._cmake_arch_option]] + return [['tools\\run_tests\\helper_scripts\\pre_build_cmake.bat', + self._cmake_generator_option, + self._cmake_arch_option]] elif self._use_cmake: return [['tools/run_tests/helper_scripts/pre_build_cmake.sh']] else: @@ -1205,7 +1209,7 @@ argp.add_argument('--compiler', 'node0.12', 'node4', 'node5', 'node6', 'node7', 'node8', 'electron1.3', 'electron1.6', 'coreclr', - 'cmake'], + 'cmake', 'cmake_vs2015', 'cmake_vs2017'], default='default', help='Selects compiler to use. Allowed values depend on the platform and language.') argp.add_argument('--iomgr_platform', @@ -1364,27 +1368,11 @@ _check_arch_option(args.arch) def make_jobspec(cfg, targets, makefile='Makefile'): if platform_string() == 'windows': - if makefile.startswith('cmake/build/'): - return [jobset.JobSpec(['cmake', '--build', '.', - '--target', '%s' % target, - '--config', _MSBUILD_CONFIG[cfg]], - cwd=os.path.dirname(makefile), - timeout_seconds=None) for target in targets] - extra_args = [] - # better do parallel compilation - # empirically /m:2 gives the best performance/price and should prevent - # overloading the windows workers. - extra_args.extend(['/m:2']) - # disable PDB generation: it's broken, and we don't need it during CI - extra_args.extend(['/p:Jenkins=true']) - return [ - jobset.JobSpec([_windows_build_bat(args.compiler), - 'vsprojects\\%s.sln' % target, - '/p:Configuration=%s' % _MSBUILD_CONFIG[cfg]] + - extra_args + - language_make_options, - shell=True, timeout_seconds=None) - for target in targets] + return [jobset.JobSpec(['cmake', '--build', '.', + '--target', '%s' % target, + '--config', _MSBUILD_CONFIG[cfg]], + cwd=os.path.dirname(makefile), + timeout_seconds=None) for target in targets] else: if targets and makefile.startswith('cmake/build/'): # With cmake, we've passed all the build configuration in the pre-build step already diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 7d26b284da..00680b02d3 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -209,16 +209,15 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args, inner_jobs=inner_jobs) - # portability C on Windows - for arch in ['x86', 'x64']: - test_jobs += _generate_jobs(languages=['c'], - configs=['dbg'], - platforms=['windows'], - arch=arch, - compiler='default', - labels=['portability', 'corelang'], - extra_args=extra_args, - inner_jobs=inner_jobs) + # portability C on Windows 64-bit (x86 is the default) + test_jobs += _generate_jobs(languages=['c'], + configs=['dbg'], + platforms=['windows'], + arch='x64', + compiler='default', + labels=['portability', 'corelang'], + extra_args=extra_args, + inner_jobs=inner_jobs) # portability C++ on Windows # TODO(jtattermusch): some of the tests are failing, so we force --build_only @@ -231,6 +230,17 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args + ['--build_only'], inner_jobs=inner_jobs) + # portability C and C++ on Windows using VS2017 (build only) + # TODO(jtattermusch): some of the tests are failing, so we force --build_only + test_jobs += _generate_jobs(languages=['c', 'c++'], + configs=['dbg'], + platforms=['windows'], + arch='x64', + compiler='cmake_vs2017', + labels=['portability', 'corelang'], + extra_args=extra_args + ['--build_only'], + inner_jobs=inner_jobs) + # C and C++ with the c-ares DNS resolver on Linux test_jobs += _generate_jobs(languages=['c', 'c++'], configs=['dbg'], platforms=['linux'], |