-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
49 lines (34 loc) · 1.31 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
param([string]$MingwBin)
$ErrorActionPreference = "stop"
$GOOGLETEST_VERSION_NUMBER = "1.10.0"
$GOOGLETEST_VERSION_REF = "release-" + $GOOGLETEST_VERSION_NUMBER
$env:Path = $MingwBin + ";" + $env:Path
$make = $(Join-Path "$MingwBin" "mingw32-make.exe")
$dist_parent_dir = $(Join-Path $(Resolve-Path "./") dist)
# the directory which will appear in the unzipped contents (i.e., the singular directory within the zip)
$dist_dir = $(Join-Path $dist_parent_dir ("googletest-g++-win-" + $GOOGLETEST_VERSION_NUMBER))
$packaging_dir = $(Join-Path $(Resolve-Path "./") packaging)
Remove-Item -Recurse -Force -ErrorAction Ignore googletest
Remove-Item -Recurse -Force -ErrorAction Ignore $dist_parent_dir
mkdir $dist_parent_dir
mkdir $dist_dir
git clone --branch $GOOGLETEST_VERSION_REF https://github.com/google/googletest.git
Set-Location googletest
mkdir build
Set-Location build
cmake ../ -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="$make" | Tee-Object -FilePath $dist_dir/manifest.txt
if ($LastExitCode -ne 0)
{
Exit 1
}
& $make -j 2>&1
if ($LastExitCode -ne 0)
{
Exit 1
}
mkdir $dist_dir/include
Copy-Item -r ./lib "$dist_dir/lib"
Copy-Item -r ../googletest/include/gtest $dist_dir/include/
Copy-Item -r ../googlemock/include/gmock $dist_dir/include/
Copy-Item $packaging_dir/install.bat $dist_dir/
Set-Location ../../