Merge pull request #2531

2833fdb cmake: use appropriate compiler flags (xiphon)
17ea26e build: fix monero-wallet-gui.pro source paths, rm qml.qrc duplicate (xiphon)
This commit is contained in:
luigi1111 2019-12-09 22:05:22 -06:00
commit 46227bdad0
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
5 changed files with 102 additions and 275 deletions

View file

@ -29,6 +29,31 @@ set(ARCH "x86-64")
set(BUILD_64 ON)
set(INSTALL_VENDORED_LIBUNBOUND=ON)
function (add_c_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_c)
check_c_compiler_flag(${flag} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_cxx_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_cxx)
check_cxx_compiler_flag(${flag} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_linker_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_ld)
string(REPLACE "," "_" supported ${flag}_ld)
check_linker_flag(${flag} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
find_package(Git)
if(GIT_FOUND)
if(NOT DEV_MODE)
@ -57,7 +82,8 @@ get_directory_property(ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH)
if(STATIC)
message(STATUS "Initiating static build")
set(Boost_USE_STATIC_LIBS ON)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
add_definitions(-DMONERO_GUI_STATIC)
endif()
# Include password strength library
@ -256,7 +282,7 @@ if(STATIC)
)
if(MINGW)
list(APPEND QT5_LIBRARIES freetype)
list(APPEND QT5_LIBRARIES qtfreetype)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND QT5_LIBRARIES D3D11 Dwrite D2d1)
@ -307,6 +333,59 @@ if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
endif()
# warnings
add_c_flag_if_supported(-Wformat C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-Wformat CXX_SECURITY_FLAGS)
add_c_flag_if_supported(-Wformat-security C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-Wformat-security CXX_SECURITY_FLAGS)
# -fstack-protector
if (NOT OPENBSD AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
add_c_flag_if_supported(-fstack-protector C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-protector CXX_SECURITY_FLAGS)
add_c_flag_if_supported(-fstack-protector-strong C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-protector-strong CXX_SECURITY_FLAGS)
endif()
# New in GCC 8.2
if (NOT OPENBSD AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
add_c_flag_if_supported(-fcf-protection=full C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fcf-protection=full CXX_SECURITY_FLAGS)
endif()
if (NOT WIN32 AND NOT OPENBSD)
add_c_flag_if_supported(-fstack-clash-protection C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS)
endif()
# Removed in GCC 9.1 (or before ?), but still accepted, so spams the output
if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS)
endif()
# linker
if (NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU"))
# Windows binaries die on startup with PIE when compiled with GCC
add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS)
endif()
add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,noexecstack noexecstack_SUPPORTED)
if (noexecstack_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecstack")
endif()
add_linker_flag_if_supported(-Wl,-z,noexecheap noexecheap_SUPPORTED)
if (noexecheap_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
endif()
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS}")
if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
if (APPLE)

View file

@ -46,9 +46,9 @@ INCLUDEPATH += $$WALLET_ROOT/include \
$$WALLET_ROOT/src
HEADERS += \
filter.h \
clipboardAdapter.h \
oscursor.h \
src/main/filter.h \
src/main/clipboardAdapter.h \
src/main/oscursor.h \
src/libwalletqt/WalletManager.h \
src/libwalletqt/Wallet.h \
src/libwalletqt/PendingTransaction.h \
@ -57,8 +57,8 @@ HEADERS += \
src/libwalletqt/QRCodeImageProvider.h \
src/libwalletqt/Transfer.h \
src/NetworkType.h \
oshelper.h \
TranslationManager.h \
src/main/oshelper.h \
src/TranslationManager.h \
src/model/TransactionHistoryModel.h \
src/model/TransactionHistorySortFilterModel.h \
src/QR-Code-generator/BitBuffer.hpp \
@ -72,8 +72,8 @@ HEADERS += \
src/libwalletqt/SubaddressAccount.h \
src/zxcvbn-c/zxcvbn.h \
src/libwalletqt/UnsignedTransaction.h \
Logger.h \
MainApp.h \
src/main/Logger.h \
src/main/MainApp.h \
src/qt/FutureScheduler.h \
src/qt/ipc.h \
src/qt/KeysFiles.h \
@ -83,18 +83,18 @@ HEADERS += \
src/qt/MoneroSettings.h \
src/qt/TailsOS.h
SOURCES += main.cpp \
filter.cpp \
clipboardAdapter.cpp \
oscursor.cpp \
SOURCES += src/main/main.cpp \
src/main/filter.cpp \
src/main/clipboardAdapter.cpp \
src/main/oscursor.cpp \
src/libwalletqt/WalletManager.cpp \
src/libwalletqt/Wallet.cpp \
src/libwalletqt/PendingTransaction.cpp \
src/libwalletqt/TransactionHistory.cpp \
src/libwalletqt/TransactionInfo.cpp \
src/libwalletqt/QRCodeImageProvider.cpp \
oshelper.cpp \
TranslationManager.cpp \
src/main/oshelper.cpp \
src/TranslationManager.cpp \
src/model/TransactionHistoryModel.cpp \
src/model/TransactionHistorySortFilterModel.cpp \
src/QR-Code-generator/BitBuffer.cpp \
@ -108,8 +108,8 @@ SOURCES += main.cpp \
src/libwalletqt/SubaddressAccount.cpp \
src/zxcvbn-c/zxcvbn.c \
src/libwalletqt/UnsignedTransaction.cpp \
Logger.cpp \
MainApp.cpp \
src/main/Logger.cpp \
src/main/MainApp.cpp \
src/qt/FutureScheduler.cpp \
src/qt/ipc.cpp \
src/qt/KeysFiles.cpp \

View file

@ -113,8 +113,8 @@ target_compile_definitions(monero-gui
${Qt5Qml_DEFINITIONS}
)
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set(CMAKE_CXX_FLAGS "-std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
if(X11_FOUND)
target_link_libraries(monero-gui ${X11_LIBRARIES} pthread dl Xt xcb X11)

View file

@ -78,6 +78,8 @@
#include "QR-Code-scanner/QrCodeScanner.h"
#endif
#ifdef MONERO_GUI_STATIC
#include <QtPlugin>
#if defined(Q_OS_OSX)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
@ -90,7 +92,6 @@ 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)
@ -126,6 +127,8 @@ Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin)
Q_IMPORT_PLUGIN(QmlXmlListModelPlugin)
Q_IMPORT_PLUGIN(QMultimediaDeclarativeModule)
#endif
bool isIOS = false;
bool isAndroid = false;
bool isWindows = false;

