2020-09-17 11:08:14 +00:00
$ErrorActionPreference = " Stop "
2020-09-15 12:47:30 +00:00
cd " $PSScriptRoot \.. "
2020-07-22 14:22:21 +00:00
2020-10-14 22:41:31 +00:00
if ( " $Env:FORCE_RELEASE " -Or " $Env:CIRCLE_TAG " ) {
2020-07-22 14:22:21 +00:00
New-Item prerelease . txt -type file
Write-Host " Building release version. "
}
2021-01-14 18:58:58 +00:00
else {
# Use last commit date rather than build date to avoid ending up with builds for
# different platforms having different version strings (and therefore producing different bytecode)
# if the CI is triggered just before midnight.
2020-07-08 18:09:49 +00:00
$last_commit_timestamp = git log -1 - -date = unix - -format = % cd HEAD
2021-01-14 18:58:58 +00:00
$last_commit_date = ( Get-Date -Date " 1970-01-01 00:00:00Z " ) . toUniversalTime ( ) . addSeconds ( $last_commit_timestamp ) . ToString ( " yyyy.M.d " )
-join ( " ci. " , $last_commit_date ) | out-file -encoding ascii prerelease . txt
}
2020-07-22 14:22:21 +00:00
2020-09-15 12:47:30 +00:00
mkdir build
cd build
$boost_dir = ( Resolve-Path $PSScriptRoot \ . . \ deps \ boost \ lib \ cmake \ Boost - * )
2021-09-16 19:40:00 +00:00
. . \ deps \ cmake \ bin \ cmake -G " Visual Studio 16 2019 " -DBoost_DIR = " $boost_dir \ " -DCMAKE_MSVC_RUNTIME_LIBRARY = MultiThreaded -DCMAKE_INSTALL_PREFIX = " $PSScriptRoot \..\upload " -DUSE_Z3 = OFF . .
2020-09-17 11:08:14 +00:00
if ( -not $ ? ) { throw " CMake configure failed. " }
2020-09-15 12:47:30 +00:00
msbuild solidity . sln / p: Configuration = Release / m: 5 / v: minimal
2020-09-17 11:08:14 +00:00
if ( -not $ ? ) { throw " Build failed. " }
2020-09-15 12:47:30 +00:00
. . \ deps \ cmake \ bin \ cmake - -build . -j 5 - -target install - -config Release
2020-09-17 11:08:14 +00:00
if ( -not $ ? ) { throw " Install target failed. " }