• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo on
2
3SETLOCAL ENABLEDELAYEDEXPANSION
4
5SET BUILD_ROOT=%cd%
6SET PATH=C:\python36;C:\Program Files\cmake\bin;%PATH%
7SET SRC=%cd%\github\marl
8
9cd %SRC%
10if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
11
12git submodule update --init
13if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
14
15SET MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild"
16SET CONFIG=Release
17
18mkdir %SRC%\build
19cd %SRC%\build
20if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
21
22IF /I "%BUILD_SYSTEM%"=="cmake" (
23    cmake .. -G "%BUILD_GENERATOR%" "-DMARL_BUILD_TESTS=1" "-DMARL_BUILD_EXAMPLES=1" "-DMARL_BUILD_BENCHMARKS=1" "-DMARL_WARNINGS_AS_ERRORS=1"
24    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
25    %MSBUILD% /p:Configuration=%CONFIG% Marl.sln
26    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
27    Release\marl-unittests.exe
28    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
29    Release\fractal.exe
30    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
31    Release\primes.exe > nul
32    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
33) ELSE IF /I "%BUILD_SYSTEM%"=="bazel" (
34    REM Fix up the MSYS environment.
35    wget -q http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-7.3.0-2-any.pkg.tar.xz
36    wget -q http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-libs-7.3.0-2-any.pkg.tar.xz
37    c:\tools\msys64\usr\bin\bash --login -c "pacman -R --noconfirm catgets libcatgets"
38    c:\tools\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm"
39    c:\tools\msys64\usr\bin\bash --login -c "pacman -Sy --noconfirm mingw-w64-x86_64-crt-git patch"
40    c:\tools\msys64\usr\bin\bash --login -c "pacman -U --noconfirm mingw-w64-x86_64-gcc*-7.3.0-2-any.pkg.tar.xz"
41    set PATH=C:\tools\msys64\mingw64\bin;c:\tools\msys64\usr\bin;!PATH!
42    set BAZEL_SH=C:\tools\msys64\usr\bin\bash.exe
43
44    REM Install Bazel
45    SET BAZEL_DIR=!BUILD_ROOT!\bazel
46    mkdir !BAZEL_DIR!
47    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
48    wget -q https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-windows-x86_64.zip
49    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
50    unzip -q bazel-0.29.1-windows-x86_64.zip -d !BAZEL_DIR!
51    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
52
53    REM Build and run
54    !BAZEL_DIR!\bazel test //:tests --test_output=all
55    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
56    !BAZEL_DIR!\bazel run //examples:fractal
57    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
58    !BAZEL_DIR!\bazel run //examples:primes > nul
59    if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
60) ELSE (
61    echo "Unknown build system: %BUILD_SYSTEM%"
62    exit /b 1
63)
64