Skip to content

Commit

Permalink
cmake [KILL 3-STATE]: Rename WITH_GUI to BUILD_GUI
Browse files Browse the repository at this point in the history
Also docs and CI scripts have been updated.
  • Loading branch information
hebasto committed May 1, 2024
1 parent 784fa3f commit 927a78d
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ jobs:
- name: Generate build system
run: |
cmake -B build --preset ${{ matrix.conf.preset }} -DWERROR=ON
cmake -B build --preset ${{ matrix.conf.preset }} -DBUILD_GUI=ON -DWERROR=ON
- name: Save vcpkg binary cache
uses: actions/cache/save@v4
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
# Configurable options.
# When adding a new option, end the <help_text> with a full stop for consistency.
option(BUILD_DAEMON "Build bitcoind executable." ON)
option(WITH_GUI "Build bitcoin-qt executable." OFF)
option(BUILD_GUI "Build bitcoin-qt executable." OFF)
option(BUILD_CLI "Build bitcoin-cli executable." ON)
option(BUILD_TX "Build bitcoin-tx executable." ON)
option(BUILD_UTIL "Build bitcoin-util executable." ON)
Expand Down Expand Up @@ -117,7 +117,7 @@ tristate_option(WITH_USDT
cmake_dependent_option(WITH_EXTERNAL_SIGNER "Enable external signer support." ON "NOT WIN32" OFF)
set(ENABLE_EXTERNAL_SIGNER ${WITH_EXTERNAL_SIGNER})

cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "WITH_GUI" OFF)
cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "BUILD_GUI" OFF)
if(WITH_QRENCODE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(libqrencode REQUIRED IMPORTED_TARGET libqrencode)
Expand All @@ -133,7 +133,7 @@ if(MULTIPROCESS)
endif()

option(BUILD_TESTS "Build test_bitcoin executable." ON)
cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "WITH_GUI;BUILD_TESTS" OFF)
cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_GUI;BUILD_TESTS" OFF)
option(BUILD_BENCH "Build bench_bitcoin executable." ON)
cmake_dependent_option(BUILD_FUZZ_BINARY "Build fuzz binary." ON "NOT MSVC" OFF)
cmake_dependent_option(FUZZ "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF)
Expand Down Expand Up @@ -178,7 +178,7 @@ if(FUZZ)
set(BUILD_UTIL_CHAINSTATE OFF)
set(BUILD_KERNEL_LIB OFF)
set(BUILD_WALLET_TOOL OFF)
set(WITH_GUI OFF)
set(BUILD_GUI OFF)
set(WITH_EXTERNAL_SIGNER OFF)
set(WITH_NATPMP OFF)
set(WITH_MINIUPNPC OFF)
Expand Down Expand Up @@ -571,7 +571,7 @@ message("Configure summary")
message("=================")
message("Executables:")
message(" bitcoind ............................ ${BUILD_DAEMON}")
message(" bitcoin-qt .......................... ${WITH_GUI}")
message(" bitcoin-qt .......................... ${BUILD_GUI}")
message(" bitcoin-cli ......................... ${BUILD_CLI}")
message(" bitcoin-tx .......................... ${BUILD_TX}")
message(" bitcoin-util ........................ ${BUILD_UTIL}")
Expand Down
6 changes: 3 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"rhs": "Darwin"
},
"cacheVariables": {
"WITH_GUI": "Qt5",
"BUILD_GUI": "ON",
"WITH_EXTERNAL_SIGNER": "ON"
}
},
Expand All @@ -57,7 +57,7 @@
"toolchainFile": "$env{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows",
"WITH_GUI": "Qt5",
"BUILD_GUI": "ON",
"WITH_QRENCODE": "OFF",
"WITH_NATPMP": "OFF"
}
Expand All @@ -75,7 +75,7 @@
"toolchainFile": "$env{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
"WITH_GUI": "Qt5",
"BUILD_GUI": "ON",
"WITH_QRENCODE": "OFF",
"WITH_NATPMP": "OFF"
}
Expand Down
4 changes: 2 additions & 2 deletions depends/toolchain.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ set(PKG_CONFIG_ARGN --static)

