cmake_minimum_required(VERSION 3.16)
project(radar_simulation LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenGL  REQUIRED)
find_package(glfw3   REQUIRED)
find_package(Freetype REQUIRED)
find_package(GDAL    REQUIRED)

add_executable(radar_simulation
    src/main.cpp
    glad/src/glad.c
)

target_include_directories(radar_simulation PRIVATE
    ${CMAKE_SOURCE_DIR}/include
    ${FREETYPE_INCLUDE_DIRS}
    ${GDAL_INCLUDE_DIRS}
)

target_compile_definitions(radar_simulation PRIVATE
    MAP_DIR="${CMAKE_SOURCE_DIR}/map"
)

target_link_libraries(radar_simulation PRIVATE
    OpenGL::GL
    glfw
    Freetype::Freetype
    ${GDAL_LIBRARIES}
)

add_custom_target(copy_shaders ALL
    COMMAND ${CMAKE_COMMAND} -E copy_directory
            ${CMAKE_SOURCE_DIR}/shaders
            ${CMAKE_BINARY_DIR}/shaders
    COMMENT "Copying shaders to build directory"
)
add_dependencies(radar_simulation copy_shaders)

