# CMake script for peptider
# Author: Olivier Langella
# Created: 28/05/2016

    
# tests : ./src/specoms -f /gorgone/pappso/moulon/database/Genome_Z_mays_5a.fasta -m /gorgone/pappso/data_extraction_pappso/mzXML/20120906_balliau_extract_1_A01_urnb-1.mzXML
#./src/specoms -f /espace/Genome_Z_mays_5a.fasta -m /espace/bio/mzxml/20120906_balliau_extract_1_A01_urnb-1.mzXML
# ./src/specoms -f /gorgone/pappso/moulon/archive_database/Genome_Z_mays_5a.fasta -m /gorgone/pappso/data_extraction_pappso/mzXML/20120906_balliau_extract_1_A01_urnb-1.mzxml -o /gorgone/pappso/versions_logiciels_pappso/specoms/20181127/test_morpheus.ods

configure_file (${CMAKE_SOURCE_DIR}/src/config.h.cmake ${CMAKE_SOURCE_DIR}/src/config.h)

# File list
set(CPP_FILES
    algorithms/fptree/fptree.cpp
    algorithms/fptree/threadedfptree.cpp
    algorithms/fptree/spectreeextractorreporterinterface.cpp
    core/digestion/peptidemodificationpipeline.cpp
    core/digestion/protopeptidedigestion.cpp
    core/peptide_database/peptidedatabase.cpp
    core/spectrum_matcher_legacy/missedcleavagefinder.cpp
    core/spectrum_matcher_legacy/peptidecandidate.cpp
    core/spectrum_matcher_legacy/peptidespectrumshifter.cpp
    core/spectrum_matcher_legacy/spectrummatcher.cpp
    core/spectrum_matcher_legacy/specxtractmatcherlegacy.cpp
    core/digestionpipeline.cpp
    core/fastafile.cpp
    core/fastasourcelist.cpp
    core/msspectrumreader.cpp
    core/runningdeepprot.cpp
    core/spectrumint.cpp
    core/spectrumintstore.cpp
    output/mzidentml.cpp
    output/mzidentmlallcandidates.cpp
    output/odsoutput.cpp
    output/odsspecsimilarities.cpp
    output/outputinterface.cpp
    output/psmcboroutput.cpp
    utils/decisionbox.cpp
    utils/deepprotparams.cpp
    utils/monitorcli.cpp
    utils/monitorinterface.cpp
    utils/utils.cpp
)


set(DEEPPROT_CLI_SRCS
    deepprot.cpp
    ${CPP_FILES}
)
add_executable(specoms ${DEEPPROT_CLI_SRCS}  )

target_link_libraries(specoms
    Qt6::Core
    Qt6::Qml
    Qt6::Gui
    OdsStream::Core
    QuaZip::QuaZip
    Qt6::Sql
    Qt6::Svg
    Qt6::Concurrent
    Qt6::PrintSupport
    OdsStream::Core
    SQLite3::SQLite3
    PappsoMSpp::Core
)

####################################
# GUI
#########################################
set(DEEPPROT_GUI_SRCS
	gui/deepprot-gui.cpp
	gui/main.cpp
	gui/workerthread.cpp
	gui/monitorgui.cpp
	gui/waiting_message_dialog/waitingmessagedialog.cpp
)

set (GUI_UIS
	gui/deepprot_main.ui
	gui/waiting_message_dialog/waiting_message_dialog.ui
)


# this will run uic on .ui files:
qt6_wrap_ui( GUI_UI_HDRS ${GUI_UIS} )
qt6_add_resources(specoms_RCC_SRCS deepprot.qrc)
add_executable(specoms-gui ${DEEPPROT_GUI_SRCS} ${GUI_UI_HDRS} ${specoms_RCC_SRCS} 
    ${CPP_FILES})
    
target_link_libraries(specoms-gui
    PappsoMSpp::Core
    Qt6::Core 
    Qt6::Qml
    Qt6::Gui
    Qt6::Widgets
    QuaZip::QuaZip
    Qt6::Sql
    Qt6::Concurrent
    OdsStream::Core
    SQLite3::SQLite3
)


if (MXE)
    target_compile_options(
        specoms-gui PRIVATE -mwindows
    )
    set_target_properties(specoms-gui PROPERTIES LINK_FLAGS "-Wl,--subsystem,windows ${CMAKE_EXE_LINKER_FLAGS}")
endif (MXE)

install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/specoms-gui DESTINATION bin)

configure_file (${CMAKE_SOURCE_DIR}/templates/share/applications/specoms.desktop.cmake ${CMAKE_BINARY_DIR}/templates/share/applications/specoms.desktop)


# INSTALL(FILES ${CMAKE_SOURCE_DIR}/doc/images/pappsoms-tools.svg DESTINATION share/pappsoms-tools)

install(FILES ${CMAKE_BINARY_DIR}/templates/share/applications/specoms.desktop DESTINATION share/applications)

