Skip to content

Commit

Permalink
Improve windows build (#921)
Browse files Browse the repository at this point in the history
* fix windows build

* exclude test-bigint execution on windows

---------

Co-authored-by: My Name <[email protected]>
  • Loading branch information
neodix42 and xqueezeme authored Mar 12, 2024
1 parent 79a75d5 commit 4969176
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion assembly/cicd/jenkins/test-builds.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pipeline {
timeout(time: 90, unit: 'MINUTES') {
bat '''
copy assembly\\native\\build-windows.bat .
build-windows.bat
build-windows.bat -t
'''
bat '''
cd artifacts
Expand Down
54 changes: 32 additions & 22 deletions assembly/native/build-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,26 @@ choco feature enable -n allowEmptyChecksums

echo Installing pkgconfiglite...
choco install -y pkgconfiglite
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't install pkgconfiglite
exit /b %errorlevel%
)

echo Installing ninja...
choco install -y ninja
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't install ninja
exit /b %errorlevel%
)

if not exist "zlib" (
git clone https://github.com/madler/zlib.git
cd zlib\contrib\vstudio\vc14
cd zlib
git checkout v1.3.1
cd contrib\vstudio\vc14
msbuild zlibstat.vcxproj /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v143

IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't install zlib
exit /b %errorlevel%
)
Expand All @@ -41,22 +43,28 @@ echo Using zlib...
)

if not exist "secp256k1" (
git clone https://github.com/libbitcoin/secp256k1.git
cd secp256k1\builds\msvc\vs2017
msbuild /p:Configuration=StaticRelease -p:PlatformToolset=v143 -p:Platform=x64
IF errorlevel 1 (
git clone https://github.com/bitcoin-core/secp256k1.git
cd secp256k1
git checkout v0.3.2
cmake -G "Visual Studio 17 2022" -A x64 -S . -B build -DSECP256K1_ENABLE_MODULE_RECOVERY=ON -DBUILD_SHARED_LIBS=OFF
IF %errorlevel% NEQ 0 (
echo Can't configure secp256k1
exit /b %errorlevel%
)
cmake --build build --config Release
IF %errorlevel% NEQ 0 (
echo Can't install secp256k1
exit /b %errorlevel%
)
cd ..\..\..\..
cd ..
) else (
echo Using secp256k1...
)


if not exist "libsodium" (
curl -Lo libsodium-1.0.18-stable-msvc.zip https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't download libsodium
exit /b %errorlevel%
)
Expand All @@ -67,7 +75,7 @@ echo Using libsodium...

if not exist "openssl-3.1.4" (
curl -Lo openssl-3.1.4.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/openssl-3.1.4.zip
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't download OpenSSL
exit /b %errorlevel%
)
Expand All @@ -78,7 +86,7 @@ echo Using openssl...

if not exist "libmicrohttpd-0.9.77-w32-bin" (
curl -Lo libmicrohttpd-0.9.77-w32-bin.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/libmicrohttpd-0.9.77-w32-bin.zip
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't download libmicrohttpd
exit /b %errorlevel%
)
Expand All @@ -89,7 +97,7 @@ echo Using libmicrohttpd...

if not exist "readline-5.0-1-lib" (
curl -Lo readline-5.0-1-lib.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/readline-5.0-1-lib.zip
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't download readline
exit /b %errorlevel%
)
Expand All @@ -110,18 +118,20 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^
-DSODIUM_USE_STATIC_LIBS=1 ^
-DSECP256K1_FOUND=1 ^
-DSECP256K1_INCLUDE_DIR=%root%\secp256k1\include ^
-DSECP256K1_LIBRARY=%root%\secp256k1\bin\x64\Release\v143\static\secp256k1.lib ^
-DSECP256K1_LIBRARY=%root%\secp256k1\build\src\Release\libsecp256k1.lib ^
-DMHD_FOUND=1 ^
-DMHD_LIBRARY=%root%\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static\libmicrohttpd.lib ^
-DMHD_INCLUDE_DIR=%root%\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static ^
-DZLIB_FOUND=1 ^
-DZLIB_INCLUDE_DIR=%root%\zlib ^
-DZLIB_LIBRARIES=%root%\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib ^
-DOPENSSL_FOUND=1 ^
-DOPENSSL_INCLUDE_DIR=%root%/openssl-3.1.4/x64/include ^
-DOPENSSL_CRYPTO_LIBRARY=%root%/openssl-3.1.4/x64/lib/libcrypto_static.lib ^
-DOPENSSL_INCLUDE_DIR=%root%\openssl-3.1.4\x64\include ^
-DOPENSSL_CRYPTO_LIBRARY=%root%\openssl-3.1.4\x64\lib\libcrypto_static.lib ^
-DREADLINE_INCLUDE_DIR=%root%\readline-5.0-1-lib\include ^
-DREADLINE_LIBRARY=%root%\readline-5.0-1-lib\lib\readline.lib ^
-DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj" ..
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't configure TON
exit /b %errorlevel%
)
Expand All @@ -133,31 +143,31 @@ json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-ha
test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont test-net ^
test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^
test-fec test-tddb test-db test-validator-session-state
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't compile TON
exit /b %errorlevel%
)
) else (
ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tonlib tonlibjson ^
tonlib-cli validator-engine lite-client pow-miner validator-engine-console generate-random-id ^
json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo Can't compile TON
exit /b %errorlevel%
)
)

copy validator-engine\validator-engine.exe test
IF errorlevel 1 (
IF %errorlevel% NEQ 0 (
echo validator-engine.exe does not exist
exit /b %errorlevel%
)

IF "%1"=="-t" (
echo Running tests...
REM ctest -C Release --output-on-failure -E "test-catchain|test-actors|test-validator-session-state"
ctest -C Release --output-on-failure --timeout 1800
IF errorlevel 1 (
ctest -C Release --output-on-failure -E "test-bigint" --timeout 1800
IF %errorlevel% NEQ 0 (
echo Some tests failed
exit /b %errorlevel%
)
Expand Down

0 comments on commit 4969176

Please sign in to comment.