Changeset View
Changeset View
Standalone View
Standalone View
src/qt/CMakeLists.txt
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | add_library(bitcoin-qt-base | ||||
# Handle qrc files | # Handle qrc files | ||||
${QRC_BITCOIN_CPP} | ${QRC_BITCOIN_CPP} | ||||
qrc_bitcoin_locale.cpp | qrc_bitcoin_locale.cpp | ||||
) | ) | ||||
target_include_directories(bitcoin-qt-base PUBLIC ${Protobuf_INCLUDE_DIRS}) | target_include_directories(bitcoin-qt-base PUBLIC ${Protobuf_INCLUDE_DIRS}) | ||||
# Add the minimal integration plugin, and other plugins according to the target | |||||
# platform. | |||||
set(QT_PLUGIN_COMPONENTS QMinimalIntegrationPlugin) | |||||
set(QT_PLUGIN_PLATFORM_DEFINITIONS -DQT_QPA_PLATFORM_MINIMAL=1) | |||||
# Linux support | |||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | |||||
list(APPEND QT_PLUGIN_COMPONENTS QXcbIntegrationPlugin) | |||||
list(APPEND QT_PLUGIN_PLATFORM_DEFINITIONS -DQT_QPA_PLATFORM_XCB=1) | |||||
endif() | |||||
# Windows support | # Windows support | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||||
list(APPEND QT_PLUGIN_COMPONENTS QWindowsIntegrationPlugin) | |||||
list(APPEND QT_PLUGIN_PLATFORM_DEFINITIONS -DQT_QPA_PLATFORM_WINDOWS=1) | |||||
target_sources(bitcoin-qt-base PRIVATE winshutdownmonitor.cpp) | target_sources(bitcoin-qt-base PRIVATE winshutdownmonitor.cpp) | ||||
endif() | endif() | ||||
# OSX support | # OSX support | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||||
list(APPEND QT_PLUGIN_COMPONENTS QCocoaIntegrationPlugin) | |||||
list(APPEND QT_PLUGIN_PLATFORM_DEFINITIONS -DQT_QPA_PLATFORM_COCOA=1) | |||||
target_sources(bitcoin-qt-base PRIVATE | target_sources(bitcoin-qt-base PRIVATE | ||||
macdockiconhandler.mm | macdockiconhandler.mm | ||||
macnotificationhandler.mm | macnotificationhandler.mm | ||||
) | ) | ||||
set_property(TARGET bitcoin-qt-base PROPERTY AUTOMOC_MOC_OPTIONS "-DQ_OS_MAC") | set_property(TARGET bitcoin-qt-base PROPERTY AUTOMOC_MOC_OPTIONS "-DQ_OS_MAC") | ||||
endif() | endif() | ||||
Show All 23 Lines | execute_process(COMMAND ${PERL_EXECUTABLE} "${CONVERT_PRL_PATH}" | ||||
--out "${STATIC_DEPENDENCIES_CMAKE_FILE}" | --out "${STATIC_DEPENDENCIES_CMAKE_FILE}" | ||||
--component "${_qt_component}" | --component "${_qt_component}" | ||||
--compiler "${CMAKE_CXX_COMPILER_ID}" | --compiler "${CMAKE_CXX_COMPILER_ID}" | ||||
) | ) | ||||
endif() | endif() | ||||
endmacro() | endmacro() | ||||
if(QT_STATIC_BUILD) | if(QT_STATIC_BUILD) | ||||
list(APPEND QT_REQUIRED_COMPONENTS ${QT_PLUGIN_COMPONENTS}) | |||||
foreach(qt_module ${QT_REQUIRED_COMPONENTS}) | foreach(qt_module ${QT_REQUIRED_COMPONENTS}) | ||||
CONVERT_PRL_LIBS_TO_CMAKE(${qt_module}) | CONVERT_PRL_LIBS_TO_CMAKE(${qt_module}) | ||||
endforeach() | endforeach() | ||||
# HACK: We must explicitly add LIB path of the Qt installation | # HACK: We must explicitly add LIB path of the Qt installation | ||||
# to correctly find qtpcre | # to correctly find qtpcre | ||||
link_directories("${QT5_LIB_DIR}") | link_directories("${QT5_LIB_DIR}") | ||||
# Now that we generated the dependencies, import them. | # Now that we generated the dependencies, import them. | ||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CONVERT_PRL_PATH}") | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CONVERT_PRL_PATH}") | ||||
if(NOT EXISTS ${STATIC_DEPENDENCIES_CMAKE_FILE}) | if(NOT EXISTS ${STATIC_DEPENDENCIES_CMAKE_FILE}) | ||||
message(FATAL_ERROR "Unable to find ${STATIC_DEPENDENCIES_CMAKE_FILE}") | message(FATAL_ERROR "Unable to find ${STATIC_DEPENDENCIES_CMAKE_FILE}") | ||||
endif() | endif() | ||||
include(${STATIC_DEPENDENCIES_CMAKE_FILE}) | include(${STATIC_DEPENDENCIES_CMAKE_FILE}) | ||||
list(REMOVE_DUPLICATES STATIC_LIB_DEPENDENCIES) | list(REMOVE_DUPLICATES STATIC_LIB_DEPENDENCIES) | ||||
# According to Qt documentation (https://doc.qt.io/qt-5/plugins-howto.html): | |||||
# "Plugins can be linked statically into your application. | |||||
# If you build the static version of Qt, this is the only option for | |||||
# including Qt's predefined plugins." | |||||
# So if the Qt build is static, the plugins should also be static and we | |||||
# need to define QT_STATICPLUGIN to tell the code to import <QTPlugin>. | |||||
target_compile_definitions(bitcoin-qt-base PUBLIC -DQT_STATICPLUGIN=1) | |||||
# Add the platform plugin definition if required | |||||
# Setting this definition tells the code what is the target for Q_IMPORT_PLUGIN(). | |||||
foreach(qt_platform_definition ${QT_PLUGIN_PLATFORM_DEFINITIONS}) | |||||
target_compile_definitions(bitcoin-qt-base PUBLIC "${qt_platform_definition}") | |||||
endforeach() | |||||
# Link the required plugins | |||||
foreach(qt_plugin ${QT_PLUGIN_COMPONENTS}) | |||||
target_link_libraries(bitcoin-qt-base Qt5::${qt_plugin}) | |||||
endforeach() | |||||
endif() | endif() | ||||
target_link_libraries(bitcoin-qt-base | target_link_libraries(bitcoin-qt-base | ||||
server | server | ||||
rpcclient | rpcclient | ||||
Qt5::Widgets | Qt5::Widgets | ||||
Qt5::Network | Qt5::Network | ||||
OpenSSL::SSL | OpenSSL::SSL | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |