find_package(PkgConfig REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Widgets Xml LinguistTools)

set(PLUGIN_NAME "aptplugin")

include_directories(${PROJECT_SOURCE_DIR}/app/src)

add_library(${PLUGIN_NAME} SHARED 
    aptactionplugin.cpp
    aptactionplugin.h
    aptcacheparser.h aptcacheparser.cpp
    aptpackagesearch.h aptpackagesearch.cpp
    aptplugincontainer.h aptplugincontainer.cpp
    aptpluginfactory.cpp
    aptpluginfactory.h
    aptsearchplugin.h aptsearchplugin.cpp
    aptsearchpluginshortinputwidget.cpp
    aptsearchpluginshortinputwidget.h
    aptsearchpluginshortinputwidget.ui
    aptsearchscorecalculationstrategy.cpp
    aptsearchscorecalculationstrategy.h
    aptsettingswidget.cpp
    aptsettingswidget.h
    aptsettingswidget.ui
    availableversionplugin.cpp
    availableversionplugin.h
    commandlinepackagedb.h commandlinepackagedb.cpp
    complexscorecalculationstrategy.cpp
    complexscorecalculationstrategy.h
    dpkgparser.h dpkgparser.cpp
    iaptsearch.cpp
    iaptsearch.h
    installationtool.cpp
    installationtool.h
    installedfilterwidget.cpp
    installedfilterwidget.h
    installedfilterwidget.ui
    installedversionplugin.cpp
    installedversionplugin.h
    ipackage.cpp
    ipackage.h
    ipackagedb.cpp
    ipackagedb.h
    ipackagedetails.h
    ipackagedetails.cpp
    package.h package.cpp
    packagedescriptionplugin.h packagedescriptionplugin.cpp
    packagestatusplugin.cpp
    packagestatusplugin.h
    aptpackagebuilder.h
    aptpackagebuilder.cpp
    packagedetails.h packagedetails.cpp
)
 
qt_add_translations(${PLUGIN_NAME} 
   TS_FILES ${PROJECT_SOURCE_DIR}/translations/${PLUGIN_NAME}_de.ts 
)

target_link_libraries(${PLUGIN_NAME} PRIVATE Qt6::Widgets Qt6::Xml)

install(TARGETS ${PLUGIN_NAME} DESTINATION  ${PLUGIN_TARGET_DIR})
install(FILES 
    ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_NAME}_de.qm
    DESTINATION ${TRANSLATION_TARGET_DIR}
)
