Skip to content

Commit fb69f11

Browse files
committed
receivePayment: fix QR code import in new build system
1 parent b628681 commit fb69f11

File tree

3 files changed

+75
-3
lines changed

3 files changed

+75
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ find_package(Qt 6.2 MODULE REQUIRED
3131
COMPONENTS ${qt_components}
3232
)
3333
find_package(Libevent 2.1.8 MODULE REQUIRED)
34+
find_package(QRencode MODULE REQUIRED)
3435

3536
# Do not build any executable targets from bitcoin submodule
3637
set(BUILD_BENCH OFF)
@@ -47,6 +48,7 @@ set(BUILD_TX OFF)
4748
set(BUILD_UTIL OFF)
4849
set(BUILD_UTIL_CHAINSTATE OFF)
4950
set(BUILD_WALLET_TOOL OFF)
51+
set(USE_QRCODE TRUE)
5052
# We need this libraries, can ignore the executable bitcoin-qt
5153
set(BUILD_GUI ON)
5254
set(ENABLE_WALLET ON)
@@ -100,6 +102,7 @@ target_link_libraries(bitcoinqml
100102
bitcoin_node
101103
univalue
102104
Boost::headers
105+
$<TARGET_NAME_IF_EXISTS:QRencode::QRencode>
103106
Qt6::Qml
104107
Qt6::Quick
105108
Qt6::QuickControls2

cmake/module/FindQRencode.cmake

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright (c) 2024-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+
#[=======================================================================[
6+
FindQRencode
7+
------------
8+
9+
Finds the QRencode header and library.
10+
11+
This is a wrapper around find_package()/pkg_check_modules() commands that:
12+
- facilitates searching in various build environments
13+
- prints a standard log message
14+
15+
#]=======================================================================]
16+
17+
find_package(PkgConfig QUIET)
18+
if(PKG_CONFIG_FOUND)
19+
pkg_check_modules(PC_QRencode QUIET libqrencode)
20+
endif()
21+
22+
find_path(QRencode_INCLUDE_DIR
23+
NAMES qrencode.h
24+
HINTS ${PC_QRencode_INCLUDE_DIRS}
25+
)
26+
27+
find_library(QRencode_LIBRARY_RELEASE
28+
NAMES qrencode
29+
HINTS ${PC_QRencode_LIBRARY_DIRS}
30+
)
31+
find_library(QRencode_LIBRARY_DEBUG
32+
NAMES qrencoded qrencode
33+
HINTS ${PC_QRencode_LIBRARY_DIRS}
34+
)
35+
include(SelectLibraryConfigurations)
36+
select_library_configurations(QRencode)
37+
38+
include(FindPackageHandleStandardArgs)
39+
find_package_handle_standard_args(QRencode
40+
REQUIRED_VARS QRencode_LIBRARY QRencode_INCLUDE_DIR
41+
VERSION_VAR PC_QRencode_VERSION
42+
)
43+
44+
if(QRencode_FOUND)
45+
if(NOT TARGET QRencode::QRencode)
46+
add_library(QRencode::QRencode UNKNOWN IMPORTED)
47+
endif()
48+
if(QRencode_LIBRARY_RELEASE)
49+
set_property(TARGET QRencode::QRencode APPEND PROPERTY
50+
IMPORTED_CONFIGURATIONS RELEASE
51+
)
52+
set_target_properties(QRencode::QRencode PROPERTIES
53+
IMPORTED_LOCATION_RELEASE "${QRencode_LIBRARY_RELEASE}"
54+
)
55+
endif()
56+
if(QRencode_LIBRARY_DEBUG)
57+
set_property(TARGET QRencode::QRencode APPEND PROPERTY
58+
IMPORTED_CONFIGURATIONS DEBUG
59+
)
60+
set_target_properties(QRencode::QRencode PROPERTIES
61+
IMPORTED_LOCATION_DEBUG "${QRencode_LIBRARY_DEBUG}"
62+
)
63+
endif()
64+
set_target_properties(QRencode::QRencode PROPERTIES
65+
INTERFACE_INCLUDE_DIRECTORIES "${QRencode_INCLUDE_DIR}"
66+
)
67+
endif()
68+
69+
mark_as_advanced(
70+
QRencode_INCLUDE_DIR
71+
)

qml/qrimageprovider.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
#include <qml/qrimageprovider.h>
66

7-
#if defined(HAVE_CONFIG_H)
8-
#include <config/bitcoin-config.h> /* for USE_QRCODE */
9-
#endif
7+
#include <bitcoin-build-config.h> // IWYU pragma: keep
108

119
#ifdef USE_QRCODE
1210
#include <qrencode.h>

0 commit comments

Comments
 (0)