feather/src/CMakeLists.txt

360 lines
9.3 KiB
Text
Raw Normal View History

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
2022-12-21 15:15:22 +00:00
set(CMAKE_AUTORCC ON)
2022-06-02 12:50:33 +00:00
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
2023-10-12 22:12:42 +00:00
SvgWidgets
2021-06-25 14:14:49 +00:00
)
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()
2023-10-12 22:12:42 +00:00
find_package(Qt6 REQUIRED COMPONENTS ${QT_COMPONENTS})
2024-09-22 11:37:06 +00:00
if (NOT APPLE)
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
add_subdirectory(third-party/singleapplication)
endif()
2022-03-03 22:27:54 +00:00
if (CHECK_UPDATES)
add_subdirectory(openpgp)
endif()
qt_add_resources(RESOURCES assets.qrc assets_tor.qrc assets_docs.qrc)
2022-06-02 12:50:33 +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"
"utils/*.h"
"utils/*.cpp"
2021-05-25 13:06:38 +00:00
"utils/os/*.h"
"utils/os/*.cpp"
"libwalletqt/*.h"
"libwalletqt/*.cpp"
2023-11-16 15:26:58 +00:00
"libwalletqt/rows/*.h"
"libwalletqt/rows/*.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"
2022-12-21 15:15:22 +00:00
"monero_seed/argon2/blake2/*.c"
"monero_seed/argon2/*.c"
"monero_seed/*.cpp"
"monero_seed/*.c"
"monero_seed/*.hpp"
2023-11-30 14:01:39 +00:00
"plugins/*.cpp"
"plugins/*.h"
)
2023-11-30 14:01:39 +00:00
get_cmake_property(_vars VARIABLES)
set(PLUGIN_PREFIX "WITH_PLUGIN_")
foreach (_var ${_vars})
string(REGEX MATCH "^${PLUGIN_PREFIX}" _isPlugin ${_var})
2024-02-27 18:29:47 +00:00
if (NOT ${_var})
2023-11-30 14:01:39 +00:00
continue()
endif()
if(_isPlugin)
string(REPLACE "${PLUGIN_PREFIX}" "" _suffix ${_var})
string(TOLOWER "${_suffix}" _plugin)
message(STATUS "Adding plugin: ${_plugin}")
file (GLOB PLUGIN_FILES
"plugins/${_plugin}/*.cpp"
"plugins/${_plugin}/*.h"
)
list (APPEND SOURCE_FILES
${PLUGIN_FILES}
)
endif()
endforeach()
if (CHECK_UPDATES)
file(GLOB UPDATER_FILES
"utils/updater/*.h"
"utils/updater/*.cpp")
endif()
if (WITH_SCANNER)
file(GLOB QRCODE_UTILS_FILES
"qrcode/utils/*.h"
2023-12-02 18:28:31 +00:00
"qrcode/utils/*.cpp"
"wizard/offline_tx_signing/*.h"
"wizard/offline_tx_signing/*.cpp")
endif()
2023-10-12 22:12:42 +00:00
if (WITH_SCANNER)
2021-06-25 14:14:49 +00:00
file(GLOB SCANNER_FILES
2023-03-29 07:39:03 +00:00
"qrcode/scanner/*.h"
"qrcode/scanner/*.cpp")
2022-12-21 15:15:22 +00:00
endif()
2021-06-25 14:14:49 +00:00
2022-12-21 15:15:22 +00:00
list(APPEND SOURCE_FILES
${UPDATER_FILES}
${QRCODE_UTILS_FILES}
2022-12-21 15:15:22 +00:00
${SCANNER_FILES})
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})
list(APPEND RESOURCES ${ICON_RES})
endif()
add_executable(feather ${EXECUTABLE_FLAG} main.cpp
${SOURCE_FILES}
${RESOURCES}
${ASSETS_TOR}
2020-12-11 13:36:08 +00:00
)
set_target_properties(feather PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
2021-01-10 23:40:17 +00:00
LINK_FLAGS_RELEASE -s
)
2023-01-26 12:12:33 +00:00
if(STACK_TRACE)
message(STATUS "Stack Trace Enabled")
if (STATIC)
set_property(TARGET feather APPEND PROPERTY LINK_FLAGS "-Wl,--wrap=__cxa_throw")
endif()
endif()
target_include_directories(feather PUBLIC
${CMAKE_BINARY_DIR}/src/feather_autogen/include
${CMAKE_SOURCE_DIR}/monero/include
${CMAKE_SOURCE_DIR}/monero/src
2023-11-16 15:26:58 +00:00
${CMAKE_SOURCE_DIR}/monero/external
${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}/libwalletqt
${CMAKE_CURRENT_SOURCE_DIR}/model
${CMAKE_CURRENT_SOURCE_DIR}/utils
${CMAKE_CURRENT_SOURCE_DIR}/qrcode
${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}
2022-05-23 21:43:33 +00:00
${POLYSEED_INCLUDE_DIR}
2023-12-02 18:28:31 +00:00
${BCUR_INCLUDE_DIR}
2022-12-21 15:15:22 +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}
2023-10-10 12:21:11 +00:00
${ZXING_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()
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()
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)
endif()
2023-10-12 22:12:42 +00:00
if(WITH_SCANNER)
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()
2023-01-26 12:12:33 +00:00
if(STACK_TRACE)
target_compile_definitions(feather PRIVATE STACK_TRACE=1)
endif()
if(STATIC)
target_compile_definitions(feather PRIVATE STATIC=1)
endif()
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()
2023-07-20 16:13:09 +00:00
if (DEPENDS)
target_link_directories(feather PRIVATE "${LIB_DIR}")
endif()
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE
wallet_merged
${LMDB_LIBRARY}
epee
${UNBOUND_LIBRARY}
${SODIUM_LIBRARY}
easylogging
2022-07-07 21:23:10 +00:00
ringct
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES}
2022-05-24 16:02:02 +00:00
Qt::Core
Qt::Widgets
Qt::Gui
Qt::Network
Qt::Svg
Qt::WebSockets
2023-10-12 22:12:42 +00:00
Qt::SvgWidgets
Threads::Threads
${QRENCODE_LIBRARY}
2022-05-23 21:43:33 +00:00
${POLYSEED_LIBRARY}
2022-06-02 12:50:33 +00:00
${ICU_LIBRARIES}
2022-12-21 15:15:22 +00:00
${LIBZIP_LIBRARIES}
2022-06-02 12:50:33 +00:00
${ZLIB_LIBRARIES}
2023-12-02 18:28:31 +00:00
${BCUR_LIBRARY}
2022-12-21 15:15:22 +00:00
)
2024-09-22 11:37:06 +00:00
if(NOT APPLE)
target_link_libraries(feather PRIVATE SingleApplication::SingleApplication)
endif()
if(CHECK_UPDATES)
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE openpgp)
endif()
2022-12-21 15:15:22 +00:00
if(DEPENDS)
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE ${ICONV_LIBRARIES})
2022-06-02 12:50:33 +00:00
endif()
2021-07-01 21:00:47 +00:00
if(DEVICE_TREZOR_READY)
2024-09-29 07:36:18 +00:00
if (DEPENDS)
find_package(Protobuf CONFIG REQUIRED)
endif()
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE ${TREZOR_DEP_LIBS})
2021-07-01 21:00:47 +00:00
endif()
2021-06-25 14:14:49 +00:00
if (WITH_SCANNER)
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE
2022-05-24 16:02:02 +00:00
Qt::Multimedia
Qt::MultimediaWidgets
2023-10-10 12:21:11 +00:00
${ZXING_LIBRARIES}
2021-06-25 14:14:49 +00:00
)
endif()
if(STATIC AND APPLE)
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE Qt6::QDarwinCameraPermissionPlugin)
endif()
2023-10-12 22:12:42 +00:00
if(STATIC AND UNIX AND NOT APPLE)
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE Qt6::QComposePlatformInputContextPlugin)
2023-03-07 22:09:16 +00:00
endif()
2023-01-10 01:50:16 +00:00
if(DEPENDS AND APPLE)
# TODO: Needed for ___isOSVersionAtLeast
2024-01-04 14:03:26 +00:00
target_link_libraries(feather PRIVATE
2023-01-10 01:50:16 +00:00
${CMAKE_OSX_SYSROOT}/lib/darwin/libclang_rt.osx.a)
endif()
2023-06-28 10:50:32 +00:00
if(DEPENDS AND UNIX AND NOT APPLE)
target_link_libraries(XCB::XCB INTERFACE ${LIBXAU_LIBRARY})
endif()
2023-01-26 12:12:33 +00:00
if(STACK_TRACE AND CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_link_libraries(feather PRIVATE -rdynamic)
2023-01-26 12:12:33 +00:00
endif()
2023-04-20 12:59:44 +00:00
if(DEPENDS)
install(TARGETS feather
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
else()
install(TARGETS feather
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
if (UNIX AND NOT APPLE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/feather.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/images/appicons/256x256.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps RENAME "feather.png")
endif()
2024-01-04 14:03:26 +00:00
endif()
if(APPLE)
configure_file(${CMAKE_SOURCE_DIR}/contrib/macdeploy/Info.plist.in ${CMAKE_SOURCE_DIR}/contrib/macdeploy/Info.plist @ONLY)
set_target_properties(feather PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/contrib/macdeploy/Info.plist"
LINK_FLAGS_RELEASE -s
)
file(COPY "${CMAKE_SOURCE_DIR}/src/assets/images/appicons/appicon.icns" DESTINATION "${CMAKE_SOURCE_DIR}/installed/feather.app/Contents/Resources/" )
endif()
qt_finalize_executable(feather)