• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:: Copyright (c) 2018 Google LLC.
2::
3:: Licensed under the Apache License, Version 2.0 (the "License");
4:: you may not use this file except in compliance with the License.
5:: You may obtain a copy of the License at
6::
7::     http://www.apache.org/licenses/LICENSE-2.0
8::
9:: Unless required by applicable law or agreed to in writing, software
10:: distributed under the License is distributed on an "AS IS" BASIS,
11:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12:: See the License for the specific language governing permissions and
13:: limitations under the License.
14::
15:: Windows Build Script.
16
17@echo on
18
19set BUILD_ROOT=%cd%
20set SRC=%cd%\github\SPIRV-Tools
21set BUILD_TYPE=%1
22set VS_VERSION=%2
23
24:: Force usage of python 2.7 rather than 3.6
25set PATH=C:\python27;%PATH%
26
27cd %SRC%
28git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers
29git clone --depth=1 https://github.com/google/googletest          external/googletest
30git clone --depth=1 https://github.com/google/effcee              external/effcee
31git clone --depth=1 https://github.com/google/re2                 external/re2
32
33:: #########################################
34:: set up msvc build env
35:: #########################################
36if %VS_VERSION% == 2017 (
37  call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
38  echo "Using VS 2017..."
39) else if %VS_VERSION% == 2015 (
40  call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
41  echo "Using VS 2015..."
42) else if %VS_VERSION% == 2013 (
43  call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
44  echo "Using VS 2013..."
45)
46
47cd %SRC%
48mkdir build
49cd build
50
51:: #########################################
52:: Start building.
53:: #########################################
54echo "Starting build... %DATE% %TIME%"
55if "%KOKORO_GITHUB_COMMIT%." == "." (
56  set BUILD_SHA=%KOKORO_GITHUB_PULL_REQUEST_COMMIT%
57) else (
58  set BUILD_SHA=%KOKORO_GITHUB_COMMIT%
59)
60
61:: Skip building tests for VS2013
62if %VS_VERSION% == 2013 (
63  cmake -GNinja -DSPIRV_SKIP_TESTS=ON -DSPIRV_BUILD_COMPRESSION=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=install -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ..
64) else (
65  cmake -GNinja -DSPIRV_BUILD_COMPRESSION=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=install -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ..
66)
67
68if %ERRORLEVEL% GEQ 1 exit /b %ERRORLEVEL%
69
70echo "Build everything... %DATE% %TIME%"
71ninja
72if %ERRORLEVEL% GEQ 1 exit /b %ERRORLEVEL%
73echo "Build Completed %DATE% %TIME%"
74
75:: ################################################
76:: Run the tests (We no longer run tests on VS2013)
77:: ################################################
78if NOT %VS_VERSION% == 2013 (
79  echo "Running Tests... %DATE% %TIME%"
80  ctest -C %BUILD_TYPE% --output-on-failure --timeout 300
81  if %ERRORLEVEL% GEQ 1 exit /b %ERRORLEVEL%
82  echo "Tests Completed %DATE% %TIME%"
83)
84
85:: Clean up some directories.
86rm -rf %SRC%\build
87rm -rf %SRC%\external
88
89exit /b %ERRORLEVEL%
90
91