#############################################################
#############################################################
# CMake configuration
cmake_minimum_required(VERSION 3.18.4)

message("\n${BoldRed}Now configuring the MuropeptidicMsDataAnalysis plugin for ${TARGET}${ColourReset}\n")

############################################################
############################################################
# Basic information about project

# Compute the extended version number using git describe
include(${CMAKE_UTILS_PATH}/extended-version.cmake)

message("GIT_RECORD_IDENTIFIER: ${GIT_RECORD_IDENTIFIER}")

# This is required so that plugin_metadata.json and the plugin IID
# work fine together and metadata are written to the libMuropeptidicMsDataAnalysisPlugin
# library.
set(CMAKE_AUTOMOC On)

########################################################
# Files
set(PLUGIN_SRC MuropeptidicMsDataAnalysisPlugin.cpp)

add_library(
    MuropeptidicMsDataAnalysisPlugin MODULE
    ${PLUGIN_SRC} plugin_metadata.json
)

target_link_libraries(
    MuropeptidicMsDataAnalysisPlugin
    PRIVATE OpenMP::OpenMP_CXX
            -Wl,--no-as-needed
            XpertMass::Core
            XpertMass::Gui
            -Wl,--as-needed
            -Wl,--no-as-needed
            PappsoMSpp::Core
            PappsoMSpp::Gui
            -Wl,--as-needed
            -Wl,--no-as-needed
            IsoSpec++::IsoSpec++
            -Wl,--as-needed
            -Wl,--no-as-needed
            QScintilla::QScintilla
            -Wl,--as-needed
            QCustomPlotQt6::QCustomPlotQt6
            #QuaZip::QuaZip
            Qt6::Widgets
            Qt6::SvgWidgets
            Qt6::Svg
            Qt6::PrintSupport
            Qt6::Xml
            Qt6::Network
            # For pappsomspp Bruker timsTOF data handling
            Qt6::Sql
            Qt6::Concurrent
            Qt6::Qml
            # ${JS_QML_DEPENDENCIES}
            #
            # This is the object file obtained my compiling
            # the WindRes resource file using windres.exe
            # See corresponding MXE or WIN10UCRT64 toolchains.
            ${PLATFORM_SPECIFIC_LIB_FILES}
)

message("Setting include dirs to: ${CMAKE_SOURCE_DIR}/plugins")

target_include_directories(
    MuropeptidicMsDataAnalysisPlugin
    PRIVATE "${CMAKE_SOURCE_DIR}/plugins"
)

message("Plugin install directory: ${PROJECT_INSTALL_LIB_PLUGINS_DIR}")

install(
    TARGETS MuropeptidicMsDataAnalysisPlugin
    LIBRARY DESTINATION ${PROJECT_INSTALL_LIB_PLUGINS_DIR}
)
