diff --git a/CMakeLists.txt b/CMakeLists.txt index b6cd7f46..fa1a5853 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,17 +105,7 @@ link_directories(${EASYLOGGING_LIBRARY_DIRS}) include(VersionGui) monero_gui_add_library(gui_version SOURCES version.js DEPENDS genversiongui) -find_package(Qt5Core REQUIRED) -find_package(Qt5Quick REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5Gui REQUIRED) -find_package(Qt5Network REQUIRED) -find_package(Qt5Qml REQUIRED) message(STATUS "${CMAKE_MODULE_PATH}") -find_package(Qt5Multimedia REQUIRED) -find_package(Qt5Xml REQUIRED) -find_package(Qt5XmlPatterns REQUIRED) -find_package(Qt5Svg REQUIRED) find_package(X11 REQUIRED) @@ -179,6 +169,21 @@ if(MINGW) string(REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}") message(STATUS "MSYS location: ${msys2_install_path}") set(CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw${ARCH_WIDTH}/include") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/Qt/labs/folderlistmodel") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/Qt/labs/settings") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtGraphicalEffects") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtGraphicalEffects/private") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtMultimedia") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick.2") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Controls") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Controls.2") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Dialogs") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Dialogs/Private") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Layouts") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/PrivateWidgets") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Templates.2") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Window.2") + link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/XmlListModel") # This is necessary because otherwise CMake will make Boost libraries -lfoo # rather than a full path. Unfortunately, this makes the shared libraries get # linked due to a bug in CMake which misses putting -static flags around the @@ -188,6 +193,81 @@ if(MINGW) list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES ${DEFLIB}) endif() +set(QT5_LIBRARIES + Qt5Core + Qt5Quick + Qt5QuickControls2 + Qt5Widgets + Qt5Gui + Qt5Network + Qt5Qml + Qt5Multimedia + Qt5Xml + Qt5XmlPatterns + Qt5Svg +) + +foreach(QT5_MODULE ${QT5_LIBRARIES}) + find_package(${QT5_MODULE} REQUIRED) +endforeach() + +find_package(PkgConfig) +if(PKGCONFIG_FOUND) + pkg_check_modules(QT5_PKG_CONFIG ${QT5_LIBRARIES}) + + if(QT5_PKG_CONFIG_FOUND) + set(QT5_PKG_CONFIG "QT5_PKG_CONFIG") + if(STATIC) + set(QT5_PKG_CONFIG "${QT5_PKG_CONFIG}_STATIC") + endif() + + set(QT5_LIBRARIES ${${QT5_PKG_CONFIG}_LIBRARIES} ${${QT5_PKG_CONFIG}_LDFLAGS_OTHER}) + include_directories(${${QT5_PKG_CONFIG}_INCLUDE_DIRS}) + link_directories(${${QT5_PKG_CONFIG}_LIBRARY_DIRS}) + endif() +endif() + +list(APPEND QT5_LIBRARIES + ${Qt5Gui_PLUGINS} + ${Qt5Svg_PLUGINS} + ${Qt5Qml_PLUGINS} + ${Qt5Network_PLUGINS} +) + +if(STATIC) + set(QT5_LIBRARIES + qtquickcontrols2plugin # has to be the first one, depends on Qt5QuickControls2 + ${QT5_LIBRARIES} + declarative_multimedia + dialogplugin + dialogsprivateplugin + qmlfolderlistmodelplugin + qmlsettingsplugin + qmlxmllistmodelplugin + qquicklayoutsplugin + Qt5EventDispatcherSupport + Qt5FontDatabaseSupport + Qt5MultimediaQuick_p + Qt5PacketProtocol + Qt5ThemeSupport + qtgraphicaleffectsplugin + qtgraphicaleffectsprivate + qtquick2plugin + qtquickcontrolsplugin + qtquicktemplates2plugin + widgetsplugin + windowplugin + ) + + if(MINGW) + list(APPEND QT5_LIBRARIES freetype) + + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + list(APPEND QT5_LIBRARIES D3D11 Dwrite D2d1) + endif() + endif() +endif() + message(STATUS "Using Boost include dir at ${Boost_INCLUDE_DIRS}") message(STATUS "Using Boost libraries at ${Boost_LIBRARIES}") @@ -244,7 +324,7 @@ if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED) endif() endif() if (WIN32) - list(APPEND EXTRA_LIBRARIES setupapi) + list(APPEND EXTRA_LIBRARIES setupapi Version) endif() endif() diff --git a/Makefile b/Makefile index bf248913..e5f3ab05 100644 --- a/Makefile +++ b/Makefile @@ -29,9 +29,12 @@ scanner: mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=ON -D WITH_SCANNER=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE) debug-static-win64: - mkdir -p $(builddir)/debug && cd $(builddir)/debug && cmake -G "MSYS Makefiles" -D DEV_MODE=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 -D MINGW=ON $(topdir) && $(MAKE) + mkdir -p $(builddir)/debug && cd $(builddir)/debug && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 -D MINGW=ON $(topdir) && $(MAKE) debug-static-mac64: mkdir -p $(builddir)/debug cd $(builddir)/debug && cmake -D STATIC=ON -D DEV_MODE=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="mac-x64" $(topdir) && $(MAKE) +release-static-win64: + mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -G "MSYS Makefiles" -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 -D MINGW=ON $(topdir) && $(MAKE) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index abad3c9b..722498d9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -133,16 +133,9 @@ target_link_libraries(monero-gui ${CMAKE_DL_LIBS} ${LibUSB_LIBRARIES} ${HIDAPI_LIBRARIES} - Qt5::Core - Qt5::Quick - Qt5::Widgets - Qt5::Gui - Qt5::Network - Qt5::Qml - Qt5::Multimedia - Qt5::Xml - Qt5::XmlPatterns - Qt5::Svg + ${QT5_LIBRARIES} + ${EXTRA_LIBRARIES} + ${ICU_LIBRARIES} ) if(WITH_SCANNER) diff --git a/src/main/main.cpp b/src/main/main.cpp index e630c15f..3a9eb014 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -78,6 +78,54 @@ #include "QR-Code-scanner/QrCodeScanner.h" #endif +#include +#if defined(Q_OS_OSX) + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); +#elif defined(Q_OS_WIN) + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); +#elif defined(Q_OS_LINUX) + Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); +#endif +Q_IMPORT_PLUGIN(QSvgIconPlugin) +Q_IMPORT_PLUGIN(QGifPlugin) +Q_IMPORT_PLUGIN(QICNSPlugin) +Q_IMPORT_PLUGIN(QICOPlugin) +Q_IMPORT_PLUGIN(QJp2Plugin) +Q_IMPORT_PLUGIN(QJpegPlugin) +Q_IMPORT_PLUGIN(QMngPlugin) +Q_IMPORT_PLUGIN(QSvgPlugin) +Q_IMPORT_PLUGIN(QTgaPlugin) +Q_IMPORT_PLUGIN(QTiffPlugin) +Q_IMPORT_PLUGIN(QWbmpPlugin) +Q_IMPORT_PLUGIN(QWebpPlugin) +Q_IMPORT_PLUGIN(QQmlDebuggerServiceFactory) +Q_IMPORT_PLUGIN(QQmlInspectorServiceFactory) +Q_IMPORT_PLUGIN(QLocalClientConnectionFactory) +Q_IMPORT_PLUGIN(QDebugMessageServiceFactory) +Q_IMPORT_PLUGIN(QQmlNativeDebugConnectorFactory) +Q_IMPORT_PLUGIN(QQmlNativeDebugServiceFactory) +Q_IMPORT_PLUGIN(QQmlProfilerServiceFactory) +Q_IMPORT_PLUGIN(QQuickProfilerAdapterFactory) +Q_IMPORT_PLUGIN(QQmlDebugServerFactory) +Q_IMPORT_PLUGIN(QTcpServerConnectionFactory) +Q_IMPORT_PLUGIN(QGenericEnginePlugin) + +Q_IMPORT_PLUGIN(QtQuick2Plugin) +Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin) +Q_IMPORT_PLUGIN(QtGraphicalEffectsPlugin) +Q_IMPORT_PLUGIN(QtGraphicalEffectsPrivatePlugin) +Q_IMPORT_PLUGIN(QtQuick2WindowPlugin) +Q_IMPORT_PLUGIN(QtQuickControls1Plugin) +Q_IMPORT_PLUGIN(QtQuick2DialogsPlugin) +Q_IMPORT_PLUGIN(QmlFolderListModelPlugin) +Q_IMPORT_PLUGIN(QmlSettingsPlugin) +Q_IMPORT_PLUGIN(QtQuick2DialogsPrivatePlugin) +Q_IMPORT_PLUGIN(QtQuick2PrivateWidgetsPlugin) +Q_IMPORT_PLUGIN(QtQuickControls2Plugin) +Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin) +Q_IMPORT_PLUGIN(QmlXmlListModelPlugin) +Q_IMPORT_PLUGIN(QMultimediaDeclarativeModule) + bool isIOS = false; bool isAndroid = false; bool isWindows = false;