set(CMAKE_AUTOMOC ON)

include_directories(
    ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher
    ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../Application/
)

set(LauncherMocks_SOURCES
    Mocks/MockLauncherModel.cpp
    Mocks/MockLauncherItem.cpp
    Mocks/MockQuickListModel.cpp
    Mocks/MockAppDrawerModel.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp
)
if(NOT ENABLE_QT6)
    set(LauncherMocks_SOURCES
        ${LauncherMocks_SOURCES}
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/LauncherModelInterface.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/LauncherItemInterface.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/QuickListModelInterface.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/AppDrawerModelInterface.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application/ApplicationManagerInterface.h
        ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application/ApplicationInfoInterface.h
    )
endif()

add_library(LauncherMocks SHARED ${LauncherMocks_SOURCES})

target_link_libraries(LauncherMocks
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
    ${LOMIRI_SHELL_API_LIB}
)

set(TestLauncherPlugin_SOURCES
    TestLauncherPlugin.cpp
)

add_library(TestLauncherPlugin MODULE ${TestLauncherPlugin_SOURCES})

target_link_libraries(TestLauncherPlugin
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Quick
    ${LOMIRI_SHELL_API_LIB}
    LauncherMocks
)

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