cmake_minimum_required(VERSION 3.16)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/designsystem")

project(designsystem VERSION 0.1 LANGUAGES CXX)

find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)

qt_add_library(designsystem STATIC)

set(plain_qml_files
  AppText.qml
  AppIcon.qml
  AppPrimaryButton.qml
  AppSecondaryButton.qml
  AppGhostButton.qml
  AppIconButton.qml
  AppCard.qml
  AppCaption.qml
  AppHeadline.qml
  AppSubHeadline.qml
  AppLabel.qml
  AppLogo.qml
  AppWindow.qml
  AppComboBox.qml
)
set(qml_singletons
  Fonts.qml
  Theme.qml
)
set_source_files_properties(${qml_singletons}
    PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set(icons
    icons/wifi-medium-duotone.svg
    icons/cloud-check-duotone.svg
    icons/layout-duotone.svg
    icons/person-simple-run-duotone.svg
    icons/pen-duotone.svg
    icons/binoculars-duotone.svg
    icons/magic-wand-duotone.svg
    icons/list-duotone.svg
    icons/broom-duotone.svg
    icons/terminal-duotone.svg
    icons/caret-down-duotone.svg
    icons/caret-up-duotone.svg
    icons/caret-right-duotone.svg
    icons/caret-left-duotone.svg
    icons/navigation-arrow-duotone.svg
    icons/plus-duotone.svg
    icons/split-vertical-duotone.svg
    icons/split-horizontal-duotone.svg
    icons/x-circle-duotone.svg
    icons/tag-chevron-duotone.svg
    icons/flying-saucer-duotone.svg
    icons/arrow-fat-left-duotone.svg
    icons/arrow-fat-right-duotone.svg
    icons/arrow-fat-up-duotone.svg
    icons/arrow-fat-down-duotone.svg
    icons/book-open-text-duotone.svg
    icons/star-duotone.svg
    icons/bookmark-duotone.svg
    icons/book-duotone.svg
    icons/bookmarks-duotone.svg
    icons/file-plus-duotone.svg
    icons/magnifying-glass-minus-duotone.svg
    icons/magnifying-glass-plus-duotone.svg
    icons/stack-duotone.svg
    icons/squares-four-duotone.svg
    icons/speaker-high-duotone.svg
    icons/speaker-low-duotone.svg
    icons/speaker-x-duotone.svg
    icons/mouse-scroll-duotone.svg
    icons/camera-duotone.svg
    icons/selection-all-duotone.svg
    icons/command-duotone.svg
    icons/file-magnifying-glass-duotone.svg
    icons/folder-open-duotone.svg
    icons/flower-lotus-duotone.svg
    icons/git-branch-duotone.svg
    icons/trash-duotone.svg
    icons/arrows-out-duotone.svg
    icons/arrows-out-line-horizontal-duotone.svg
    icons/arrows-out-line-vertical-duotone.svg
    icons/sidebar-duotone.svg
    icons/yin-yang-duotone.svg

    icons/apple-logo-duotone.svg
    app-icons/safari.svg
    app-icons/vs-code.svg
    app-icons/ghostty.png
    app-icons/outlook.svg
    logos/FLOWY-3.svg
    logos/FLOWY-4.svg
    logos/FLOWY-5.svg
    logos/FLOWY-6.svg
)
set(fonts
    fonts/dotrice/Dotrice-Regular.otf
    fonts/dotrice/Dotrice-Bold.otf
    fonts/dotrice/Dotrice-Expanded.otf
    fonts/dotrice/Dotrice-Condensed.otf
    fonts/dotrice/Dotrice-Bold-Condensed.otf
    fonts/dotrice/Dotrice-Bold-Expanded.otf
    fonts/Plus_Jakarta_Sans/PlusJakartaSans-Italic-VariableFont_wght.ttf
    fonts/Plus_Jakarta_Sans/PlusJakartaSans-VariableFont_wght.ttf
)

qt_add_qml_module(designsystem
    URI DesignSystem
    RESOURCE_PREFIX /live.flowy/imports
    VERSION 1.0
    QML_FILES ${plain_qml_files} ${qml_singletons}
    RESOURCES ${icons} ${fonts}
)
target_link_libraries(designsystem
    PRIVATE
    Qt6::Quick
)

target_compile_definitions(designsystem
    PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
