Page MenuHomePhabricator

[CMAKE] Avoid displaying the console when launching bitcoin-qt.exe
ClosedPublic

Authored by Fabien on Mar 12 2019, 12:40.

Details

Summary

This adds a flag which prevents displaying the console when running
bitcoin-qt.exe.

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.
Ensure there is no console display when running the exe.

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.
Ensure there is no console display when running the exe.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Mar 12 2019, 15:25
deadalnix requested changes to this revision.Mar 14 2019, 02:45
deadalnix added inline comments.
src/qt/CMakeLists.txt
164 ↗(On Diff #7684)

How this isn't windows only ? What is configure doing ?

This revision now requires changes to proceed.Mar 14 2019, 02:45
Fabien requested review of this revision.Mar 14 2019, 07:08
Fabien added inline comments.
src/qt/CMakeLists.txt
164 ↗(On Diff #7684)

Yes, this is windows only.

Configure does the same in bitcoin_qt.m4:

case $host in
# [...]
*mingw*)
     BITCOIN_QT_CHECK([
       AX_CHECK_LINK_FLAG([[-mwindows]],[QT_LDFLAGS="$QT_LDFLAGS -mwindows"],[AC_MSG_WARN(-mwindows linker support not detected)])
     ])
esac
This revision is now accepted and ready to land.Mar 27 2019, 02:26

I discovered by chance that cmake targets have a property which does exactly the same
(setting the exact same flag) in a more cmake fashion way.
This property has no impact if the build is not a windows executable, so no need to
make it explicitely windows only.

Fabien requested review of this revision.Apr 24 2019, 13:46
This revision is now accepted and ready to land.Apr 24 2019, 16:03

From the cmake mailing list, this tends to confirm that this property has no impact outside of a windows build: https://cmake.org/pipermail/cmake/2008-March/020577.html