# 第36〜39章：三人称シューティング（TPS） / Chapters 36-39: the third-person shooter (TPS)
add_executable(tps
  src/main.cc
  src/collision3d.cc
  src/character_body.cc
  src/frustum.cc
  src/level.cc
  src/renderer.cc
  src/character.cc
  src/third_person_camera.cc
  src/enemy.cc
  src/effects.cc
  src/play_scene.cc
  src/hud.cc
  src/menu_scenes.cc)
target_include_directories(tps PRIVATE src)
target_link_libraries(tps PRIVATE engine)
enable_warnings(tps)
set_working_directory(tps)

# 配布（第39章）：cmake --install <build> --prefix <dir> --component tps で <dir>/tps/ に実行ファイルと使うデータを
# プロジェクトと同じ並びで置く（tpsは見つからなければ実行ファイルの隣のデータを使う）。
# Release: cmake -S . -B build-release -DCMAKE_BUILD_TYPE=Release（Visual Studio: --config Release）
# Packaging (chapter 39): cmake --install <build> --prefix <dir> --component tps puts the executable and the data it
# uses into <dir>/tps/, laid out like the project (tps falls back to the data next to its executable).
# Release: cmake -S . -B build-release -DCMAKE_BUILD_TYPE=Release (Visual Studio: --config Release)
install(TARGETS tps RUNTIME DESTINATION tps COMPONENT tps)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/engine/shaders DESTINATION tps/engine COMPONENT tps)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/assets/textures/sky DESTINATION tps/assets/textures COMPONENT tps)
install(FILES ${PROJECT_SOURCE_DIR}/assets/models/crate.glb ${PROJECT_SOURCE_DIR}/assets/models/barrel.glb
        DESTINATION tps/assets/models COMPONENT tps)
install(FILES ${PROJECT_SOURCE_DIR}/assets/LICENSE.txt DESTINATION tps/assets COMPONENT tps)
install(DIRECTORY assets shaders DESTINATION tps/games/tps COMPONENT tps)
install(FILES README.md DESTINATION tps/games/tps COMPONENT tps)