# Set configuration options for the main build system.
if("@no_qt@")
set(WITH_GUI OFF CACHE BOOL "")
set(BUILD_GUI OFF CACHE BOOL "")
else()
set(WITH_GUI ON CACHE BOOL "")
set(BUILD_GUI ON CACHE BOOL "")
endif()

if(NOT WITH_QRENCODE AND "@no_qr@" STREQUAL "1")
Expand Down
20 changes: 7 additions & 13 deletions doc/build-freebsd.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,28 @@ pkg install python3 databases/py-sqlite3
There are many ways to configure Bitcoin Core, here are a few common examples:

##### Descriptor Wallet and GUI:
This explicitly enables the GUI and disables legacy wallet support, assuming `sqlite` and `qt` are installed.
This disables legacy wallet support and enables the GUI, assuming `sqlite` and `qt` are installed.
```bash
mkdir build
cd build
cmake -S .. -DWITH_BDB=OFF -DWITH_GUI=Qt5
cmake -B build -DWITH_BDB=OFF -DBUILD_GUI=ON
```

Run `cmake .. -LH` to see the full list of available options.

##### Descriptor & Legacy Wallet. No GUI:
This enables support for both wallet types and disables the GUI, assuming
This enables support for both wallet types, assuming
`sqlite3` and `db4` are both installed.
```bash
mkdir build
cd build
cmake -S .. -DWITH_GUI=OFF -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include"
cmake -B build -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include"
```

##### No Wallet or GUI
```bash
mkdir build
cd build
cmake -S .. -DENABLE_WALLET=OFF -DWITH_GUI=OFF
cmake -B build -DENABLE_WALLET=OFF
```

### 2. Compile

```bash
cmake --build . # Use "-j N" for N parallel jobs.
ctest # Run tests if Python 3 is available. Use "-j N" for N parallel tests.
cmake --build build # Use "-j N" for N parallel jobs.
ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
```
8 changes: 4 additions & 4 deletions doc/build-openbsd.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ pkg_add install python # Select the newest version of the package.
There are many ways to configure Bitcoin Core, here are a few common examples:

##### Descriptor Wallet and GUI:
This enables the GUI and descriptor wallet support, assuming SQLite and Qt 5 are installed.
This enables descriptor wallet support and the GUI, assuming SQLite and Qt 5 are installed.

```bash
cmake -B build -DWITH_SQLITE=ON -DWITH_GUI=Qt5
cmake -B build -DWITH_SQLITE=ON -DBUILD_GUI=ON
```

Run `cmake -B build -LH` to see the full list of available options.

##### Descriptor & Legacy Wallet. No GUI:
This enables support for both wallet types and disables the GUI:
This enables support for both wallet types:

```bash
cmake -B build -DWITH_GUI=OFF -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include"
cmake -B build -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include"
```

### 2. Compile
Expand Down
31 changes: 12 additions & 19 deletions doc/build-osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,33 +176,26 @@ There are many ways to configure Bitcoin Core, here are a few common examples:

If `berkeley-db@4` is installed, then legacy wallet support will be built.
If `sqlite` is installed, then descriptor wallet support will also be built.
Additionally, this explicitly disables the GUI.

``` bash
mkdir build
cd build
cmake -S .. -DWITH_GUI=OFF
cmake -B build
```

##### Wallet (only SQlite) and GUI Support:

This explicitly enables the GUI and disables legacy wallet support.
This enables the GUI and disables legacy wallet support.
If `qt` is not installed, this will throw an error.
If `sqlite` is installed then descriptor wallet functionality will be built.
If `sqlite` is not installed, then wallet functionality will be disabled.

``` bash
mkdir build
cd build
cmake -S .. -DWITH_BDB=OFF -DWITH_GUI=Qt5
cmake -B build -DWITH_BDB=OFF -DBUILD_GUI=ON
```

