From 23ea7b583d2d392446a9a05c45a6fdc81713f403 Mon Sep 17 00:00:00 2001 From: neodiX Date: Mon, 10 Jun 2024 00:30:43 +0200 Subject: [PATCH] use upgraded libsodium 1.0.20; use compiled static libsodium for Windows instead of precompiled; --- CMake/FindSodium.cmake | 16 +++++++++------- assembly/native/build-windows.bat | 7 ++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CMake/FindSodium.cmake b/CMake/FindSodium.cmake index 85194ee2f..c11e46f1d 100644 --- a/CMake/FindSodium.cmake +++ b/CMake/FindSodium.cmake @@ -37,12 +37,14 @@ if (NOT DEFINED SODIUM_USE_STATIC_LIBS) option(SODIUM_USE_STATIC_LIBS "enable to statically link against sodium" OFF) endif() if(NOT (SODIUM_USE_STATIC_LIBS EQUAL SODIUM_USE_STATIC_LIBS_LAST)) - unset(sodium_LIBRARY CACHE) - unset(SODIUM_LIBRARY_DEBUG CACHE) - unset(SODIUM_LIBRARY_RELEASE CACHE) - unset(sodium_DLL_DEBUG CACHE) - unset(sodium_DLL_RELEASE CACHE) - set(SODIUM_USE_STATIC_LIBS_LAST ${SODIUM_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable") + if (NOT SODIUM_LIBRARY_RELEASE) + unset(sodium_LIBRARY CACHE) + unset(SODIUM_LIBRARY_DEBUG CACHE) + unset(SODIUM_LIBRARY_RELEASE CACHE) + unset(sodium_DLL_DEBUG CACHE) + unset(sodium_DLL_RELEASE CACHE) + set(SODIUM_USE_STATIC_LIBS_LAST ${SODIUM_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable") + endif() endif() @@ -295,4 +297,4 @@ else() ) endif() endif() -endif() \ No newline at end of file +endif() diff --git a/assembly/native/build-windows.bat b/assembly/native/build-windows.bat index c22a98057..00367d0b5 100644 --- a/assembly/native/build-windows.bat +++ b/assembly/native/build-windows.bat @@ -80,8 +80,9 @@ echo Using secp256k1... if not exist "libsodium" ( git clone https://github.com/jedisct1/libsodium.git +git checkout 1.0.20-RELEASE cd libsodium\builds\msvc\vs2022\libsodium -msbuild libsodium.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v143 +msbuild libsodium.vcxproj /p:Configuration=ReleaseLIB /p:platform=x64 -p:PlatformToolset=v143 dir /s IF %errorlevel% NEQ 0 ( echo Can't download libsodium @@ -135,6 +136,10 @@ cd build cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^ -DPORTABLE=1 ^ -DSODIUM_USE_STATIC_LIBS=1 ^ +-DSODIUM_FOUND=1 ^ +-DSODIUM_LIBRARY_RELEASE=%root%\libsodium\bin\x64\Release\v143\static\libsodium.lib ^ +-DSODIUM_LIBRARY_DEBUG=%root%\libsodium\bin\x64\Release\v143\static\libsodium.lib ^ +-DSODIUM_INCLUDE_DIR=%root%\libsodium\src\libsodium\include ^ -DSECP256K1_FOUND=1 ^ -DSECP256K1_INCLUDE_DIR=%root%\secp256k1\include ^ -DSECP256K1_LIBRARY=%root%\secp256k1\build\src\Release\libsecp256k1.lib ^