cmake_minimum_required(VERSION 3.10)
project(tank_battles_on_the_scrap_paper
    VERSION 1.0
    LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# ── SDL2 依赖 ──
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(SDL2_ttf REQUIRED)

# ── 源文件 ──
set(SOURCES
    tank_battles_on_the_scrap_paper/main.cpp
    tank_battles_on_the_scrap_paper/map.cpp
)

set(HEADERS
    tank_battles_on_the_scrap_paper/bullet.h
    tank_battles_on_the_scrap_paper/tank.h
    tank_battles_on_the_scrap_paper/map.h
    tank_battles_on_the_scrap_paper/data_config.h
)

# ── 可执行文件 ──
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})

target_link_libraries(${PROJECT_NAME} PRIVATE
    SDL2::SDL2
    SDL2_image::SDL2_image
    SDL2_mixer::SDL2_mixer
    SDL2_ttf::SDL2_ttf
)

# ── 复制资源文件到构建目录 ──
file(COPY
    tank_battles_on_the_scrap_paper/images/
    DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/images/
)

file(COPY
    tank_battles_on_the_scrap_paper/music/
    DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/music/
)