##### No Wallet or GUI

``` bash
mkdir build
cd build
cmake -S .. -DENABLE_WALLET=OFF -DWITH_GUI=OFF
cmake -B build -DENABLE_WALLET=OFF
```

##### Further Configuration
Expand All @@ -211,7 +204,7 @@ You may want to dig deeper into the configuration options to achieve your desire
Examine the output of the following command for a full list of configuration options:

``` bash
cmake -S .. -LH
cmake -B build -LH
```

### 2. Compile
Expand All @@ -220,16 +213,16 @@ After configuration, you are ready to compile.
Run the following in your terminal to compile Bitcoin Core:

``` bash
cmake --build . # Use "-j N" here for N parallel jobs.
ctest # Run tests if Python 3 is available. Use "-j N" here for N parallel jobs.
cmake --build build # Use "-j N" here for N parallel jobs.
ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
```

### 3. Deploy (optional)

You can also create a `.zip` containing the `.app` bundle by running the following command:

``` bash
cmake --build . --target deploy
cmake --build build --target deploy
```

## Running Bitcoin Core
Expand Down Expand Up @@ -265,8 +258,8 @@ tail -f $HOME/Library/Application\ Support/Bitcoin/debug.log
## Other commands:

```shell
./src/bitcoind -daemon # Starts the bitcoin daemon.
./src/bitcoin-cli --help # Outputs a list of command-line options.
./src/bitcoin-cli help # Outputs a list of RPC commands when the daemon is running.
./src/qt/bitcoin-qt -server # Starts the bitcoin-qt server mode, allows bitcoin-cli control
./build/src/bitcoind -daemon # Starts the bitcoin daemon.
./build/src/bitcoin-cli --help # Outputs a list of command-line options.
./build/src/bitcoin-cli help # Outputs a list of RPC commands when the daemon is running.
./build/src/qt/bitcoin-qt -server # Starts the bitcoin-qt server mode, allows bitcoin-cli control
```
25 changes: 10 additions & 15 deletions doc/build-windows-msvc.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,24 @@ cmake --list-presets
## Building

CMake will put the resulting object files, libraries, and executables into a dedicated build directory.
This guide assumes that all commands are executed in build directory created like that:
```
mkdir build
cd build
```

In following istructions, the "Debug" configuration can be specified instead of the "Release" one.

### 4. Building with Dynamic Linking
### 4. Building with Dynamic Linking with GUI

```
cmake -S .. --preset vs2022 # It might take a while if the vcpkg binary cache is unpopulated or invalidated
cmake --build . --config Release
ctest --build-config Release
cmake -B build --preset vs2022 -DBUILD_GUI=ON # It might take a while if the vcpkg binary cache is unpopulated or invalidated.
cmake --build build --config Release # Use "-j N" for N parallel jobs.
ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
```

### 5. Building with Static Linking
### 5. Building with Static Linking without GUI

```
cmake -S .. --preset vs2022-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated
cmake --build . --config Release
ctest --build-config Release
cmake --install . --config Release # Optional
cmake -B build --preset vs2022-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated.
cmake --build build --config Release # Use "-j N" for N parallel jobs.
ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
cmake --install build --config Release # Optional.
```

## Performance Notes
Expand All @@ -77,7 +72,7 @@ cmake --install . --config Release # Optional
One can skip vcpkg manifest default features to speedup the configuration step.
For example, the following invocation will skip all features except for "wallet" and "tests" and their dependencies:
```
cmake -S .. --preset vs2022 -DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet;tests"
cmake -B build --preset vs2022 -DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet;tests" -DBUILD_GUI=OFF
```

Available features are listed in the [`vcpkg.json`](/vcpkg.json) file.
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ if(BUILD_UTIL)
endif()


if(WITH_GUI)
if(BUILD_GUI)
add_subdirectory(qt)
endif()

Expand Down

0 comments on commit 927a78d

Please sign in to comment.