set(CMAKE_AUTOMOC ON)

include_directories(
    ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications
    ${CMAKE_CURRENT_SOURCE_DIR}
)

set(NotificationsMocks_SOURCES
    Mocks/MockModel.cpp
    Mocks/MockSource.cpp
    Mocks/MockNotification.cpp
    Mocks/MockActionModel.cpp
)
if(NOT ENABLE_QT6)
    set(NotificationsMocks_SOURCES
        ${NotificationsMocks_SOURCES}
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/Enums.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/ModelInterface.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/SourceInterface.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/NotificationInterface.h
    )
endif()

add_library(NotificationsMocks SHARED ${NotificationsMocks_SOURCES})

target_link_libraries(NotificationsMocks
    Qt${QT_VERSION_MAJOR}::Core
    ${LOMIRI_SHELL_API_LIB}
)

set(TestNotificationsPlugin_SOURCES
    TestNotificationsPlugin.cpp
)

add_library(TestNotificationsPlugin MODULE ${TestNotificationsPlugin_SOURCES})

target_link_libraries(TestNotificationsPlugin
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Quick
    ${LOMIRI_SHELL_API_LIB}
    NotificationsMocks
)

add_custom_target(TestNotificationsPluginQmldir ALL
    COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}"
    DEPENDS qmldir
)

add_subdirectory(Mocks)
