HomePhabricator

[CMAKE] Use static linkage when cross compiling for windows

Description

[CMAKE] Use static linkage when cross compiling for windows

Summary:
This will avoid the need to distribute dll files along with the
binaries.

Depends on D2653 and D2664

Test Plan:
Prerequisite:
Follow the doc/build-windows.md and depends/README.md documentation
and install the dependencies for i686-w64-mingw32 and
x86_64-w64-mingw32.

# 32-bit version
mkdir buildcmake && cd buildcmake
cmake -GNinja .. -DBUILD_BITCOIN_SEEDER=OFF \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Win32.cmake
ninja

Check the build succeeds.
Check src/bitcoind.exe runs as expected, without copying any dll.

Operate the same for Win64.

# 64-bit version
rm -rf *
cmake -GNinja .. -DBUILD_BITCOIN_SEEDER=OFF \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Win64.cmake
ninja

Check the build succeeds.
Check src/bitcoind.exe runs as expected, without copying any dll.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2666

Details

Provenance
FabienAuthored on Mar 7 2019, 12:58
FabienPushed on Mar 13 2019, 14:50
Reviewer
Restricted Project
Differential Revision
D2666: [CMAKE] Use static linkage when cross compiling for windows
Parents
rABCeedb9d2b4d0f: [CMAKE] Override the flags for the Debug CMake configuration
Branches
Unknown
Tags
Unknown