1
0
forked from cheng/wallet

I suffered greatly trying to get the libraries to build correctly

Because one has to separately specify build characteristics in
many different places it is quite difficult to make sure the right
things are linking the right things.

I added the two files msvc/winConfigDebug.bat msvc/winConfigRelease.bat
To build only the libaries that should be linked, so we will get an
error message if a release build links to a debug build.
This commit is contained in:
Cheng 2023-09-18 07:10:41 +10:00
parent 61aa3ff141
commit ac7f6806eb
No known key found for this signature in database
GPG Key ID: 571C3A9C3B9E6FCA
7 changed files with 201 additions and 10 deletions

@ -1 +1 @@
Subproject commit 5bfb49a8e40afe7aa349dd469bd11d9d76c71930 Subproject commit 914033d2c70831b86e94a25f27e61a94bc7d45c8

View File

@ -44,7 +44,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)wxWidgets\include\msvc;$(SolutionDir)wxWidgets\include;$(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mpir;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)wxWidgets\include\msvc;$(SolutionDir)wxWidgets\include;$(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mpir;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)wxWidgets\lib\vc_x64_lib\;$(SolutionDir)libsodium\Build\Debug\X64;$(SolutionDir)mpir\lib\x64\Debug;$(LibraryPath)</LibraryPath> <LibraryPath>$(SolutionDir)wxWidgets\lib\vc_x64_lib\;$(SolutionDir)libsodium\bin\x64\Debug\v143\static;$(SolutionDir)mpir\lib\x64\Debug;$(LibraryPath)</LibraryPath>
<CustomBuildAfterTargets /> <CustomBuildAfterTargets />
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
@ -52,7 +52,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)wxWidgets\include\msvc;$(SolutionDir)wxWidgets\include;$(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mpir;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)wxWidgets\include\msvc;$(SolutionDir)wxWidgets\include;$(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mpir;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)wxWidgets\lib\vc_x64_lib\;$(SolutionDir)libsodium\Build\Release\X64;$(SolutionDir)mpir\lib\x64\Release;$(LibraryPath)</LibraryPath> <LibraryPath>$(SolutionDir)wxWidgets\lib\vc_x64_lib\;$(SolutionDir)libsodium\bin\x64\Release\v143\static;$(SolutionDir)mpir\lib\x64\Release;$(LibraryPath)</LibraryPath>
<CustomBuildAfterTargets /> <CustomBuildAfterTargets />
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
@ -75,9 +75,8 @@
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalOptions> <AdditionalOptions> /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib</AdditionalOptions>
</AdditionalOptions> <AdditionalDependencies>mpir.lib;mpirxx.lib;libsodium.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>mpir.lib;mpirxx.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<Manifest> <Manifest>
<AdditionalManifestFiles>wallet.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles> <AdditionalManifestFiles>wallet.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
@ -115,7 +114,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>mpir.lib;mpirxx.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>mpir.lib;mpirxx.lib;libsodium.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions> /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
</Link> </Link>
<CustomBuildStep /> <CustomBuildStep />
<CustomBuildStep /> <CustomBuildStep />

View File

@ -114,7 +114,8 @@ echo off
IF %ERRORLEVEL% NEQ 0 ( IF %ERRORLEVEL% NEQ 0 (
echo failed unit test on debug build echo failed unit test on debug build
) ELSE ( ) ELSE (
echo passed unit test on debug build) echo passed unit test on debug build
)
echo on echo on
.\build\Release\wallet.exe --complete --test .\build\Release\wallet.exe --complete --test
echo off echo off

91
msvc/winConfigDebug.bat Normal file
View File

@ -0,0 +1,91 @@
echo as it is a bitch to make sure you are linking to the correct libraries, this batch Files
echo exists to make sure no other libraries are around
echo off
call C:\"Program Files (x86)"\"Microsoft Visual Studio"\2022\BuildTools\VC\Auxiliary\Build\vcvarsamd64_x86.bat
call C:\"Program Files"\"Microsoft Visual Studio"\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
del /Q build
del /Q libsodium\obj
del /Q libsodium\bin
del /Q libsodium\src\libsodium\include\sodium\version.h
cd mpir
del config.h
del gmp-mparam.h
del gmp.h
del /Q lib
del longlong.h
del mpir.h
del msvc\output_params.bat
del msvc\tmp.h
del /Q msvc\vs22\lib_mpir_cxx\x64
del /Q msvc\vs22\lib_mpir_gc\x64
del msvc\vs22\test-config.props
cd ..\wxWidgets
del /Q build\msw\vc_x64_mswu
del /Q build\msw\vc_x64_mswud
del /Q lib\vc_x64_lib
cd ..
echo check to see that everything is cleaned
echo off
git submodule foreach --recursive "git clean -xnf"
git clean -xnf
PAUSE
echo on
cd libsodium/builds/msvc/vs2022
msbuild libsodium.sln -p:Configuration=StaticDebug;Platform=x64 -m
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
echo on
cd ../../../..
cd mpir\msvc\vs22
call msbuild.bat gc lib x64 Debug
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
call msbuild.bat gc lib x64 Debug test
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
call msbuild.bat gc lib x64 Debug tune
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
echo on
cd ..\..\..
cd wxWidgets\build\msw
echo on
msbuild wx_vc17.sln -m -p:Configuration=Debug;Platform=x64;PlatformToolset=v143;WindowsTargetPlatformVersion=10.0
echo off
IF %ERRORLEVEL% NEQ 0 (
PAUSE
GOTO:EOF
)
cd ..\..\..
msbuild wallet.sln -p:Configuration=Debug;Platform=x64 -m
.\build\Debug\wallet.exe --complete --test
echo off
IF %ERRORLEVEL% NEQ 0 (
echo failed unit test on debug build
) ELSE (
echo passed unit test on debug build
)