View file

@ -1,255 +0,0 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>LeftPanel.qml</file>
<file>MiddlePanel.qml</file>
<file>images/download-white.png</file>
<file>images/download-white@2x.png</file>
<file>images/external-link-white.png</file>
<file>images/external-link-white@2x.png</file>
<file>images/minus-white.png</file>
<file>images/minus-white@2x.png</file>
<file>images/plus-white.png</file>
<file>images/plus-white@2x.png</file>
<file>components/Label.qml</file>
<file>images/whatIsIcon.png</file>
<file>images/whatIsIcon@2x.png</file>
<file>images/lockIcon.png</file>
<file>components/MenuButton.qml</file>
<file>pages/Account.qml</file>
<file>pages/Transfer.qml</file>
<file>pages/History.qml</file>
<file>pages/AddressBook.qml</file>
<file>pages/Mining.qml</file>
<file>components/NetworkStatusItem.qml</file>
<file>components/Input.qml</file>
<file>components/StandardButton.qml</file>
<file>components/LineEdit.qml</file>
<file>components/TipItem.qml</file>
<file>images/tip.png</file>
<file>components/Scroll.qml</file>
<file>components/MenuButtonDivider.qml</file>
<file>images/moneroIcon.png</file>
<file>components/StandardDropdown.qml</file>
<file>images/whiteDropIndicator.png</file>
<file>images/whiteDropIndicator@2x.png</file>
<file>components/CheckBox.qml</file>
<file>images/uncheckedIcon.png</file>
<file>images/uncheckedIcon@2x.png</file>
<file>components/DatePicker.qml</file>
<file>images/prevMonth.png</file>
<file>images/prevMonth@2x.png</file>
<file>components/TitleBar.qml</file>
<file>images/moneroLogo2.png</file>
<file>images/resize.png</file>
<file>images/resize@2x.png</file>
<file>images/resizeHovered.png</file>
<file>images/resizeHovered@2x.png</file>
<file>images/nextPage.png</file>
<file>images/nextPage@2x.png</file>
<file>lang/languages.xml</file>
<file>lang/flags/bd.png</file>
<file>lang/flags/bg.png</file>
<file>lang/flags/br.png</file>
<file>lang/flags/catalonia.png</file>
<file>lang/flags/cn.png</file>
<file>lang/flags/hr.png</file>
<file>lang/flags/hu.png</file>
<file>lang/flags/cz.png</file>
<file>lang/flags/dk.png</file>
<file>lang/flags/eg.png</file>
<file>lang/flags/esperanto.png</file>
<file>lang/flags/fi.png</file>
<file>lang/flags/fr.png</file>
<file>lang/flags/de.png</file>
<file>lang/flags/in.png</file>
<file>lang/flags/id.png</file>
<file>lang/flags/il.png</file>
<file>lang/flags/ir.png</file>
<file>lang/flags/irl.png</file>
<file>lang/flags/it.png</file>
<file>lang/flags/jp.png</file>
<file>lang/flags/ku.png</file>
<file>lang/flags/lt.png</file>
<file>lang/flags/nl.png</file>
<file>lang/flags/pk.png</file>
<file>lang/flags/ps.png</file>
<file>lang/flags/pl.png</file>
<file>lang/flags/pt.png</file>
<file>lang/flags/ro.png</file>
<file>lang/flags/ru.png</file>
<file>lang/flags/rs.png</file>
<file>lang/flags/sk.png</file>
<file>lang/flags/si.png</file>
<file>lang/flags/za.png</file>
<file>lang/flags/kr.png</file>
<file>lang/flags/es.png</file>
<file>lang/flags/se.png</file>
<file>lang/flags/tw.png</file>
<file>lang/flags/tr.png</file>
<file>lang/flags/ua.png</file>
<file>lang/flags/gb.png</file>
<file>lang/flags/us.png</file>
<file>lang/flags/pirate.png</file>
<file>pages/Receive.qml</file>
<file>pages/TxKey.qml</file>
<file>pages/SharedRingDB.qml</file>
<file>components/effects/ImageMask.qml</file>
<file>components/IconButton.qml</file>
<file>components/PasswordDialog.qml</file>
<file>components/InputDialog.qml</file>
<file>components/ProcessingSplash.qml</file>
<file>components/ProgressBar.qml</file>
<file>components/StandardDialog.qml</file>
<file>pages/Sign.qml</file>
<file>components/DaemonManagerDialog.qml</file>
<file>version.js</file>
<file>components/DaemonConsole.qml</file>
<file>components/QRCodeScanner.qml</file>
<file>components/Notifier.qml</file>
<file>components/TextBlock.qml</file>
<file>components/RemoteNodeEdit.qml</file>
<file>pages/Keys.qml</file>
<file>images/appicon.ico</file>
<file>images/card-background.png</file>
<file>images/card-background@2x.png</file>
<file>images/moneroLogo_white.png</file>
<file>images/question.png</file>
<file>images/question@2x.png</file>
<file>images/titlebarLogo.png</file>
<file>images/titlebarLogo@2x.png</file>
<file>pages/merchant/MerchantTitlebar.qml</file>
<file>images/menuButtonGradient.png</file>
<file>fonts/Roboto-Medium.ttf</file>
<file>fonts/Roboto-Regular.ttf</file>
<file>fonts/Roboto-Light.ttf</file>
<file>fonts/Roboto-Bold.ttf</file>
<file>fonts/RobotoMono-Medium.ttf</file>
<file>fonts/RobotoMono-Regular.ttf</file>
<file>fonts/RobotoMono-Light.ttf</file>
<file>fonts/RobotoMono-Bold.ttf</file>
<file>components/Style.qml</file>
<file>components/qmldir</file>
<file>components/InlineButton.qml</file>
<file>images/lightning.png</file>
<file>images/lightning@2x.png</file>
<file>images/logout.png</file>
<file>images/logout@2x.png</file>
<file>images/moneroIcon-28x28.png</file>
<file>images/moneroIcon-28x28@2x.png</file>
<file>images/lightning-white.png</file>
<file>images/lightning-white@2x.png</file>
<file>components/InputMulti.qml</file>
<file>components/LineEditMulti.qml</file>
<file>components/LabelButton.qml</file>
<file>components/LabelSubheader.qml</file>
<file>images/arrow-right-medium-white.png</file>
<file>images/arrow-right-medium-white@2x.png</file>
<file>images/rightArrow.png</file>
<file>images/rightArrow@2x.png</file>
<file>images/historyBorderRadius.png</file>
<file>components/CheckBox2.qml</file>
<file>components/TextPlain.qml</file>
<file>components/TextPlainArea.qml</file>
<file>js/TxUtils.js</file>
<file>images/warning.png</file>
<file>images/warning@2x.png</file>
<file>images/rightArrowInactive.png</file>
<file>images/rightArrowInactive@2x.png</file>
<file>js/Windows.js</file>
<file>js/Utils.js</file>
<file>components/RadioButton.qml</file>
<file>pages/settings/Settings.qml</file>
<file>pages/settings/SettingsWallet.qml</file>
<file>pages/settings/SettingsNode.qml</file>
<file>pages/settings/SettingsLog.qml</file>
<file>pages/settings/SettingsLayout.qml</file>
<file>pages/settings/SettingsInfo.qml</file>
<file>pages/settings/Navbar.qml</file>
<file>components/WarningBox.qml</file>
<file>images/miningxmr.png</file>
<file>images/miningxmr@2x.png</file>
<file>images/plus-in-circle-medium-white.png</file>
<file>images/plus-in-circle-medium-white@2x.png</file>
<file>pages/merchant/Merchant.qml</file>
<file>pages/merchant/MerchantCheckbox.qml</file>
<file>pages/merchant/MerchantTrackingList.qml</file>
<file>images/merchant/arrow_right.png</file>
<file>images/merchant/bg.png</file>
<file>images/merchant/input_box.png</file>
<file>fonts/FontAwesome/fa-brands-400.ttf</file>
<file>fonts/FontAwesome/fa-regular-400.ttf</file>
<file>fonts/FontAwesome/fa-solid-900.ttf</file>
<file>fonts/FontAwesome/FontAwesome.qml</file>
<file>fonts/FontAwesome/Object.qml</file>
<file>fonts/FontAwesome/qmldir</file>
<file>wizard/WizardAskPassword.qml</file>
<file>wizard/WizardController.qml</file>
<file>wizard/WizardCreateWallet1.qml</file>
<file>wizard/WizardCreateWallet2.qml</file>
<file>wizard/WizardCreateWallet3.qml</file>
<file>wizard/WizardCreateWallet4.qml</file>
<file>wizard/WizardCreateDevice1.qml</file>
<file>wizard/WizardDaemonSettings.qml</file>
<file>wizard/WizardHeader.qml</file>
<file>wizard/WizardHome.qml</file>
<file>wizard/WizardLanguage.qml</file>
<file>wizard/WizardLang.qml</file>
<file>wizard/WizardNav.qml</file>
<file>wizard/WizardWalletInput.qml</file>
<file>wizard/WizardRestoreWallet1.qml</file>
<file>wizard/WizardRestoreWallet2.qml</file>
<file>wizard/WizardRestoreWallet3.qml</file>
<file>wizard/WizardRestoreWallet4.qml</file>
<file>wizard/WizardSummary.qml</file>
<file>wizard/WizardSummaryItem.qml</file>
<file>wizard/WizardModeSelection.qml</file>
<file>wizard/WizardModeRemoteNodeWarning.qml</file>
<file>wizard/WizardModeBootstrap.qml</file>
<file>wizard/WizardMenuItem.qml</file>
<file>js/Wizard.js</file>
<file>components/LanguageSidebar.qml</file>
<file>images/world-flags-globe.png</file>
<file>images/langFlagGrey.png</file>
<file>images/restore-wallet-from-hardware@2x.png</file>
<file>images/restore-wallet-from-hardware.png</file>
<file>images/open-wallet-from-file@2x.png</file>
<file>images/open-wallet-from-file.png</file>
<file>images/restore-wallet@2x.png</file>
<file>images/restore-wallet.png</file>
<file>images/create-wallet@2x.png</file>
<file>images/create-wallet.png</file>
<file>images/remote-node.png</file>
<file>images/remote-node@2x.png</file>
<file>images/local-node.png</file>
<file>images/local-node@2x.png</file>
<file>images/local-node-full.png</file>
<file>images/local-node-full@2x.png</file>
<file>wizard/WizardNavProgressDot.qml</file>
<file>wizard/WizardOpenWallet1.qml</file>
<file>images/arrow-right-in-circle.png</file>
<file>images/arrow-right-in-circle@2x.png</file>
<file>images/themes/white/leftPanelBg.jpg</file>
<file>images/themes/white/middlePanelBg.jpg</file>
<file>images/right.svg</file>
<file>images/middlePanelShadow.png</file>
<file>images/themes/white/titlebarLogo@2x.png</file>
<file>images/themes/white/titlebarLogo.png</file>
<file>images/sidebar.svg</file>
<file>images/fullscreen.svg</file>
<file>images/close.svg</file>
<file>images/minimize.svg</file>
<file>images/themes/white/close.svg</file>
<file>images/themes/white/fullscreen.svg</file>
<file>images/themes/white/minimize.svg</file>
<file>images/themes/white/question.svg</file>
<file>images/themes/white/expand.svg</file>
<file>components/effects/ColorTransition.qml</file>
<file>components/effects/GradientBackground.qml</file>
<file>images/check-white.svg</file>
<file>images/copy.svg</file>
<file>images/edit.svg</file>
<file>images/arrow-right-in-circle-outline-medium-white.svg</file>
<file>images/tails-grey.png</file>
</qresource>
</RCC>