Page MenuHomePhabricator

[CMAKE] Fix bitcoin-qt cross compilation for Windows
Needs RevisionPublic

Authored by Fabien on Thu, Mar 7, 17:14.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

bitcoin-qt.exe will build but won't run due to missing QT5
dependencies.
This patch adds the required dependencies.

Depends on D2666

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 the generated src/qt/bitcoin-qt.exe binary runs as expected.

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 the generated src/qt/bitcoin-qt.exe binary runs as expected.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cmake_windows_bitcoin_qt
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 5208
Build 8479: Bitcoin ABC Teamcity Staging
Build 8478: arc lint + arc unit

Event Timeline

Fabien created this revision.Thu, Mar 7, 17:14
Herald added a reviewer: Restricted Project. · View Herald TranscriptThu, Mar 7, 17:14
Herald added a subscriber: schancel. · View Herald Transcript
deadalnix requested changes to this revision.Thu, Mar 7, 17:30
deadalnix added inline comments.
src/qt/CMakeLists.txt
157 ↗(On Diff #7634)

Please do the same as configure instead.

162 ↗(On Diff #7634)

Qt should provide target for these with proper dependencies and all.

This revision now requires changes to proceed.Thu, Mar 7, 17:30
Fabien updated this revision to Diff 7683.Tue, Mar 12, 12:33

Set QT_STATICPLUGIN for all static builds, improve libraries dependency

Fabien added inline comments.Tue, Mar 12, 12:35
src/qt/CMakeLists.txt
162 ↗(On Diff #7634)

Actually find_package searches for a Config.cmake suffix, and these files are only provided for high level modules.
These libs seems to be optional and not dependencies of the higher level modules, hence the find_library call.
Autotools solves it by using whether pkgconfig if enabled or AC_CHECK_LIB, which I believe is close to what find_library achieves.
There is room for improvement anyway, especially for working with older QT version (I only ported for version >= 5.8 here which can be too restrictive).

deadalnix requested changes to this revision.Tue, Mar 12, 20:08
deadalnix added inline comments.
src/qt/CMakeLists.txt
164

There is a variation of this for each plateform.

203

Why is that required ? If it is include on other plateform automatically, why isn't it on windows ? If it isn't, why is it necessary specifically on windows ?

162 ↗(On Diff #7634)

Qt should be able to set it's dependencies properly, or to provide target for these dependencies.

This revision now requires changes to proceed.Tue, Mar 12, 20:08