project(webbrowser-plugin)

set(PLUGIN ubuntu-ui-extras-browser-plugin)

set(PLUGIN_SRC
    history-model.cpp
    history-matches-model.cpp
    history-timeframe-model.cpp
    history-host-model.cpp
    history-hostlist-model.cpp
    tabs-model.cpp
    plugin.cpp
)

add_library(${PLUGIN} MODULE ${PLUGIN_SRC})

qt5_use_modules(${PLUGIN} Core Qml Sql)

file(GLOB QML_FILES *.qml qmldir *.js)
install(TARGETS ${PLUGIN} DESTINATION ${WEBBROWSER_IMPORTS_DIR})
install(FILES ${QML_FILES} DESTINATION ${WEBBROWSER_IMPORTS_DIR})
install(DIRECTORY assets DESTINATION ${CMAKE_INSTALL_DATADIR}/webbrowser-app
        FILES_MATCHING PATTERN *.png)

# copy qml files over to build dir to be able to import them in tests
foreach(qmlFile ${QML_FILES})
  file(COPY ${qmlFile} DESTINATION ${CMAKE_BINARY_DIR}/src/Ubuntu/Components/Extras/Browser/)
endforeach(qmlFile)
