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
  AppTextField.qml
  AppTextArea.qml
  AppImage.qml
  AppLink.qml
  AppWarning.qml
  AppMenu.qml
  AppPane.qml
)
set(qml_singletons
  Fonts.qml
  Theme.qml
)
set_source_files_properties(${qml_singletons}
    PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set(icons
    icons/mono/basic/bookmark.svg
    icons/duotone/basic/bookmark.svg
    icons/duocolor/basic/bookmark.svg
    icons/filled/basic/bookmark.svg
    icons/line/basic/bookmark.svg
    icons/gestalt/basic/bookmark.svg

    #NOTE: please add individual icons here.

    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>)
