cmake_minimum_required (VERSION 3.22)

set (CMAKE_CXX_STANDARD 11)

cmake_policy(SET CMP0072 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
project (scope)

# SDL2
find_package(SDL2 REQUIRED)
# find_package(SDL_ttf REQUIRED)

# Pulse

find_path(PULSEAUDIO_INCLUDE_DIR
        NAMES pulse/pulseaudio.h
        DOC "The PulseAudio include directory"
        )
find_library(PULSEAUDIO_LIBRARY
        NAMES pulse
        DOC "The PulseAudio library"
        )

include_directories(${PULSEAUDIO_INCLUDE_DIRS})

include_directories(${SDL2_INCLUDE_DIRS})
# include_directories(${SDL_TTF_INCLUDE_DIRS})

message(STATUS "<<${SDL2_INCLUDE_DIRS}>>")
# message(STATUS "<<${OPENGL_INCLUDE_DIR}>>")

# Main Executable

add_definitions("-Wall -O0 -g")
#add_definitions("-Wall -Werror -O0 -g")
add_executable(scope main_buffer_manager_class.cpp audio_buffer_manager_class.cpp 
  spectrum_buffer_manager_class.cpp piano_process.cpp
  main_class.cpp piano_class.cpp spectrum_class.cpp
  audio_class.cpp scope.cpp)

target_include_directories(scope PUBLIC ${CMAKE_SOURCE_DIR}/src)

# Libraries
target_link_libraries(scope ${SDL2_LIBRARIES})
target_link_libraries(scope m /usr/lib/)
target_link_libraries(scope /usr/lib/x86_64-linux-gnu/libSDL2_ttf-2.0.so)
# target_link_libraries(scope ${SDL_TTF_LIBRARIES})
target_link_libraries(scope pulse-simple pulse)
target_link_libraries(scope fftw3)

message(STATUS "<<${SDL2_LIBRARIES}>>")
