2020-10-07 10:36:04 +00:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
if(NOT DEPENDS)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
else()
|
|
|
|
add_executable(Qt5::moc IMPORTED)
|
|
|
|
set_target_properties(Qt5::moc PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${NATIVE_BIN_PATH}/moc")
|
|
|
|
|
|
|
|
add_executable(Qt5::rcc IMPORTED)
|
|
|
|
set_target_properties(Qt5::rcc PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${NATIVE_BIN_PATH}/rcc")
|
|
|
|
|
|
|
|
add_executable(Qt5::uic IMPORTED)
|
|
|
|
set_target_properties(Qt5::uic PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${NATIVE_BIN_PATH}/uic")
|
|
|
|
endif()
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
# pthread
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2022-05-24 16:02:02 +00:00
|
|
|
set(QT_COMPONENTS
|
2021-06-25 14:14:49 +00:00
|
|
|
Core
|
|
|
|
Widgets
|
|
|
|
Gui
|
|
|
|
Network
|
|
|
|
Svg
|
|
|
|
WebSockets
|
|
|
|
)
|
|
|
|
|
|
|
|
if (WITH_SCANNER)
|
2022-05-24 16:02:02 +00:00
|
|
|
list(APPEND QT_COMPONENTS
|
2021-06-25 14:14:49 +00:00
|
|
|
Multimedia
|
|
|
|
MultimediaWidgets)
|
|
|
|
endif()
|
|
|
|
|
2022-05-24 16:06:34 +00:00
|
|
|
find_package(Qt6 COMPONENTS ${QT_COMPONENTS} SvgWidgets)
|
2022-05-24 16:02:02 +00:00
|
|
|
if (NOT Qt6_FOUND)
|
|
|
|
find_package(Qt5 5.15 REQUIRED COMPONENTS ${QT_COMPONENTS})
|
|
|
|
endif()
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2022-03-03 22:27:54 +00:00
|
|
|
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
|
|
|
|
add_subdirectory(third-party/singleapplication)
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
add_subdirectory(openpgp)
|
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
IF(DEPENDS)
|
|
|
|
# AutoRCC is broken in depends builds.
|
|
|
|
# RCC path in Options is an apparent Qt bug. It appears to ignore IMPORTED_LOCATION set earlier.
|
|
|
|
qt_add_resources(RESOURCES
|
|
|
|
assets.qrc assets_tor.qrc ui/qdarkstyle/style.qrc ui/BreezeStyleSheets/breeze.qrc
|
|
|
|
OPTIONS "${NATIVE_BIN_PATH}/rcc")
|
|
|
|
else()
|
|
|
|
qt_add_resources(RESOURCES assets.qrc assets_tor.qrc)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_library(ICONV_LIBRARIES iconv)
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
# Compile source files (.h/.cpp)
|
|
|
|
file(GLOB SOURCE_FILES
|
|
|
|
"*.h"
|
|
|
|
"*.cpp"
|
2021-05-02 18:22:38 +00:00
|
|
|
"api/*.h"
|
|
|
|
"api/*.cpp"
|
2020-10-07 10:36:04 +00:00
|
|
|
"utils/*.h"
|
|
|
|
"utils/*.cpp"
|
2021-05-25 13:06:38 +00:00
|
|
|
"utils/os/*.h"
|
|
|
|
"utils/os/*.cpp"
|
2020-10-07 10:36:04 +00:00
|
|
|
"libwalletqt/*.h"
|
|
|
|
"libwalletqt/*.cpp"
|
|
|
|
"daemon/*.h"
|
|
|
|
"daemon/*.cpp"
|
|
|
|
"model/*.h"
|
|
|
|
"model/*.cpp"
|
|
|
|
"qt/*.h"
|
|
|
|
"qt/*.cpp"
|
|
|
|
"ui/qdarkstyle/style.qrc"
|
|
|
|
"ui/BreezeStyleSheets/breeze.qrc"
|
|
|
|
"widgets/*.h"
|
|
|
|
"widgets/*.cpp"
|
|
|
|
"wizard/*.h"
|
|
|
|
"wizard/*.cpp"
|
|
|
|
"wallet/*.h"
|
|
|
|
"wallet/*.cpp"
|
|
|
|
"qrcode/*.h"
|
|
|
|
"qrcode/*.cpp"
|
|
|
|
"dialog/*.h"
|
|
|
|
"dialog/*.cpp"
|
2022-05-23 21:43:33 +00:00
|
|
|
"polyseed/*.h"
|
|
|
|
"polyseed/*.cpp"
|
|
|
|
"polyseed/*.c"
|
2021-07-10 13:48:10 +00:00
|
|
|
"qrcode_scanner/QrCodeUtils.cpp"
|
|
|
|
"qrcode_scanner/QrCodeUtils.h"
|
2020-10-07 10:36:04 +00:00
|
|
|
)
|
|
|
|
|
2022-05-24 16:02:02 +00:00
|
|
|
if (WITH_SCANNER AND NOT Qt6_FOUND)
|
2021-06-25 14:14:49 +00:00
|
|
|
file(GLOB SCANNER_FILES
|
|
|
|
"qrcode_scanner/*.h"
|
|
|
|
"qrcode_scanner/*.cpp")
|
|
|
|
|
|
|
|
list(APPEND SOURCE_FILES
|
|
|
|
${SCANNER_FILES})
|
|
|
|
endif()
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
set(EXECUTABLE_FLAG)
|
|
|
|
if(MINGW)
|
|
|
|
set(EXECUTABLE_FLAG WIN32)
|
|
|
|
|
|
|
|
set(ICON ${PROJECT_SOURCE_DIR}/src/assets/images/appicons/appicon.ico)
|
|
|
|
set(ICON_RC ${CMAKE_CURRENT_BINARY_DIR}/icon.rc)
|
|
|
|
set(ICON_RES ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
|
|
|
|
file(WRITE ${ICON_RC} "IDI_ICON1 ICON DISCARDABLE \"${ICON}\"")
|
2022-05-24 16:02:02 +00:00
|
|
|
find_program(Qt_WINDRES_EXECUTABLE NAMES windres x86_64-w64-mingw32-windres REQUIRED CMAKE_FIND_ROOT_PATH_BOTH)
|
|
|
|
add_custom_command(OUTPUT ${ICON_RES} COMMAND ${Qt_WINDRES_EXECUTABLE} ${ICON_RC} ${ICON_RES} MAIN_DEPENDENCY ${ICON_RC})
|
2020-10-07 10:36:04 +00:00
|
|
|
list(APPEND RESOURCES ${ICON_RES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# mac os bundle
|
|
|
|
if(APPLE)
|
|
|
|
set(ICON ${PROJECT_SOURCE_DIR}/src/assets/images/appicons/appicon.icns)
|
|
|
|
set_source_files_properties(${ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
|
|
|
list(APPEND RESOURCES ${ICON})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(feather ${EXECUTABLE_FLAG} main.cpp
|
|
|
|
${SOURCE_FILES}
|
|
|
|
${RESOURCES}
|
2020-10-17 21:14:56 +00:00
|
|
|
${ASSETS_TOR}
|
2020-12-11 13:36:08 +00:00
|
|
|
)
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
# mac os bundle
|
|
|
|
set_target_properties(feather PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/utils/Info.plist"
|
2021-01-10 23:40:17 +00:00
|
|
|
LINK_FLAGS_RELEASE -s
|
2020-10-07 10:36:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set_property(TARGET feather PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
|
2022-05-24 16:02:02 +00:00
|
|
|
target_include_directories(feather PUBLIC ${QtGui_PRIVATE_INCLUDE_DIRS})
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
target_include_directories(feather PUBLIC
|
|
|
|
${CMAKE_BINARY_DIR}/src/feather_autogen/include
|
2022-06-02 12:50:33 +00:00
|
|
|
${ZLIB_INCLUDE_DIR}
|
2020-10-07 10:36:04 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/monero/include
|
|
|
|
${CMAKE_SOURCE_DIR}/monero/src
|
|
|
|
${CMAKE_SOURCE_DIR}/monero/external/easylogging++
|
|
|
|
${CMAKE_SOURCE_DIR}/monero/contrib/epee/include
|
|
|
|
${CMAKE_SOURCE_DIR}/src
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/daemon
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/libwalletqt
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/model
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/utils
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/qrcode
|
2022-06-02 12:50:33 +00:00
|
|
|
# ${X11_INCLUDE_DIR}
|
2020-10-07 10:36:04 +00:00
|
|
|
${Boost_INCLUDE_DIRS}
|
2022-05-24 16:02:02 +00:00
|
|
|
${QtCore_INCLUDE_DIRS}
|
|
|
|
${QtWidgets_INCLUDE_DIRS}
|
|
|
|
${QtGui_INCLUDE_DIRS}
|
|
|
|
${QtNetwork_INCLUDE_DIRS}
|
|
|
|
${QtSvg_INCLUDE_DIRS}
|
|
|
|
${QtSvgWidgets_INCLUDE_DIRS}
|
|
|
|
${QtXml_INCLUDE_DIRS}
|
|
|
|
${QtWebSockets_INCLUDE_DIRS}
|
2021-05-02 18:22:38 +00:00
|
|
|
${LIBZIP_INCLUDE_DIRS}
|
2022-06-02 12:50:33 +00:00
|
|
|
${ZLIB_INCLUDE_DIRS}
|
2021-07-10 13:48:10 +00:00
|
|
|
${ZBAR_INCLUDE_DIR}
|
2022-05-23 21:43:33 +00:00
|
|
|
${POLYSEED_INCLUDE_DIR}
|
2022-06-02 12:50:33 +00:00
|
|
|
${ZLIB_INCLUDE_DIR}
|
2020-10-07 10:36:04 +00:00
|
|
|
)
|
|
|
|
|
2021-06-25 14:14:49 +00:00
|
|
|
if(WITH_SCANNER)
|
|
|
|
target_include_directories(feather PUBLIC
|
2022-05-24 16:02:02 +00:00
|
|
|
${QtMultimedia_INCLUDE_DIRS}
|
|
|
|
${QtMultimediaWidgets_INCLUDE_DIRS}
|
2021-06-25 14:14:49 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-02-25 19:48:14 +00:00
|
|
|
if(SELF_CONTAINED)
|
|
|
|
target_compile_definitions(feather PRIVATE SELF_CONTAINED=1)
|
|
|
|
endif()
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
if(DONATE_BEG)
|
|
|
|
target_compile_definitions(feather PRIVATE DONATE_BEG=1)
|
|
|
|
endif()
|
|
|
|
|
2021-05-02 18:22:38 +00:00
|
|
|
if (CHECK_UPDATES)
|
|
|
|
target_compile_definitions(feather PRIVATE CHECK_UPDATES=1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LOCALMONERO)
|
|
|
|
target_compile_definitions(feather PRIVATE HAS_LOCALMONERO=1)
|
|
|
|
endif()
|
|
|
|
|
2022-02-23 16:04:23 +00:00
|
|
|
if(TOR_DIR)
|
2020-12-11 13:36:08 +00:00
|
|
|
target_compile_definitions(feather PRIVATE HAS_TOR_BIN=1)
|
2020-10-17 21:14:56 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(XMRIG)
|
|
|
|
target_compile_definitions(feather PRIVATE HAS_XMRIG=1)
|
2020-10-14 20:12:32 +00:00
|
|
|
endif()
|
|
|
|
|
2022-05-24 16:02:02 +00:00
|
|
|
if(WITH_SCANNER AND NOT Qt6_FOUND)
|
2021-06-25 14:14:49 +00:00
|
|
|
target_compile_definitions(feather PRIVATE WITH_SCANNER=1)
|
|
|
|
endif()
|
|
|
|
|
2021-05-02 18:22:38 +00:00
|
|
|
# TODO: PLACEHOLDER
|
|
|
|
target_compile_definitions(feather PRIVATE HAS_WEBSOCKET=1)
|
|
|
|
|
2021-10-29 11:54:13 +00:00
|
|
|
if(PLATFORM_INSTALLER)
|
|
|
|
target_compile_definitions(feather PRIVATE PLATFORM_INSTALLER=1)
|
|
|
|
endif()
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
if(HAVE_SYS_PRCTL_H)
|
|
|
|
target_compile_definitions(feather PRIVATE HAVE_SYS_PRCTL_H=1)
|
|
|
|
endif()
|
|
|
|
|
2020-10-09 00:37:05 +00:00
|
|
|
if(STATIC)
|
|
|
|
target_compile_definitions(feather PRIVATE STATIC=1)
|
|
|
|
endif()
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
target_compile_definitions(feather PRIVATE QT_NO_DEBUG=1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_compile_definitions(feather
|
|
|
|
PUBLIC
|
2022-05-24 16:02:02 +00:00
|
|
|
${QtCore_DEFINITIONS}
|
|
|
|
${QtWidgets_DEFINITIONS}
|
|
|
|
${QtGui_DEFINITIONS}
|
|
|
|
${QtNetwork_DEFINITIONS}
|
|
|
|
${QtSvg_DEFINITIONS}
|
|
|
|
${QtSvgWidgets_DEFINITIONS}
|
|
|
|
${QtXml_DEFINITIONS}
|
|
|
|
${QtWebSockets_DEFINITIONS}
|
2021-06-25 14:14:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if (WITH_SCANNER)
|
|
|
|
target_compile_definitions(feather PUBLIC
|
2022-05-24 16:02:02 +00:00
|
|
|
${QtMultimedia_DEFINITIONS}
|
|
|
|
${QtMultimediaWidgets_DEFINITIONS}
|
2021-06-25 14:14:49 +00:00
|
|
|
)
|
|
|
|
endif()
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2022-05-24 16:02:02 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QtWidgets_EXECUTABLE_COMPILE_FLAGS}")
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
# https://stackoverflow.com/questions/57766620/cmake-add-library-doesnt-initialize-static-global-variable
|
|
|
|
# so that contrib/monero-seed/src/gf_elem.cpp properly initializes. A better solution is welcome.
|
2022-02-07 20:03:05 +00:00
|
|
|
target_link_libraries(feather -Wl,--whole-archive monero-seed -Wl,--no-whole-archive)
|
2020-10-07 10:36:04 +00:00
|
|
|
else()
|
2022-02-07 20:03:05 +00:00
|
|
|
target_link_libraries(feather monero-seed)
|
2020-10-07 10:36:04 +00:00
|
|
|
endif()
|
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
MESSAGE(INFO "ZLIBBB ${ZLIB_LIBRARIES}")
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
target_link_libraries(feather
|
|
|
|
wallet_merged
|
|
|
|
${LMDB_LIBRARY}
|
|
|
|
epee
|
|
|
|
${UNBOUND_LIBRARY}
|
|
|
|
${SODIUM_LIBRARY}
|
|
|
|
easylogging
|
2022-07-07 21:23:10 +00:00
|
|
|
ringct
|
2020-10-07 10:36:04 +00:00
|
|
|
${Boost_LIBRARIES}
|
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
${EXTRA_LIBRARIES}
|
2022-05-24 16:02:02 +00:00
|
|
|
Qt::Core
|
|
|
|
Qt::Widgets
|
|
|
|
Qt::Gui
|
|
|
|
Qt::Network
|
|
|
|
Qt::Svg
|
|
|
|
Qt::WebSockets
|
2020-10-07 10:36:04 +00:00
|
|
|
openpgp
|
|
|
|
Threads::Threads
|
|
|
|
${QRENCODE_LIBRARY}
|
2021-05-02 18:22:38 +00:00
|
|
|
${ZLIB_LIBRARIES}
|
2021-07-10 13:48:10 +00:00
|
|
|
${ZBAR_LIBRARIES}
|
2022-05-23 21:43:33 +00:00
|
|
|
${POLYSEED_LIBRARY}
|
2022-03-03 22:27:54 +00:00
|
|
|
SingleApplication::SingleApplication
|
2022-06-02 12:50:33 +00:00
|
|
|
${ICU_LIBRARIES}
|
|
|
|
${ICONV_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
2020-10-07 10:36:04 +00:00
|
|
|
)
|
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
if(APPLE)
|
|
|
|
target_link_libraries(feather ${ICONV_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(feather ${LIBZIP_LIBRARIES} ${ZLIB_LIBRARIES})
|
|
|
|
|
2022-05-24 16:27:48 +00:00
|
|
|
if(Qt6_FOUND)
|
|
|
|
target_link_libraries(feather Qt::SvgWidgets)
|
|
|
|
endif()
|
|
|
|
|
2021-07-01 21:00:47 +00:00
|
|
|
if(DEVICE_TREZOR_READY)
|
|
|
|
target_link_libraries(feather ${TREZOR_DEP_LIBS})
|
|
|
|
endif()
|
|
|
|
|
2021-06-25 14:14:49 +00:00
|
|
|
if (WITH_SCANNER)
|
|
|
|
target_link_libraries(feather
|
2022-05-24 16:02:02 +00:00
|
|
|
Qt::Multimedia
|
|
|
|
Qt::MultimediaWidgets
|
2021-06-25 14:14:49 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-05-24 16:02:02 +00:00
|
|
|
if(NOT APPLE AND NOT Qt6_FOUND)
|
2020-10-07 10:36:04 +00:00
|
|
|
target_link_libraries(feather
|
2022-05-24 16:27:48 +00:00
|
|
|
Qt5::QSvgIconPlugin
|
|
|
|
Qt5::QSvgPlugin
|
2020-10-07 10:36:04 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-05-24 16:27:48 +00:00
|
|
|
if(STATIC AND NOT Qt6_FOUND)
|
2022-05-24 16:02:02 +00:00
|
|
|
if(NOT Qt6_FOUND)
|
2020-10-07 10:36:04 +00:00
|
|
|
target_link_libraries(feather
|
2022-05-24 16:27:48 +00:00
|
|
|
Qt5::QSvgIconPlugin
|
|
|
|
Qt5::QSvgPlugin)
|
2022-05-24 16:02:02 +00:00
|
|
|
endif()
|
2020-10-07 10:36:04 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
target_link_libraries(feather
|
2022-05-24 16:27:48 +00:00
|
|
|
Qt5::QXcbIntegrationPlugin)
|
2020-10-07 10:36:04 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
#if(X11_FOUND)
|
|
|
|
# target_link_libraries(feather ${X11_LIBRARIES})
|
|
|
|
#endif()
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
#if(APPLE)
|
|
|
|
# include(Deploy)
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
target_link_libraries(feather ${ZLIB_LIBRARIES})
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
install(TARGETS feather
|
|
|
|
DESTINATION ${CMAKE_INSTALL_PREFIX}
|
2021-06-25 14:14:49 +00:00
|
|
|
)
|