2022-04-19 17:45:26 +00:00
|
|
|
cmake_minimum_required(VERSION 3.19)
|
|
|
|
|
|
|
|
project(StatusQ)
|
|
|
|
|
2023-04-14 08:18:56 +00:00
|
|
|
option(STATUSQ_BUILD_SANDBOX "Enable to build StatusQ Sandbox application" ON)
|
|
|
|
option(STATUSQ_BUILD_SANITY_CHECKER "Enable to build StatusQ Sanity Checker application" ON)
|
|
|
|
option(STATUSQ_BUILD_TESTS "Enable to build StatusQ UI auto tests" ON)
|
2022-07-21 12:55:54 +00:00
|
|
|
|
2022-07-19 07:28:07 +00:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2023-04-14 08:18:56 +00:00
|
|
|
# Although SHARED libraries set this to ON by default,
|
2023-10-24 08:55:25 +00:00
|
|
|
# all static libraries, that are built into this SHARED,
|
|
|
|
# (which is qzxing in our case) should also be build with -fPIC.
|
2023-04-14 08:18:56 +00:00
|
|
|
# This fixes it.
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
|
2023-03-07 16:08:38 +00:00
|
|
|
set(QZXING_USE_QML ON)
|
|
|
|
set(QZXING_MULTIMEDIA ON)
|
|
|
|
set(QZXING_USE_DECODER_QR_CODE ON)
|
|
|
|
|
2023-04-14 08:18:56 +00:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2022-07-19 10:29:18 +00:00
|
|
|
|
2023-04-14 08:18:56 +00:00
|
|
|
find_package(Qt5 COMPONENTS
|
|
|
|
Core Qml Gui Quick QuickControls2 REQUIRED)
|
2023-03-07 16:08:38 +00:00
|
|
|
|
2023-03-23 08:55:18 +00:00
|
|
|
add_subdirectory(../../vendor/SortFilterProxyModel SortFilterProxyModel)
|
|
|
|
add_subdirectory(../../vendor/qzxing/src qzxing)
|
2023-04-14 08:18:56 +00:00
|
|
|
|
2023-04-25 15:01:19 +00:00
|
|
|
target_compile_options(qzxing PRIVATE -w)
|
|
|
|
target_compile_options(SortFilterProxyModel PRIVATE -w)
|
|
|
|
|
2023-04-14 08:18:56 +00:00
|
|
|
### StatusQ library
|
|
|
|
### TODO: Move to a subdirectory for readability and better structure
|
|
|
|
|
|
|
|
if (NOT DEFINED STATUSQ_SHADOW_BUILD)
|
|
|
|
|
|
|
|
# About the STATUSQ_SHADOW_BUILD option.
|
|
|
|
#
|
|
|
|
# This is an option that defaults to OFF in Debug mode and ON otherwise.
|
|
|
|
# When ON:
|
|
|
|
# - resources are compiled into plugin
|
|
|
|
# - plugin is compiled in the ${CMAKE_BINARY_DIR}/StatusQ
|
|
|
|
# When OFF:
|
|
|
|
# - no resources are compiled, it's expected to use QML/JS sources
|
|
|
|
# - the plugin is compiled in src directory
|
|
|
|
#
|
|
|
|
# STATUSQ_SHADOW_BUILD mode is created for sandbox/storybook hot reloading
|
|
|
|
# without copying all qml files to build directory.
|
|
|
|
#
|
|
|
|
# It's expected for the app to add ${STATUSQ_MODULE_IMPORT_PATH} to
|
|
|
|
# QQmlApplicationEngine::addImportPath.
|
|
|
|
#
|
|
|
|
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
set(STATUSQ_SHADOW_BUILD OFF)
|
|
|
|
else()
|
|
|
|
set(STATUSQ_SHADOW_BUILD ON)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(STATUSQ_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/StatusQ")
|
|
|
|
|
|
|
|
if (${STATUSQ_SHADOW_BUILD})
|
|
|
|
set(STATUSQ_MODULE_PATH "${CMAKE_BINARY_DIR}/bin/StatusQ")
|
|
|
|
set(STATUSQ_MODULE_IMPORT_PATH ":/")
|
|
|
|
else()
|
|
|
|
set(STATUSQ_MODULE_PATH "${STATUSQ_SOURCE_PATH}")
|
|
|
|
set(STATUSQ_MODULE_IMPORT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT PROJECT_IS_TOP_LEVEL)
|
|
|
|
set(STATUSQ_MODULE_PATH "${STATUSQ_MODULE_PATH}" PARENT_SCOPE)
|
|
|
|
set(STATUSQ_MODULE_IMPORT_PATH "${STATUSQ_MODULE_IMPORT_PATH}" PARENT_SCOPE)
|
|
|
|
set(STATUSQ_SHADOW_BUILD "${STATUSQ_SHADOW_BUILD}" PARENT_SCOPE)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${STATUSQ_SHADOW_BUILD})
|
|
|
|
qt5_add_big_resources(STATUSQ_QRC_COMPILED
|
|
|
|
src/statusq.qrc
|
|
|
|
src/assets.qrc)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(StatusQ SHARED
|
|
|
|
${STATUSQ_QRC_COMPILED}
|
|
|
|
include/StatusQ/QClipboardProxy.h
|
2023-11-22 09:28:53 +00:00
|
|
|
include/StatusQ/concatmodel.h
|
2023-10-24 09:08:30 +00:00
|
|
|
include/StatusQ/leftjoinmodel.h
|
2023-04-14 08:18:56 +00:00
|
|
|
include/StatusQ/modelutilsinternal.h
|
2023-07-04 15:11:41 +00:00
|
|
|
include/StatusQ/permissionutilsinternal.h
|
2023-10-24 08:55:25 +00:00
|
|
|
include/StatusQ/rolesrenamingmodel.h
|
2023-04-14 08:18:56 +00:00
|
|
|
include/StatusQ/rxvalidator.h
|
|
|
|
include/StatusQ/statussyntaxhighlighter.h
|
|
|
|
include/StatusQ/statuswindow.h
|
2023-08-18 10:53:03 +00:00
|
|
|
include/StatusQ/stringutilsinternal.h
|
2023-11-04 20:25:10 +00:00
|
|
|
include/StatusQ/submodelproxymodel.h
|
2023-11-30 12:50:04 +00:00
|
|
|
include/StatusQ/aggregator.h
|
|
|
|
include/StatusQ/singleroleaggregator.h
|
|
|
|
include/StatusQ/sumaggregator.h
|
2023-04-14 08:18:56 +00:00
|
|
|
src/QClipboardProxy.cpp
|
2023-11-22 09:28:53 +00:00
|
|
|
src/concatmodel.cpp
|
2023-10-24 09:08:30 +00:00
|
|
|
src/leftjoinmodel.cpp
|
2023-04-14 08:18:56 +00:00
|
|
|
src/modelutilsinternal.cpp
|
2023-07-04 15:11:41 +00:00
|
|
|
src/permissionutilsinternal.cpp
|
2023-08-18 10:53:03 +00:00
|
|
|
src/plugin.cpp
|
2023-10-24 08:55:25 +00:00
|
|
|
src/rolesrenamingmodel.cpp
|
2023-04-14 08:18:56 +00:00
|
|
|
src/rxvalidator.cpp
|
|
|
|
src/statussyntaxhighlighter.cpp
|
|
|
|
src/statuswindow.cpp
|
2023-08-18 10:53:03 +00:00
|
|
|
src/stringutilsinternal.cpp
|
2023-11-04 20:25:10 +00:00
|
|
|
src/submodelproxymodel.cpp
|
2023-11-30 12:50:04 +00:00
|
|
|
src/aggregator.cpp
|
|
|
|
src/singleroleaggregator.cpp
|
|
|
|
src/sumaggregator.cpp
|
2023-10-17 19:09:45 +00:00
|
|
|
|
|
|
|
# wallet
|
|
|
|
src/wallet/managetokenscontroller.cpp
|
|
|
|
src/wallet/managetokenscontroller.h
|
|
|
|
src/wallet/managetokensmodel.cpp
|
|
|
|
src/wallet/managetokensmodel.h
|
2023-04-14 08:18:56 +00:00
|
|
|
)
|
|
|
|
|
2023-10-24 08:55:25 +00:00
|
|
|
set_target_properties(StatusQ PROPERTIES
|
2023-04-14 08:18:56 +00:00
|
|
|
ADDITIONAL_CLEAN_FILES bin/StatusQ/qmldir
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${STATUSQ_MODULE_PATH}
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${STATUSQ_MODULE_PATH}
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${STATUSQ_MODULE_PATH}
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${STATUSQ_MODULE_PATH}
|
|
|
|
)
|
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
find_library(AppKit AppKit)
|
|
|
|
find_library(Foundation Foundation)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${AppKit} ${Foundation})
|
|
|
|
target_sources(StatusQ PRIVATE src/statuswindow_osx.mm)
|
|
|
|
else ()
|
|
|
|
target_sources(StatusQ PRIVATE src/statuswindow_other.cpp)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${STATUSQ_SHADOW_BUILD})
|
|
|
|
set(COPY_QMLDIR_COMMAND
|
|
|
|
${CMAKE_COMMAND} -E copy
|
|
|
|
${STATUSQ_SOURCE_PATH}/qmldir
|
|
|
|
${STATUSQ_MODULE_PATH}/qmldir)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET StatusQ
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${COPY_QMLDIR_COMMAND}
|
|
|
|
COMMENT "Copying qmldir to binary directory")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
target_link_libraries(StatusQ PRIVATE
|
|
|
|
Qt5::Core
|
|
|
|
Qt5::Qml
|
|
|
|
Qt5::Gui
|
|
|
|
Qt5::Quick
|
|
|
|
Qt5::QuickControls2
|
|
|
|
SortFilterProxyModel
|
|
|
|
qzxing
|
|
|
|
)
|
|
|
|
|
2023-10-24 08:55:25 +00:00
|
|
|
target_include_directories(StatusQ PUBLIC include)
|
2023-04-14 08:18:56 +00:00
|
|
|
|
|
|
|
install(TARGETS StatusQ
|
|
|
|
RUNTIME DESTINATION StatusQ
|
|
|
|
LIBRARY DESTINATION StatusQ
|
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES src/StatusQ/qmldir
|
|
|
|
DESTINATION StatusQ
|
|
|
|
)
|
|
|
|
|
|
|
|
# https://doc.qt.io/qtcreator/creator-qml-modules-with-plugins.html#importing-qml-modules
|
|
|
|
set(QML_IMPORT_PATH
|
|
|
|
${CMAKE_SOURCE_DIR}/src;${QML_IMPORT_PATH}
|
|
|
|
CACHE STRING "")
|
|
|
|
|
|
|
|
### Add other subdirectories
|
|
|
|
|
|
|
|
if (${STATUSQ_BUILD_SANDBOX})
|
|
|
|
add_subdirectory(sandbox)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${STATUSQ_BUILD_SANITY_CHECKER})
|
|
|
|
add_subdirectory(sanity_checker)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${STATUSQ_BUILD_TESTS})
|
2023-11-23 11:38:09 +00:00
|
|
|
enable_testing()
|
2023-04-14 08:18:56 +00:00
|
|
|
add_subdirectory(tests)
|
|
|
|
endif ()
|