cmake_minimum_required(VERSION 3.10)

# set the project name
project(packagesearch)


find_package(Qt6 REQUIRED COMPONENTS Core LinguistTools)

# can be used only starting qt6.7
# qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES de)
qt_standard_project_setup()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

if ($ENV{PACKAGESEARCH_BUILD_TYPE} MATCHES "release") 
    message(STATUS "Configuring relase build")
else()
    message(STATUS "Configuring debug build")
    add_compile_definitions(__DEBUG)
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/plugins)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(TRANSLATION_TARGET_DIR share/packagesearch/translations)
set(PLUGIN_TARGET_DIR lib/packagesearch)


add_subdirectory(app/src)
add_subdirectory(plugins/aptplugin)
add_subdirectory(plugins/filenameplugin)
add_subdirectory(plugins/screenshotplugin)

set(SOURCE_ICON_DIR app/icons)
set(TARGET_ICON_DIR share/pixmaps/packagesearch)
install(FILES
    ${SOURCE_ICON_DIR}/install-package.png
    ${SOURCE_ICON_DIR}/remove-package.png
    ${SOURCE_ICON_DIR}/clear.png
    ${SOURCE_ICON_DIR}/forward.png
    ${SOURCE_ICON_DIR}/packagesearch.png
    ${SOURCE_ICON_DIR}/back.png
    DESTINATION ${TARGET_ICON_DIR}
)

install(FILES
    ${SOURCE_ICON_DIR}/packagesearch.png
    ${SOURCE_ICON_DIR}/packagesearch.xpm
    DESTINATION share/pixmaps
)

install(FILES
    packagesearch.desktop
    DESTINATION share/applications
)

set(SOURCE_DOC_DIR doc)
set(TARGET_DOC_DIR share/doc/packagesearch) 
install(FILES
    README.md
    TODO
    ${SOURCE_DOC_DIR}/content.html
    DESTINATION ${TARGET_DOC_DIR}
)


install(FILES
    packagesearch.desktop
    DESTINATION share/applications
)

