From d06252f2ca26c5373a0b8f48d868832f579bc549 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 1 May 2024 21:32:01 +0100 Subject: [PATCH 1/2] cmake [KILL 3-STATE]: Make WITH_GUI binary option w/ default OFF --- CMakeLists.txt | 10 +++--- cmake/module/FindQt5.cmake | 62 ++++++++++++++++++++++++++++++++++++++ cmake/optional_qt.cmake | 51 ------------------------------- depends/toolchain.cmake.in | 10 +++--- src/qt/CMakeLists.txt | 48 +++++++++++++---------------- 5 files changed, 92 insertions(+), 89 deletions(-) create mode 100644 cmake/module/FindQt5.cmake delete mode 100644 cmake/optional_qt.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 96a495f935bcc..c7dc3176d3c53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module) include(CMakeDependentOption) # When adding a new option, end the with a full stop for consistency. option(BUILD_DAEMON "Build bitcoind executable." ON) +option(WITH_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) @@ -143,7 +144,6 @@ endif() cmake_dependent_option(WITH_EXTERNAL_SIGNER "Enable external signer support." ON "NOT WIN32" OFF) set(ENABLE_EXTERNAL_SIGNER ${WITH_EXTERNAL_SIGNER}) -include(cmake/optional_qt.cmake) cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "WITH_GUI" OFF) if(WITH_QRENCODE) find_package(PkgConfig REQUIRED) @@ -160,7 +160,7 @@ if(MULTIPROCESS) endif() option(BUILD_TESTS "Build test_bitcoin executable." ON) -cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_TESTS" OFF) +cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "WITH_GUI;BUILD_TESTS" OFF) option(BUILD_BENCH "Build bench_bitcoin executable." ON) option(BUILD_FUZZ_BINARY "Build fuzz binary." ON) cmake_dependent_option(FUZZ "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF) @@ -600,6 +600,7 @@ message("Configure summary") message("=================") message("Executables:") message(" bitcoind ............................ ${BUILD_DAEMON}") +message(" bitcoin-qt .......................... ${WITH_GUI}") message(" bitcoin-cli ......................... ${BUILD_CLI}") message(" bitcoin-tx .......................... ${BUILD_TX}") message(" bitcoin-util ........................ ${BUILD_UTIL}") @@ -610,16 +611,13 @@ message("Wallet support:") message(" SQLite, descriptor wallets .......... ${WITH_SQLITE}") message(" Berkeley DB, legacy wallets ......... ${WITH_BDB}") message("Optional packages:") -message(" GUI ................................. ${WITH_GUI}") -if(WITH_GUI) - message(" QR code (GUI) ....................... ${WITH_QRENCODE}") -endif() message(" external signer ..................... ${WITH_EXTERNAL_SIGNER}") message(" multiprocess ........................ ${MULTIPROCESS}") message(" NAT-PMP ............................. ${WITH_NATPMP}") message(" UPnP ................................ ${WITH_MINIUPNPC}") message(" ZeroMQ .............................. ${WITH_ZMQ}") message(" USDT tracing ........................ ${WITH_USDT}") +message(" QR code (GUI) ....................... ${WITH_QRENCODE}") message("Tests:") message(" test_bitcoin ........................ ${BUILD_TESTS}") message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}") diff --git a/cmake/module/FindQt5.cmake b/cmake/module/FindQt5.cmake new file mode 100644 index 0000000000000..cbf17f02af86c --- /dev/null +++ b/cmake/module/FindQt5.cmake @@ -0,0 +1,62 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +#[=======================================================================[ +FindQt5 +------- + +Finds the Qt 5 headers and libraries. + +This is a wrapper around find_package() command that: + - facilitates searching in various build environments + - prints a standard log message + +#]=======================================================================] + +set(_qt_homebrew_prefix) +if(CMAKE_HOST_APPLE) + find_program(HOMEBREW_EXECUTABLE brew) + if(HOMEBREW_EXECUTABLE) + execute_process( + COMMAND ${HOMEBREW_EXECUTABLE} --prefix qt@5 + OUTPUT_VARIABLE _qt_homebrew_prefix + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() +endif() + +# Save CMAKE_FIND_ROOT_PATH_MODE_LIBRARY state. +unset(_qt_find_root_path_mode_library_saved) +if(DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(_qt_find_root_path_mode_library_saved ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}) +endif() + +# The Qt config files internally use find_library() calls for all +# dependencies to ensure their availability. In turn, the find_library() +# inspects the well-known locations on the file system; therefore, it must +# be able to find platform-specific system libraries, for example: +# /usr/x86_64-w64-mingw32/lib/libm.a or /usr/arm-linux-gnueabihf/lib/libm.a. +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) + +find_package(Qt5 ${Qt5_FIND_VERSION} + COMPONENTS ${Qt5_FIND_COMPONENTS} + HINTS ${_qt_homebrew_prefix} + PATH_SUFFIXES Qt5 # Required on OpenBSD systems. +) +unset(_qt_homebrew_prefix) + +# Restore CMAKE_FIND_ROOT_PATH_MODE_LIBRARY state. +if(DEFINED _qt_find_root_path_mode_library_saved) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ${_qt_find_root_path_mode_library_saved}) + unset(_qt_find_root_path_mode_library_saved) +else() + unset(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Qt5 + REQUIRED_VARS Qt5_DIR + VERSION_VAR Qt5_VERSION +) diff --git a/cmake/optional_qt.cmake b/cmake/optional_qt.cmake deleted file mode 100644 index 4d796e5eeb6fc..0000000000000 --- a/cmake/optional_qt.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) 2023-present The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or https://opensource.org/license/mit/. - -set(WITH_GUI "AUTO" CACHE STRING "Build GUI ([AUTO], Qt5, OFF)") -set(with_gui_values AUTO Qt5 OFF) -if(NOT WITH_GUI IN_LIST with_gui_values) - message(FATAL_ERROR "WITH_GUI value is \"${WITH_GUI}\", but must be one of \"AUTO\", \"Qt5\" or \"OFF\".") -endif() - -if(WITH_GUI) - set(QT_NO_CREATE_VERSIONLESS_FUNCTIONS ON) - set(QT_NO_CREATE_VERSIONLESS_TARGETS ON) - - set(qt5_brew_prefix) - if(CMAKE_HOST_APPLE) - find_program(HOMEBREW_EXECUTABLE brew) - if(HOMEBREW_EXECUTABLE) - execute_process( - COMMAND ${HOMEBREW_EXECUTABLE} --prefix qt@5 - OUTPUT_VARIABLE qt5_brew_prefix - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif() - endif() - - if(WITH_GUI STREQUAL "AUTO") - # The PATH_SUFFIXES option is required on OpenBSD systems. - find_package(QT NAMES Qt5 - COMPONENTS Core - HINTS ${qt5_brew_prefix} - PATH_SUFFIXES Qt5 - ) - if(QT_FOUND) - set(WITH_GUI Qt${QT_VERSION_MAJOR}) - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - enable_language(OBJCXX) - set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - set(CMAKE_OBJCXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - set(CMAKE_OBJCXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}") - endif() - else() - message(WARNING "Qt not found, disabling.\n" - "To skip this warning check, use \"-DWITH_GUI=OFF\".\n") - set(WITH_GUI OFF) - set(BUILD_GUI_TESTS OFF) - endif() - endif() -endif() diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index da41489dc348e..3e6a07a12f867 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -117,11 +117,11 @@ unset(pkg_config_path) set(PKG_CONFIG_ARGN --static) -# Ensure that the docstrings in the following `set(... CACHE ...)` -# commands match those in the root CMakeLists.txt file. - -if(NOT WITH_GUI AND "@no_qt@" STREQUAL "1") - set(WITH_GUI OFF CACHE STRING "Build GUI.") +# Set configuration options for the main build system. +if("@no_qt@") + set(WITH_GUI OFF CACHE BOOL "") +else() + set(WITH_GUI ON CACHE BOOL "") endif() if(NOT WITH_QRENCODE AND "@no_qr@" STREQUAL "1") diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index b528b4d68acfc..63a3212218945 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -2,6 +2,26 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. +set(qt_components Core Gui Widgets LinguistTools) +if(ENABLE_WALLET) + list(APPEND qt_components Network) +endif() +if(BUILD_GUI_TESTS) + list(APPEND qt_components Test) +endif() +find_package(Qt5 5.11.3 MODULE REQUIRED + COMPONENTS ${qt_components} +) +unset(qt_components) + +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + enable_language(OBJCXX) + set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + set(CMAKE_OBJCXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + set(CMAKE_OBJCXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}") +endif() + function(import_plugins target) if(QT_IS_STATIC) set(plugins Qt5::QMinimalIntegrationPlugin) @@ -19,7 +39,7 @@ function(import_plugins target) endif() endfunction() -# See: +# For Qt-specific commands and variables, please consult: # - https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html # - https://doc.qt.io/qt-5/cmake-manual.html @@ -28,32 +48,6 @@ set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC_SEARCH_PATHS forms) -set(qt_minimum_required_version 5.11.3) - -set(qt_components Core Gui Widgets Network LinguistTools) -if(BUILD_GUI_TESTS) - list(APPEND qt_components Test) -endif() - -if(CMAKE_CROSSCOMPILING) - # The find_package(Qt ...) function internally uses find_library() - # calls for all dependencies to ensure their availability. - # In turn, the find_library() inspects the well-known locations - # on the file system; therefore, it must be able to find - # platform-specific system libraries, for example: - # /usr/x86_64-w64-mingw32/lib/libm.a or /usr/arm-linux-gnueabihf/lib/libm.a. - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) -endif() - -find_package(Qt5 ${qt_minimum_required_version} REQUIRED - COMPONENTS ${qt_components} - HINTS ${qt5_brew_prefix} - PATH_SUFFIXES Qt5 # Required on OpenBSD systems. -) -unset(qt_components) -message(STATUS "Found Qt: ${Qt5_DIR} (found suitable version \"${Qt5_VERSION}\", minimum required is \"${qt_minimum_required_version}\")") -unset(qt_minimum_required_version) - include(CMakePushCheckState) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_LIBRARIES Qt5::Core) From c46dd168fcd757fa42ec2d35e98683efca653fc0 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sat, 27 Apr 2024 09:40:56 +0100 Subject: [PATCH 2/2] cmake [KILL 3-STATE]: Rename WITH_GUI to BUILD_GUI Also docs and CI scripts have been updated. --- .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 10 +++++----- CMakePresets.json | 6 +++--- depends/toolchain.cmake.in | 4 ++-- doc/build-freebsd.md | 10 +++++----- doc/build-openbsd.md | 8 ++++---- doc/build-osx.md | 9 ++++----- doc/build-windows-msvc.md | 8 ++++---- src/CMakeLists.txt | 2 +- 9 files changed, 29 insertions(+), 30 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f86509c32e664..57ee14a4cf330 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -464,7 +464,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 diff --git a/CMakeLists.txt b/CMakeLists.txt index c7dc3176d3c53..7be4f351a1830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module) include(CMakeDependentOption) # When adding a new option, end the 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) @@ -144,7 +144,7 @@ endif() 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) @@ -160,7 +160,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) option(BUILD_FUZZ_BINARY "Build fuzz binary." ON) cmake_dependent_option(FUZZ "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF) @@ -205,7 +205,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) @@ -600,7 +600,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}") diff --git a/CMakePresets.json b/CMakePresets.json index 745111c700cff..7ba145b4b0c48 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -40,7 +40,7 @@ "rhs": "Darwin" }, "cacheVariables": { - "WITH_GUI": "Qt5", + "BUILD_GUI": "ON", "WITH_EXTERNAL_SIGNER": "ON" } }, @@ -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" } @@ -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" } diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index 3e6a07a12f867..c10c08451c8d0 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -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") diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index fafa828d1221e..cfd8228739a4f 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -101,23 +101,23 @@ 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 -cmake -B build -DWITH_BDB=OFF -DWITH_GUI=Qt5 +cmake -B build -DWITH_BDB=OFF -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, assuming +This enables support for both wallet types, assuming `sqlite3` and `db4` are both installed. ```bash -cmake -B build -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 -cmake -B build -DENABLE_WALLET=OFF -DWITH_GUI=OFF +cmake -B build -DENABLE_WALLET=OFF ``` ### 2. Compile diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md index 463d4101194c5..bd0e43df1d572 100644 --- a/doc/build-openbsd.md +++ b/doc/build-openbsd.md @@ -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 diff --git a/doc/build-osx.md b/doc/build-osx.md index 4556f5311708f..69d314c0d8310 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -190,27 +190,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 -cmake -B build -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 -cmake -B build -DWITH_BDB=OFF -DWITH_GUI=Qt5 +cmake -B build -DWITH_BDB=OFF -DBUILD_GUI=ON ``` ##### No Wallet or GUI ``` bash -cmake -B build -DENABLE_WALLET=OFF -DWITH_GUI=OFF +cmake -B build -DENABLE_WALLET=OFF ``` ##### Further Configuration diff --git a/doc/build-windows-msvc.md b/doc/build-windows-msvc.md index c5946e06f35c0..a659808b16b0f 100644 --- a/doc/build-windows-msvc.md +++ b/doc/build-windows-msvc.md @@ -48,15 +48,15 @@ CMake will put the resulting object files, libraries, and executables into a ded 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 -B build --preset vs2022 # It might take a while if the vcpkg binary cache is unpopulated or invalidated. +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 -B build --preset vs2022-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated. @@ -72,7 +72,7 @@ cmake --install build --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 -B build --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. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0646f419affb7..77446b339bb2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -343,7 +343,7 @@ if(BUILD_UTIL) endif() -if(WITH_GUI) +if(BUILD_GUI) add_subdirectory(qt) endif()