|
| 1 | +# Copyright (c) 2023-present The Bitcoin Core developers |
| 2 | +# Distributed under the MIT software license, see the accompanying |
| 3 | +# file COPYING or https://opensource.org/license/mit/. |
| 4 | + |
| 5 | +# See: |
| 6 | +# - https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html |
| 7 | +# - https://doc.qt.io/qt-5/cmake-manual.html |
| 8 | + |
| 9 | +set(CMAKE_AUTOMOC ON) |
| 10 | +set(CMAKE_AUTORCC ON) |
| 11 | +set(CMAKE_AUTOUIC ON) |
| 12 | +set(CMAKE_AUTOUIC_SEARCH_PATHS forms) |
| 13 | + |
| 14 | +set(qt_minimum_required_version 5.11.3) |
| 15 | + |
| 16 | +set(qt_components Core Gui Widgets Network LinguistTools) |
| 17 | +find_package(Qt5 ${qt_minimum_required_version} REQUIRED |
| 18 | + COMPONENTS ${qt_components} |
| 19 | + HINTS ${qt5_brew_prefix} |
| 20 | + PATH_SUFFIXES Qt5 # Required on OpenBSD systems. |
| 21 | +) |
| 22 | +unset(qt_components) |
| 23 | +message(STATUS "Found Qt: ${Qt5_DIR} (found suitable version \"${Qt5_VERSION}\", minimum required is \"${qt_minimum_required_version}\")") |
| 24 | +unset(qt_minimum_required_version) |
| 25 | + |
| 26 | +file(GLOB ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} locale/*.ts) |
| 27 | +set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/locale) |
| 28 | +qt5_add_translation(qm_files ${ts_files}) |
| 29 | + |
| 30 | +configure_file(bitcoin_locale.qrc bitcoin_locale.qrc COPYONLY) |
| 31 | + |
| 32 | +add_library(bitcoinqt STATIC EXCLUDE_FROM_ALL |
| 33 | + bantablemodel.cpp |
| 34 | + bitcoin.cpp |
| 35 | + bitcoinaddressvalidator.cpp |
| 36 | + bitcoinamountfield.cpp |
| 37 | + bitcoingui.cpp |
| 38 | + bitcoinunits.cpp |
| 39 | + clientmodel.cpp |
| 40 | + csvmodelwriter.cpp |
| 41 | + guiutil.cpp |
| 42 | + initexecutor.cpp |
| 43 | + intro.cpp |
| 44 | + modaloverlay.cpp |
| 45 | + networkstyle.cpp |
| 46 | + notificator.cpp |
| 47 | + optionsdialog.cpp |
| 48 | + optionsmodel.cpp |
| 49 | + peertablemodel.cpp |
| 50 | + peertablesortproxy.cpp |
| 51 | + platformstyle.cpp |
| 52 | + qvalidatedlineedit.cpp |
| 53 | + qvaluecombobox.cpp |
| 54 | + rpcconsole.cpp |
| 55 | + splashscreen.cpp |
| 56 | + trafficgraphwidget.cpp |
| 57 | + utilitydialog.cpp |
| 58 | + $<$<PLATFORM_ID:Windows>:winshutdownmonitor.cpp> |
| 59 | + $<$<PLATFORM_ID:Darwin>:macdockiconhandler.mm> |
| 60 | + $<$<PLATFORM_ID:Darwin>:macnotificationhandler.mm> |
| 61 | + $<$<PLATFORM_ID:Darwin>:macos_appnap.mm> |
| 62 | + bitcoin.qrc |
| 63 | + ${CMAKE_CURRENT_BINARY_DIR}/bitcoin_locale.qrc |
| 64 | +) |
| 65 | +target_compile_definitions(bitcoinqt |
| 66 | + PUBLIC |
| 67 | + QT_NO_KEYWORDS |
| 68 | + QT_USE_QSTRINGBUILDER |
| 69 | +) |
| 70 | +target_include_directories(bitcoinqt |
| 71 | + PUBLIC |
| 72 | + $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src> |
| 73 | +) |
| 74 | +target_link_libraries(bitcoinqt |
| 75 | + PUBLIC |
| 76 | + Qt5::Widgets |
| 77 | + PRIVATE |
| 78 | + core_interface |
| 79 | + bitcoin_cli |
| 80 | + leveldb |
| 81 | + Boost::headers |
| 82 | + $<TARGET_NAME_IF_EXISTS:NATPMP::NATPMP> |
| 83 | + $<TARGET_NAME_IF_EXISTS:MiniUPnPc::MiniUPnPc> |
| 84 | + $<$<CXX_COMPILER_ID:MSVC>:shlwapi> |
| 85 | +) |
| 86 | + |
| 87 | +if(ENABLE_WALLET) |
| 88 | + target_sources(bitcoinqt |
| 89 | + PRIVATE |
| 90 | + addressbookpage.cpp |
| 91 | + addresstablemodel.cpp |
| 92 | + askpassphrasedialog.cpp |
| 93 | + coincontroldialog.cpp |
| 94 | + coincontroltreewidget.cpp |
| 95 | + createwalletdialog.cpp |
| 96 | + editaddressdialog.cpp |
| 97 | + openuridialog.cpp |
| 98 | + overviewpage.cpp |
| 99 | + paymentserver.cpp |
| 100 | + psbtoperationsdialog.cpp |
| 101 | + qrimagewidget.cpp |
| 102 | + receivecoinsdialog.cpp |
| 103 | + receiverequestdialog.cpp |
| 104 | + recentrequeststablemodel.cpp |
| 105 | + sendcoinsdialog.cpp |
| 106 | + sendcoinsentry.cpp |
| 107 | + signverifymessagedialog.cpp |
| 108 | + transactiondesc.cpp |
| 109 | + transactiondescdialog.cpp |
| 110 | + transactionfilterproxy.cpp |
| 111 | + transactionoverviewwidget.cpp |
| 112 | + transactionrecord.cpp |
| 113 | + transactiontablemodel.cpp |
| 114 | + transactionview.cpp |
| 115 | + walletcontroller.cpp |
| 116 | + walletframe.cpp |
| 117 | + walletmodel.cpp |
| 118 | + walletmodeltransaction.cpp |
| 119 | + walletview.cpp |
| 120 | + ) |
| 121 | + target_link_libraries(bitcoinqt |
| 122 | + PRIVATE |
| 123 | + bitcoin_wallet |
| 124 | + Qt5::Network |
| 125 | + ) |
| 126 | +endif() |
| 127 | + |
| 128 | +if(CMAKE_CROSSCOMPILING) |
| 129 | + target_compile_definitions(bitcoinqt PRIVATE QT_STATICPLUGIN) |
| 130 | + if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND TARGET Qt5::QXcbIntegrationPlugin) |
| 131 | + target_compile_definitions(bitcoinqt PRIVATE QT_QPA_PLATFORM_XCB) |
| 132 | + elseif(WIN32 AND TARGET Qt5::QWindowsIntegrationPlugin AND TARGET Qt5::QWindowsVistaStylePlugin) |
| 133 | + target_compile_definitions(bitcoinqt PRIVATE QT_QPA_PLATFORM_WINDOWS) |
| 134 | + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND TARGET Qt5::QCocoaIntegrationPlugin AND TARGET Qt5::QMacStylePlugin) |
| 135 | + target_compile_definitions(bitcoinqt PRIVATE QT_QPA_PLATFORM_COCOA) |
| 136 | + endif() |
| 137 | +endif() |
| 138 | + |
| 139 | +add_executable(bitcoin-qt |
| 140 | + main.cpp |
| 141 | + ../init/bitcoin-qt.cpp |
| 142 | +) |
| 143 | + |
| 144 | +target_link_libraries(bitcoin-qt |
| 145 | + core_interface |
| 146 | + bitcoinqt |
| 147 | + bitcoin_node |
| 148 | +) |
| 149 | + |
| 150 | +install(TARGETS bitcoin-qt |
| 151 | + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
| 152 | + COMPONENT GUI |
| 153 | +) |
0 commit comments