Skip to content

Commit 5f69224

Browse files
committed
Merge #475: Add cmake, qt6, and bitcoin core submodule
67423ba build artifacts in CI (Matthew Zipkin) 1091c9f Update README for qt6 and cmake (Matthew Zipkin) 7573889 move qml/README to front page (Matthew Zipkin) c01451c build with cmake (Matthew Zipkin) 9020d75 include Bitcoin Core as a git submodule (Matthew Zipkin) 58f8d5a CRecipient now takes CTxDestination not CScript (Matthew Zipkin) 7d7f55f Use Txid instead of uint256 (Matthew Zipkin) c2ac37d listWalletDir() now returns vector of std::pair (Matthew Zipkin) 08f97b8 remove "watch only" -- no longer possible with descriptor wallets (Matthew Zipkin) b3d78ad options_model: #include chainstatemanager_args (Matthew Zipkin) 764cb5e update time offset from NodeStateStats (Matthew Zipkin) 3a98d9f copy qt/main.cpp and remove legacy GUI logic (Matthew Zipkin) a1e1ef8 bitcoin.cpp: rebase node initialization for upstream master (Matthew Zipkin) ee7928a Clean up Untranslated strings (Matthew Zipkin) 4a67da8 temporarily revert PeersNumByType (needs follow-up) (Matthew Zipkin) e0e235b nodemodel: copy ProxyAddress methods into qml/ (Matthew Zipkin) 4de5fd6 remove UPnP (Matthew Zipkin) 26042dd use fs::path::utf8string() (Matthew Zipkin) 947e7df update QSGRendererInterface strings (Matthew Zipkin) 92b5f03 use *CACHE constants from bitcoin core (Matthew Zipkin) 1140537 use FoundBlock() interface instead of removed getBlockTime() (Matthew Zipkin) 210439d icons: copy bitcoin.png into qml/ (Matthew Zipkin) ddc8293 bitcoin.cpp: replace LogPrint with LogDebug (Matthew Zipkin) 7fe6636 send: access declared property color (Matthew Zipkin) 6af46c5 Qt6 changed RegExpValidator to RegularExpressionValidator (Matthew Zipkin) 655d02f QQueue requires cast qtsizetype to int (Matthew Zipkin) 52599cd explicity capture `this` in lambdas as required by C++11 (Matthew Zipkin) 3643091 StorageLocations: Qt 6 FileDialog has slightly different properties (Matthew Zipkin) fb278ed Use QtQuick.Dialogs default version for Qt6 compatibility (Matthew Zipkin) Pull request description: This PR rebases the QML GUI code on upstream Bitcoin Core master, updates dependencies and build system, and defines a new organizational model for the project which may eventually lead to a separation of the GUI completely from bitcoin/bitcoin. # Code changes in `qml/` Each commit has a link to Qt docs or to a Bitcoin Core PR to explain it. QML code had to be updated to respect API changes and other conflicts: - Upstream master bitcoin/bitcoin - Qt6 # Git submodule Bitcoin core is now included as a git submodule. This is a cleaner model than forking the bitcoin core repo: - Prevent GUI contributors from creating new conflicts with upstream by changing bitcoin core in the forked repo - Garuntee that bitcoin core code is not modified, meaning we don't have to run upstream tests - Simplifies the build instructions and the repo itself to make it easier for front end contributors # Cmake Adds a cmake build system on top of the new submodule+`qml/` pair. We currently still need to compile upstream `qt/` and there is no flag to separate its library from its binary, so the result is that both GUIs will be built, but no command-line daemon, fuzz, tests, or utility binaries: ``` build/bin ├── bitcoin-core-app └── bitcoin-qt ``` **Note:** I'm going with the title "Bitcoin Core App" from the design community and to make even more clear the separation from `bitcoin-qt` # CI I added a very minimal CI to build binaries for macos and ubuntu, and upload the [artifacts](https://github.com/bitcoin-core/gui-qml/actions/runs/16242179284). This is mainly a "does it build?" test but I have downloaded and run both artifacts locally and they do work, given that the right linked libraries are available. Future work can make those artifacts more easily usable by testers. # Future work Obviously there is still a lot to do, but I consider these to be the next major steps: - GUI tests - Tests builds for all supported platforms - Extract `qt/` from upstream and integrate in this repo - Much of that code can probably be abandoned now - The build system can be cleaned up and the legacy binary removed from the output - Extract Qt depends build from upstream and integrate in this repo - After this, the upstream repo will be set up to clear out all GUI code - Figure out guix builds, guix attestations, project release process, and overall degree of separation from Bitcoin Core Top commit has no ACKs. Tree-SHA512: 25046860f1055a9e9d24e5d92ddefac81483f2c78dbc0adc40e69adb85535d719d2c7f976a2bc4b504fcf38288842f4e6b3722bc9d8c6a188a82d031bc690258
2 parents 39eb251 + 67423ba commit 5f69224

