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-11-28 16:35:09 +00:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
find_package(Qt5 COMPONENTS QuickTest REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
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-12-19 15:26:03 +00:00
|
|
|
include/StatusQ/aggregator.h
|
2023-11-22 09:28:53 +00:00
|
|
|
include/StatusQ/concatmodel.h
|
2024-01-08 10:54:13 +00:00
|
|
|
include/StatusQ/fastexpressionfilter.h
|
2023-12-19 15:26:03 +00:00
|
|
|
include/StatusQ/fastexpressionrole.h
|
2024-01-08 11:16:16 +00:00
|
|
|
include/StatusQ/fastexpressionsorter.h
|
2024-01-04 12:05:54 +00:00
|
|
|
include/StatusQ/formatteddoubleproperty.h
|
2024-05-07 14:18:49 +00:00
|
|
|
include/StatusQ/functionaggregator.h
|
2024-07-15 13:17:21 +00:00
|
|
|
include/StatusQ/genericvalidator.h
|
2023-11-28 14:32:48 +00:00
|
|
|
include/StatusQ/groupingmodel.h
|
2023-10-24 09:08:30 +00:00
|
|
|
include/StatusQ/leftjoinmodel.h
|
2024-06-28 09:25:03 +00:00
|
|
|
include/StatusQ/modelcount.h
|
2024-06-04 10:08:52 +00:00
|
|
|
include/StatusQ/modelentry.h
|
2024-05-20 13:42:09 +00:00
|
|
|
include/StatusQ/modelsyncedcontainer.h
|
2023-04-14 08:18:56 +00:00
|
|
|
include/StatusQ/modelutilsinternal.h
|
2024-01-16 10:18:49 +00:00
|
|
|
include/StatusQ/movablemodel.h
|
2024-05-29 11:06:29 +00:00
|
|
|
include/StatusQ/objectproxymodel.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
|
2023-11-28 14:32:48 +00:00
|
|
|
include/StatusQ/singleroleaggregator.h
|
2024-06-04 10:08:52 +00:00
|
|
|
include/StatusQ/snapshotmodel.h
|
|
|
|
include/StatusQ/snapshotobject.h
|
2023-04-14 08:18:56 +00:00
|
|
|
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/sumaggregator.h
|
2024-02-20 13:02:36 +00:00
|
|
|
include/StatusQ/undefinedfilter.h
|
2023-11-28 16:35:09 +00:00
|
|
|
include/StatusQ/writableproxymodel.h
|
2023-04-14 08:18:56 +00:00
|
|
|
src/QClipboardProxy.cpp
|
2023-12-19 15:26:03 +00:00
|
|
|
src/aggregator.cpp
|
2023-11-22 09:28:53 +00:00
|
|
|
src/concatmodel.cpp
|
2024-01-08 10:54:13 +00:00
|
|
|
src/fastexpressionfilter.cpp
|
2023-12-19 15:26:03 +00:00
|
|
|
src/fastexpressionrole.cpp
|
2024-01-08 11:16:16 +00:00
|
|
|
src/fastexpressionsorter.cpp
|
2024-01-04 12:05:54 +00:00
|
|
|
src/formatteddoubleproperty.cpp
|
2024-05-07 14:18:49 +00:00
|
|
|
src/functionaggregator.cpp
|
2024-07-15 13:17:21 +00:00
|
|
|
src/genericvalidator.cpp
|
2023-11-28 14:32:48 +00:00
|
|
|
src/groupingmodel.cpp
|
2023-10-24 09:08:30 +00:00
|
|
|
src/leftjoinmodel.cpp
|
2024-06-28 09:25:03 +00:00
|
|
|
src/modelcount.cpp
|
2024-06-04 10:08:52 +00:00
|
|
|
src/modelentry.cpp
|
2023-04-14 08:18:56 +00:00
|
|
|
src/modelutilsinternal.cpp
|
2024-01-16 10:18:49 +00:00
|
|
|
src/movablemodel.cpp
|
2024-05-29 11:06:29 +00:00
|
|
|
src/objectproxymodel.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
|
2023-12-19 15:26:03 +00:00
|
|
|
src/singleroleaggregator.cpp
|
2024-06-04 10:08:52 +00:00
|
|
|
src/snapshotmodel.cpp
|
|
|
|
src/snapshotobject.cpp
|
2023-04-14 08:18:56 +00:00
|
|
|
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/sumaggregator.cpp
|
2024-02-20 13:02:36 +00:00
|
|
|
src/undefinedfilter.cpp
|
2023-11-28 16:35:09 +00:00
|
|
|
src/writableproxymodel.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
|
2024-03-01 02:04:36 +00:00
|
|
|
src/wallet/tokendata.cpp
|
|
|
|
src/wallet/tokendata.h
|
2023-04-14 08:18:56 +00:00
|
|
|
)
|
|
|
|
|
2024-03-14 23:26:06 +00:00
|
|
|
target_compile_features(StatusQ PRIVATE cxx_std_17)
|
|
|
|
|
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-11-28 16:35:09 +00:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
target_link_libraries(StatusQ PRIVATE
|
|
|
|
Qt5::QuickTest
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
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 ()
|