mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 09:23:18 +00:00
Switch from Qt6 to Slint
This commit is contained in:
parent
f8be14bcf8
commit
63bf267a22
107 changed files with 27532 additions and 2896 deletions
138
CMakeLists.txt
138
CMakeLists.txt
|
@ -1,105 +1,65 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(Mirai VERSION 1.0 LANGUAGES CXX)
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(mirai LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
|
||||
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
|
||||
|
||||
find_package(Qt6 6.7 REQUIRED COMPONENTS Quick Xml)
|
||||
|
||||
include_directories(src)
|
||||
include_directories(libs)
|
||||
|
||||
qt_standard_project_setup(REQUIRES 6.7)
|
||||
|
||||
|
||||
# -- Slint setup
|
||||
find_package(Slint QUIET)
|
||||
if (NOT Slint_FOUND)
|
||||
message("Slint could not be located in the CMake module search path. Downloading it from Git and building it locally")
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
Slint
|
||||
GIT_REPOSITORY https://github.com/slint-ui/slint.git
|
||||
# `release/1` will auto-upgrade to the latest Slint >= 1.0.0 and < 2.0.0
|
||||
# `release/1.0` will auto-upgrade to the latest Slint >= 1.0.0 and < 1.1.0
|
||||
GIT_TAG release/1
|
||||
SOURCE_SUBDIR api/cpp
|
||||
)
|
||||
FetchContent_MakeAvailable(Slint)
|
||||
endif (NOT Slint_FOUND)
|
||||
# -- End of Slint setup
|
||||
|
||||
add_library(mirai-core
|
||||
src/core/Mirai.h src/core/Mirai.cpp
|
||||
src/core/TaskItem.h src/core/TaskItem.cpp
|
||||
src/core/BaseResource.h src/core/BaseResource.cpp
|
||||
src/core/BaseFileResource.h
|
||||
src/core/StdFileResource.h
|
||||
src/core/TasksView.h src/core/TasksView.cpp
|
||||
src/core/TodoMd.h src/core/TodoMd.cpp
|
||||
src/core/utils.h src/core/utils.cpp
|
||||
lib/mirai-core/Mirai.h lib/mirai-core/Mirai.cpp
|
||||
lib/mirai-core/Config.h lib/mirai-core/Config.cpp
|
||||
lib/mirai-core/TaskItem.h lib/mirai-core/TaskItem.cpp
|
||||
lib/mirai-core/Day.h lib/mirai-core/Day.cpp
|
||||
lib/mirai-core/Event.h lib/mirai-core/Event.cpp
|
||||
lib/mirai-core/DateTime.h lib/mirai-core/DateTime.cpp
|
||||
lib/mirai-core/EventEmitter.h lib/mirai-core/EventEmitter.cpp
|
||||
lib/mirai-core/BaseResource.h lib/mirai-core/BaseResource.cpp
|
||||
lib/mirai-core/BaseFileResource.h
|
||||
lib/mirai-core/StdFileResource.h
|
||||
lib/mirai-core/TasksView.h lib/mirai-core/TasksView.cpp
|
||||
lib/mirai-core/TodoMd.h lib/mirai-core/TodoMd.cpp
|
||||
lib/mirai-core/utils.h lib/mirai-core/utils.cpp
|
||||
)
|
||||
|
||||
qt_add_executable(mirai
|
||||
src/main.cpp
|
||||
MANUAL_FINALIZATION
|
||||
target_include_directories(mirai-core PRIVATE "lib")
|
||||
|
||||
add_executable(mirai
|
||||
src/main.cpp
|
||||
src/UiState.cpp
|
||||
src/Utils.cpp
|
||||
)
|
||||
|
||||
set_property(TARGET mirai APPEND PROPERTY
|
||||
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
|
||||
)
|
||||
set_property(TARGET mirai PROPERTY SLINT_EMBED_RESOURCES embed-files)
|
||||
|
||||
qt_finalize_executable(mirai)
|
||||
target_link_libraries(mirai PRIVATE Slint::Slint)
|
||||
|
||||
set_source_files_properties(src/qml/styles/CatppuccinFrappe.qml PROPERTIES
|
||||
QT_QML_SINGLETON_TYPE TRUE
|
||||
)
|
||||
|
||||
set_source_files_properties(src/qml/styles/OneDark.qml PROPERTIES
|
||||
QT_QML_SINGLETON_TYPE TRUE
|
||||
)
|
||||
|
||||
set_source_files_properties(src/qml/styles/MiraiColorPalette.qml PROPERTIES
|
||||
QT_QML_SINGLETON_TYPE TRUE
|
||||
)
|
||||
|
||||
qt_add_qml_module(mirai
|
||||
URI Mirai
|
||||
#RESOURCE_PREFIX /qt/qml
|
||||
QML_FILES
|
||||
src/qml/Main.qml
|
||||
src/qml/MainPanel.qml
|
||||
src/qml/SideMenu.qml
|
||||
src/qml/ThemeLoader.qml
|
||||
src/qml/forms/TaskForm.qml
|
||||
src/qml/forms/FilesForm.qml
|
||||
src/qml/forms/TagsConfigForm.qml
|
||||
src/qml/components/TaskItem.qml
|
||||
src/qml/components/DatePicker.qml
|
||||
src/qml/components/DateField.qml
|
||||
src/qml/components/AppIcon.qml
|
||||
src/qml/components/AppLineEdit.qml
|
||||
src/qml/components/AppCheckbox.qml
|
||||
src/qml/components/AppText.qml
|
||||
src/qml/components/AppComboBox.qml
|
||||
src/qml/components/AppButton.qml
|
||||
src/qml/components/TabSelector.qml
|
||||
src/qml/components/Tag.qml
|
||||
src/qml/components/Calendar.qml
|
||||
src/qml/components/Modal.qml
|
||||
src/qml/styles/MiraiColorPalette.qml
|
||||
src/qml/styles/CatppuccinFrappe.qml
|
||||
src/qml/styles/OneDark.qml
|
||||
src/qml/views/ListView.qml
|
||||
src/qml/views/CalendarView.qml
|
||||
SOURCES
|
||||
src/Backend.h src/Backend.cpp
|
||||
src/TaskItem.h src/TaskItem.cpp
|
||||
src/Tag.h src/Tag.cpp
|
||||
src/TasksFile.h src/TasksFile.cpp
|
||||
src/AndroidFileResource.h
|
||||
RESOURCES
|
||||
src/images/calendar.png
|
||||
src/images/add.png
|
||||
src/images/settings.png
|
||||
src/images/visible.png
|
||||
src/images/not-visible.png
|
||||
)
|
||||
|
||||
target_link_libraries(mirai PRIVATE Qt6::Quick Qt6::Xml)
|
||||
target_include_directories(mirai PRIVATE "lib")
|
||||
target_link_libraries(mirai PRIVATE mirai-core)
|
||||
|
||||
# Tests
|
||||
add_subdirectory(libs/Catch2)
|
||||
add_executable(tests
|
||||
tests/format.cpp
|
||||
tests/saving.cpp
|
||||
slint_target_sources(
|
||||
mirai ui/appwindow.slint
|
||||
LIBRARY_PATHS vynui=${CMAKE_CURRENT_SOURCE_DIR}/lib/slint-vynui/index.slint
|
||||
)
|
||||
target_link_libraries(tests PRIVATE mirai-core)
|
||||
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
|
||||
|
||||
# On Windows, copy the Slint DLL next to the application binary so that it's found.
|
||||
if (WIN32)
|
||||
add_custom_command(TARGET mirai POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:mirai> $<TARGET_FILE_DIR:mirai> COMMAND_EXPAND_LISTS)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue