Skip to content

Commit

Permalink
cmake: Add cross-compiling support to bitcoin-qt executable
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Jun 13, 2022
1 parent 4e100ca commit 2832f9e
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,68 @@ target_link_libraries(bitcoinqt
leveldb
Boost::headers
)
if(CMAKE_CROSSCOMPILING)
target_compile_definitions(bitcoinqt PRIVATE QT_STATICPLUGIN)
target_link_libraries(Qt5::Core
INTERFACE
${CMAKE_PREFIX_PATH}/lib/libqtpcre2.a
${CMAKE_PREFIX_PATH}/lib/libqtlibpng.a
${CMAKE_PREFIX_PATH}/lib/libqtharfbuzz.a
)
if(CMAKE_SYSTEM_NAME STREQUAL Linux AND TARGET Qt5::QXcbIntegrationPlugin)
target_compile_definitions(bitcoinqt PRIVATE QT_QPA_PLATFORM_XCB)
target_link_libraries(Qt5::Core
INTERFACE
-L${CMAKE_PREFIX_PATH}/lib
freetype
fontconfig
xcb
xcb-icccm
xcb-image
xcb-keysyms
xcb-randr
xcb-render
xcb-render-util
xcb-shape
xcb-shm
xcb-sync
xcb-xfixes
xcb-xinerama
xcb-xkb
xkbcommon
xkbcommon-x11
)
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows AND TARGET Qt5::QWindowsIntegrationPlugin AND TARGET Qt5::QWindowsVistaStylePlugin)
target_compile_definitions(bitcoinqt PRIVATE QT_QPA_PLATFORM_WINDOWS)
target_link_libraries(Qt5::Core
INTERFACE
dwmapi
imm32
netapi32
shlwapi
userenv
uxtheme
version
winmm
wtsapi32
)
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin AND TARGET Qt5::QCocoaIntegrationPlugin AND TARGET Qt5::QMacStylePlugin)
target_compile_definitions(bitcoinqt PRIVATE QT_QPA_PLATFORM_COCOA)
target_link_libraries(Qt5::Core
INTERFACE
"-framework AppKit"
"-framework Carbon"
"-framework CoreVideo"
"-framework IOKit"
"-framework IOSurface"
"-framework Metal"
"-framework QuartzCore"
"-framework Security"
)
elseif(CMAKE_SYSTEM_NAME STREQUAL Android AND TARGET Qt5::QAndroidPlatformIntegrationPlugin)
target_compile_definitions(bitcoinqt PRIVATE QT_QPA_PLATFORM_ANDROID)
endif()
endif()

add_executable(bitcoin-qt)
target_sources(bitcoin-qt
Expand Down

0 comments on commit 2832f9e

Please sign in to comment.