cmake_minimum_required(VERSION 3.25)
project(M2-PT-DRP LANGUAGES CXX)


set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


include(FetchContent)
find_package(PkgConfig REQUIRED)


FetchContent_Declare(argparse GIT_REPOSITORY https://github.com/p-ranav/argparse.git)
FetchContent_MakeAvailable(argparse)
pkg_check_modules(MPG123 REQUIRED libmpg123)
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
pkg_check_modules(OpenSSL REQUIRED openssl)



add_executable(M2-PT-DRP
        source/main.cpp
        source/packets/audio/AudioPacketData.hpp
        source/utils/audio.cpp
        source/utils/audio.hpp
        source/Manager.cpp
        source/Manager.hpp
        source/packets/base/Packet.hpp
        source/behavior/events/types.hpp
        source/packets/base/Packet.cpp
        source/RemotePeer.hpp
        source/behavior/events/base/BaseEvent.hpp
        source/behavior/events/base/BaseEvent.hpp
        source/behavior/events/audio/AudioPacketsComparator.cpp
        source/behavior/events/audio/AudioPacketsComparator.hpp
        source/behavior/events/audio/AudioEvent.hpp
        source/behavior/events/audio/AudioEvent.cpp
        source/behavior/events/pong/PongEvent.cpp
        source/behavior/events/pong/PongEvent.hpp
        source/behavior/events/search/SearchEvent.cpp
        source/behavior/events/search/SearchEvent.hpp
        source/behavior/events/info/InfoEvent.cpp
        source/behavior/events/info/InfoEvent.hpp
        source/behavior/tasks/types.hpp
        source/behavior/tasks/base/BaseTask.hpp
        source/behavior/tasks/server/ServerTask.cpp
        source/behavior/tasks/server/ServerTask.hpp
        source/behavior/tasks/undefined/UndefinedTask.cpp
        source/behavior/tasks/undefined/UndefinedTask.hpp
        source/behavior/tasks/client/ClientTask.cpp
        source/behavior/tasks/client/ClientTask.hpp
        source/Context.hpp
        source/utils/CacheMap.hpp
        source/packets/search/SearchPacketData.hpp
        source/packets/base/PacketContent.cpp
        source/packets/base/PacketContent.hpp
        source/packets/base/SecurityMode.hpp
        source/packets/base/PacketData.hpp
        source/packets/info/InfoPacketData.hpp
        source/utils/time/Chrony.cpp
        source/utils/time/Chrony.hpp
)
target_include_directories(M2-PT-DRP PRIVATE
        source
        ${MPG123_INCLUDE_DIRS}
        ${PORTAUDIO_INCLUDE_DIRS}
        ${OPENSSL_INCLUDE_DIRS}
)
target_link_libraries(M2-PT-DRP PRIVATE
        argparse
        ${MPG123_LIBRARIES}
        ${PORTAUDIO_LIBRARIES}
        ${OPENSSL_LIBRARIES}
)