33 files changed

+538
-157
lines changed

.github/workflows/artifacts.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Copyright (c) 2025 The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
name: Artifacts
6+
on:
7+
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request.
8+
pull_request:
9+
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push.
10+
push:
11+
branches:
12+
- '**'
13+
tags-ignore:
14+
- '**'
15+
16+
jobs:
17+
build:
18+
runs-on: ${{matrix.os}}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [macos-14, ubuntu-22.04]
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: MacOS Install Deps
29+
if: contains(matrix.os, 'macos')
30+
run: |
31+
brew install cmake ccache boost pkgconf libevent qt@6 qrencode coreutils
32+
echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV"
33+
34+
- name: Ubuntu Install Deps
35+
if: contains(matrix.os, 'ubuntu')
36+
run: |
37+
sudo apt-get update && sudo apt-get install -y \
38+
build-essential ccache cmake pkgconf \
39+
libevent-dev libboost-dev libsqlite3-dev libgl-dev libqrencode-dev \
40+
qt6-base-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools \
41+
qt6-declarative-dev qml6-module-qtquick qml6-module-qtqml
42+
echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV"
43+
44+
- name: Restore Ccache cache
45+
uses: actions/cache/restore@v4
46+
id: ccache-cache
47+
with:
48+
path: ${{ env.CCACHE_DIR }}
49+
key: ${{ matrix.os }}-ccache-${{ github.run_id }}
50+
restore-keys: ${{ matrix.os }}-ccache-
51+
52+
- name: Build
53+
run: |
54+
git submodule update --init
55+
if [[ "${{ matrix.os }}" == macos* ]]; then
56+
export CPLUS_INCLUDE_PATH="$(brew --prefix boost)/include"
57+
export LIBRARY_PATH="$(brew --prefix boost)/lib"
58+
fi
59+
cmake -B build
60+
cmake --build build -j$(nproc)
61+
62+
- name: Save Ccache cache
63+
uses: actions/cache/save@v4
64+
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
65+
with:
66+
path: ${{ env.CCACHE_DIR }}
67+
key: ${{ matrix.os }}-ccache-${{ github.run_id }}
68+
69+
- uses: actions/upload-artifact@v4
70+
with:
71+
name: unsecure_${{ matrix.os }}_gui
72+
path: build/bin/bitcoin-core-app
73+

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Build subdirectories.
2+
/*build*
3+
!/build-aux
4+
!/build_msvc
5+
6+
*.pyc
7+
8+
/CMakeUserPresets.json

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "bitcoin"]
2+
path = bitcoin
3+
url = https://github.com/bitcoin/bitcoin

CMakeLists.txt

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
cmake_minimum_required(VERSION 3.22)
2+
3+
project(BitcoinCoreApp
4+
DESCRIPTION "Bitcoin GUI"
5+
HOMEPAGE_URL "https://bitcoincore.org/"
6+
LANGUAGES CXX
7+
)
8+
9+
# Language setup
10+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
11+
# We do not use the install_name_tool when cross-compiling for macOS.
12+
# So disable this tool check in further enable_language() commands.
13+
set(CMAKE_PLATFORM_HAS_INSTALLNAME FALSE)
14+
endif()
15+
16+
set(CMAKE_CXX_STANDARD 20)
17+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
18+
set(CMAKE_CXX_EXTENSIONS OFF)
19+
20+
# Set top-level target output locations.
21+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
22+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
23+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
24+
25+
# Include Find*.cmake files
26+
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
27+
28+
# Qt dependencies QML
29+
set(qt_components Core Gui LinguistTools Widgets Qml Quick QuickControls2)
30+
find_package(Qt 6.2 MODULE REQUIRED
31+
COMPONENTS ${qt_components}
32+
)
33+
find_package(Libevent 2.1.8 MODULE REQUIRED)
34+
35+
# Do not build any executable targets from bitcoin submodule
36+
set(BUILD_BENCH OFF)
37+
set(BUILD_BITCOIN_BIN OFF)
38+
set(BUILD_CLI OFF)
39+
set(BUILD_DAEMON OFF)
40+
set(BUILD_FOR_FUZZING OFF)
41+
set(BUILD_FUZZ_BINARY OFF)
42+
set(BUILD_GUI_TESTS OFF)
43+
set(BUILD_KERNEL_LIB OFF)
44+
set(BUILD_SHARED_LIBS OFF)
45+
set(BUILD_TESTS OFF)
46+
set(BUILD_TX OFF)
47+
set(BUILD_UTIL OFF)
48+
set(BUILD_UTIL_CHAINSTATE OFF)
49+
set(BUILD_WALLET_TOOL OFF)
50+
# We need this libraries, can ignore the executable bitcoin-qt
51+
set(BUILD_GUI ON)
52+
set(ENABLE_WALLET ON)
53+
54+
# Bitcoin Core codebase
55+
# Builds libraries: univalue, core_interface, bitcoin_node, bitcoin_wallet
56+
add_subdirectory(bitcoin)
57+
58+
# Qt-specific commands
59+
set(CMAKE_AUTOMOC ON)
60+
set(CMAKE_AUTOMOC_MOC_OPTIONS "-p${CMAKE_CURRENT_SOURCE_DIR}")
61+
set(CMAKE_AUTORCC ON)
62+
set(CMAKE_AUTOUIC ON)
63+
# but don't let Qt interfere with bitcoin core libraries
64+
set_target_properties(bitcoin_wallet PROPERTIES AUTOUIC OFF)
65+
66+
# Compile Qt+QML sources
67+
set(CMAKE_AUTOMOC_MOC_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/qml")
68+
file(GLOB_RECURSE QML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/qml/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/qml/*.h")
69+
list(FILTER QML_SOURCES EXCLUDE REGEX "androidnotifier\\.(cpp|h)$")
70+
set(QML_QRC "${CMAKE_CURRENT_SOURCE_DIR}/qml/bitcoin_qml.qrc")
71+
qt6_add_resources(QML_QRC_CPP ${QML_QRC})
72+
list(APPEND QML_SOURCES ${QML_QRC_CPP})
73+
list(APPEND QML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src/init/bitcoin-qt.cpp")
74+
75+
# Build QML library
76+
add_library(bitcoinqml STATIC ${QML_SOURCES})
77+
# Prevent Qt macros like "signal" from polluting bitcoin core code
78+
target_compile_definitions(bitcoinqml
79+
PUBLIC
80+
QT_NO_KEYWORDS
81+
QT_USE_QSTRINGBUILDER
82+
)
83+
target_include_directories(bitcoinqml
84+
PRIVATE
85+
# to keep the convention of #include <qml/*.h>
86+
${CMAKE_CURRENT_SOURCE_DIR}
87+
88+
# for interfaces consensus chainparams etc...
89+
${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src
90+
91+
# for qt/guiutil.h qt/peertablemodel.h qt/rpcconsole.h etc...
92+
${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src/qt
93+
94+
# for bitcoin-build-config.h
95+
${CMAKE_CURRENT_BINARY_DIR}/bitcoin/src
96+
)
97+
target_link_libraries(bitcoinqml
98+
PUBLIC
99+
core_interface
100+
bitcoin_node
101+
univalue
102+
Qt6::Qml
103+
Qt6::Quick
104+
Qt6::QuickControls2
105+
Qt6::Widgets
106+
)
107+
108+
# Put it all together
109+
add_executable(bitcoin-core-app main.cpp)
110+
target_include_directories(bitcoin-core-app
111+
PRIVATE
112+
# to keep the convention of #include <qml/*.h>
113+
${CMAKE_CURRENT_SOURCE_DIR}
114+
115+
# for interfaces compat util etc...
116+
${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src
117+
118+
# for bitcoin-build-config.h
119+
${CMAKE_CURRENT_BINARY_DIR}/bitcoin/src
120+
)
121+
target_link_libraries(bitcoin-core-app
122+
PRIVATE
123+
univalue
124+
core_interface
125+
bitcoin_node
126+
bitcoinqml
127+
bitcoinqt
128+
)

qml/README.md renamed to README.md

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
# Bitcoin Core QML GUI
1+
# Bitcoin Core App
2+
3+
*(The QML GUI)*
24

35
**WARNING: THIS IS EXPERIMENTAL, DO NOT USE BUILDS FROM THIS REPO FOR REAL TRANSACTIONS!**
46

5-
This directory contains the source code for an experimental Bitcoin Core graphical user interface (GUI) built using the [Qt Quick](https://doc.qt.io/qt-5/qtquick-index.html) framework.
7+
This directory contains the source code for an experimental Bitcoin Core graphical user interface (GUI) built using the [Qt Quick](https://doc.qt.io/qt-6/qtquick-index.html) framework.
68

7-
Unsecure CI artifacts are available for local testing of the master branch, avoiding the need to build. These can be found under the [Actions](https://github.com/bitcoin-core/gui-qml/actions?query=branch%3Amain) tab. It is required to have and be logged into a github account in order to download these.
9+
Unsecure CI artifacts are available for local testing of the master branch, avoiding the need to build. These can be found under the [Actions](https://github.com/bitcoin-core/gui-qml/actions?query=branch%3Aqt6) tab. It is required to have and be logged into a github account in order to download these.
810

911
Note: For macOS, the CI artifact binary must be made executable and code-signed before it can
1012
be ran. To make executable and apply a signature, run the following on the unzipped CI artifact:
1113

1214
```
13-
chmod +x ./Downloads/bitcoin-qt && codesign -s - ./Downloads/bitcoin-qt
15+
chmod +x ./Downloads/bitcoin-core-app && codesign -s - ./Downloads/bitcoin-core-app
1416
```
1517

1618
## Goals and Limitations
@@ -25,24 +27,22 @@ The primary goals of the project can be summed up as follows:
2527
- Work alongside the Bitcoin Design community to develop an aesthetic GUI
2628
- Develop a mobile-optimized GUI
2729

28-
We must avoid conflicts with the Bitcoin Core repo.
29-
As such, this project will aim to make very few changes outside of the qml directory.
30-
Pull requests must be focused on developing the GUI itself, adding build support,
31-
or improving relevant documentation.
30+
Avoid conflicts with the Bitcoin Core repository by importing it unmodified as a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
31+
As such, this project **can not** accept pull requests making any significant changes unrelated to the GUI.
32+
Pull requests must be focused on developing the GUI itself, adding build support, or improving relevant documentation.
3233

33-
This project will **not** accept pull requests making any significant changes unrelated to the GUI.
3434

3535
## Development Process
3636

37-
This repo is synced with the [Bitcoin Core repo](https://github.com/bitcoin/bitcoin) on a weekly basis, or as needed to resolve conflicts.
37+
This repo is synced with the [Bitcoin Core repo](https://github.com/bitcoin/bitcoin) on a regular basis.
3838

39-
Contributions are welcome from all, developers and designers. If you are a new contributor, please read [CONTRIBUTING.md](../../CONTRIBUTING.md).
39+
Contributions are welcome from all, developers and designers. If you are a new contributor, please read [CONTRIBUTING.md](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md).
4040

4141
### Minimum Required Qt Version
4242

43-
All development must adhere to the current upstream Qt Version to minimize our divergence from upstream and avoid costly changes. Review of open PR's must ensure that changes are compatible with this Qt version. Currently, the required version is [Qt 5.15.2](https://github.com/bitcoin-core/gui-qml/blob/main/depends/packages/qt.mk#L2).
43+
All development must adhere to the current upstream Qt Version to minimize our divergence from upstream and avoid costly changes. Review of open PR's must ensure that changes are compatible with this Qt version. Currently, the required version is [Qt 6.2](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md#build-1).
4444

45-
As the Qt Version changes upstream, refactoring is allowed to use the now available features.
45+
As the Qt Version changes upstream, refactoring is allowed to use the newly available features.
4646

4747
### Policies
4848

@@ -52,50 +52,69 @@ This project has custom policies for development, see:
5252

5353
## Compile and Run
5454

55-
The master branch is only guaranteed to work and build on Debian-based systems, Fedora, and macOS.
55+
The master branch is only guaranteed to work and build on Debian-based systems and macOS.
5656
Support for more systems will be confirmed and documented as the project matures.
5757

5858
### Dependencies
59-
No additional dependencies, besides those in [build-osx.md](../../doc/build-osx.md), are needed for macOS.
6059

61-
Aside from the dependencies listed in [build-unix.md](../../doc/build-unix.md), the following additional dependencies are required to compile:
60+
Bitcoin Core App requires all the same dependencies as Bitcoin Core, see the
61+
appropriate document for your platform:
62+
63+
- [build-osx.md](https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md)
64+
65+
- [build-unix.md](https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md)
66+
67+
In addition the following dependencies are required for the GUI:
6268

6369
#### Debian-based systems:
6470

6571
```
66-
sudo apt install qtdeclarative5-dev qtquickcontrols2-5-dev
72+
sudo apt install \
73+
qt6-base-dev \
74+
qt6-tools-dev \
75+
qt6-l10n-tools \
76+
qt6-tools-dev-tools \
77+
qt6-declarative-dev \
78+
qml6-module-qtquick \
79+
qml6-module-qtqml \
80+
libgl-dev \
81+
libqrencode-dev
6782
```
6883

69-
The following runtime dependencies are also required for dynamic builds;
70-
they are not needed for static builds:
84+
Additionally, to support Wayland protocol for modern desktop environments:
7185

7286
```
73-
sudo apt install qml-module-qtquick2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qt-labs-settings
87+
sudo apt install qt6-wayland
7488
```
75-
##### Important:
7689

77-
If you're unable to install the dependencies through your system's package manager, you can instead perform a [depends build](../../depends/README.md).
78-
79-
#### Fedora:
90+
#### macOS:
8091

8192
```
82-
sudo dnf install qt5-qtdeclarative-devel qt5-qtquickcontrols qt5-qtquickcontrols2-devel
93+
brew install qt@6 qrencode
8394
```
8495

8596
### Build
8697

87-
For instructions on how to build and compile Bitcoin Core, refer to your respective system's build doc.
88-
89-
As long as the required dependencies are installed, the qml GUI will be built.
90-
To ensure that you are in fact building the qml GUI, you can configure with the following option:
91-
98+
1. Install the required dependencies for your platform and clone the repository
99+
2. Fetch the Bitcoin Core submodule:
92100
```
93-
./configure --with-qml
101+
git submodule update --init
102+
```
103+
3. Configure
104+
```
105+
cmake -B build
106+
```
107+
4. Build
108+
```
109+
cmake --build build -j$(nproc)
94110
```
95111

96112
### Run
97113

98-
To run the qml GUI:
114+
Binaries are exported to the `build/` directory:
99115
```
100-
./src/qt/bitcoin-qt
116+
build/bin/bitcoin-core-app
101117
```
118+
119+
120+

bitcoin

Submodule bitcoin added at 8ffbd7b

0 commit comments

Comments
 (0)