100
msvc/winConfigRelease.bat Normal file
View File

@ -0,0 +1,100 @@
echo as it is a bitch to make sure you are linking to the correct libraries, this batch Files
echo exists to make sure no other libraries are around
echo off
call C:\"Program Files (x86)"\"Microsoft Visual Studio"\2022\BuildTools\VC\Auxiliary\Build\vcvarsamd64_x86.bat
call C:\"Program Files"\"Microsoft Visual Studio"\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
del /Q build
del /Q libsodium\obj
del /Q libsodium\bin
del /Q libsodium\src\libsodium\include\sodium\version.h
cd mpir
del config.h
del gmp-mparam.h
del gmp.h
del /Q lib
del longlong.h
del mpir.h
del msvc\output_params.bat
del msvc\tmp.h
del /Q msvc\vs22\lib_mpir_cxx\x64
del /Q msvc\vs22\lib_mpir_gc\x64
del msvc\vs22\test-config.props
cd ..\wxWidgets
del /Q build\msw\vc_x64_mswu
del /Q build\msw\vc_x64_mswud
del /Q lib\vc_x64_lib
cd ..
echo check to see that everything is cleaned
echo off
git submodule foreach --recursive "git clean -xnf"
git clean -xnf
PAUSE
echo on
cd libsodium/builds/msvc/vs2022
msbuild libsodium.sln -p:Configuration=StaticRelease;Platform=x64 -m
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
cd ../../../..
cd mpir\msvc\vs22
echo on
call msbuild.bat gc lib x64 Release
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
call msbuild.bat gc lib x64 Release test
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
call msbuild.bat gc lib x64 Release tune
echo off
IF %ERRORLEVEL% NEQ 0 (
cd ..
PAUSE
GOTO:EOF
)
echo on
cd ..\..\..
cd wxWidgets\build\msw
msbuild wx_vc17.sln -m -p:Configuration=Release;Platform=x64;PlatformToolset=v143;WindowsTargetPlatformVersion=10.0
echo off
IF %ERRORLEVEL% NEQ 0 (
PAUSE
GOTO:EOF
)
echo on
msbuild wx_vc17.sln -m -p:Configuration=Debug;Platform=x64;PlatformToolset=v143;WindowsTargetPlatformVersion=10.0
echo off
IF %ERRORLEVEL% NEQ 0 (
PAUSE
GOTO:EOF
)
echo on
cd ..\..\..
msbuild wallet.sln -p:Configuration=Release;Platform=x64 -m
echo off
IF %ERRORLEVEL% NEQ 0 (
PAUSE
GOTO:EOF
)
echo on
.\build\Release\wallet.exe --complete --test
echo off
IF %ERRORLEVEL% NEQ 0 (
echo failed unit test on release build
) ELSE (
echo passed unit test on release build
)

View File

@ -82,7 +82,6 @@ std::span<uint8_t>& operator^=(std::span<byte>&, byte *);
#define SODIUM_STATIC 1 #define SODIUM_STATIC 1
#include <sodium.h> #include <sodium.h>
#include <mpir.h> #include <mpir.h>
#pragma comment(lib, "libsodium.lib")
inline wxString _wx(const char* sz) { return wxString::FromUTF8Unchecked(sz); } inline wxString _wx(const char* sz) { return wxString::FromUTF8Unchecked(sz); }
#include "introspection_of_standard_C_types.h" #include "introspection_of_standard_C_types.h"
// This header file turns off deprecation of array type compares, because // This header file turns off deprecation of array type compares, because

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148 VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wallet", "msvc/wallet.vcxproj", "{B1EC18D5-FA70-4A59-8CAE-EDC65A358314}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wallet", "msvc\wallet.vcxproj", "{B1EC18D5-FA70-4A59-8CAE-EDC65A358314}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2F7D488C-DC53-4ECE-87E2-4FEA32C153EF}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2F7D488C-DC53-4ECE-87E2-4FEA32C153EF}"
EndProject EndProject