cmake_minimum_required(VERSION 3.21)

project(orkmode-ui VERSION 0.3 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)

find_package(Qt6 6.3 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2 Network)

qt_standard_project_setup(REQUIRES 6.5)

qt_add_executable(orkmode
    src/main.cpp
    src/p9client.cpp
    src/p9client.h
    src/orkclient.cpp
    src/orkclient.h
    src/documentmodel.cpp
    src/documentmodel.h
    src/thememanager.cpp
    src/thememanager.h
)

qt_add_qml_module(orkmode
    URI orkmode
    VERSION 1.0
    QML_FILES
        qml/Main.qml
        qml/OutlineView.qml
        qml/SettingsDialog.qml
        qml/DatePickerDialog.qml
)

target_link_libraries(orkmode PRIVATE
    Qt6::Core
    Qt6::Gui
    Qt6::Qml
    Qt6::Quick
    Qt6::QuickControls2
    Qt6::Network
)

# The QML module (URI "orkmode") copies its sources into a build-dir folder
# named "orkmode", which would collide with an executable also named
# "orkmode". Emit the binary into bin/ to keep the two apart.
set_target_properties(orkmode PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
