CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. cmake_minimum_required(VERSION 3.27)
  2. project(Snake)
  3. set(CMAKE_CXX_STANDARD 23)
  4. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  5. set(CMAKE_CXX_EXTENSIONS OFF)
  6. include(FetchContent)
  7. FetchContent_Declare(
  8. Boost
  9. GIT_REPOSITORY https://github.com/boostorg/boost.git
  10. GIT_TAG a7090e8ce184501cfc9e80afa6cafb5bfd3b371c # boost-1.74.0
  11. FIND_PACKAGE_ARGS 1.74.0 REQUIRED COMPONENTS serialization program_options system
  12. )
  13. FetchContent_Declare(
  14. SDL2
  15. GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
  16. GIT_TAG 15ead9a40d09a1eb9972215cceac2bf29c9b77f6 # release-2.28.5
  17. FIND_PACKAGE_ARGS
  18. )
  19. FetchContent_Declare(
  20. SDL2_image
  21. GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git
  22. GIT_TAG 28b9daa15a59aa2829cd29944ca9ffbf049d7667 # release-2.8.1
  23. FIND_PACKAGE_ARGS
  24. )
  25. FetchContent_Declare(
  26. SDL2_ttf
  27. GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf.git
  28. GIT_TAG 89d1692fd8fe91a679bb943d377bfbd709b52c23 # release-2.20.2
  29. FIND_PACKAGE_ARGS
  30. )
  31. FetchContent_MakeAvailable(SDL2 SDL2_image SDL2_ttf Boost)
  32. add_executable(Snake WIN32
  33. main.cxx
  34. SDL.cxx SDL.hxx
  35. SDLWindow.cxx SDLWindow.hxx
  36. SDLRenderer.cxx SDLRenderer.hxx
  37. game/GameState.hxx
  38. game/GameStateManager.cxx game/GameStateManager.hxx
  39. game/LoadingState.cxx game/LoadingState.hxx
  40. game/SplashState.cxx game/SplashState.hxx
  41. game/MenuState.cxx game/MenuState.hxx
  42. game/PlayingState.cxx game/PlayingState.hxx
  43. game/DummyState.cxx game/DummyState.hxx
  44. game/AssetManager.cxx game/AssetManager.hxx
  45. game/ui/Button.cxx game/ui/Button.hxx
  46. game/ui/LineInput.cxx game/ui/LineInput.hxx
  47. game/ui/UiColor.hxx game/ui/UiColor.cxx
  48. game/HighScoreManager.cxx game/HighScoreManager.hxx
  49. game/GameOverState.cxx game/GameOverState.hxx
  50. )
  51. target_link_libraries(Snake PRIVATE
  52. SDL2::SDL2 SDL2::SDL2main
  53. SDL2_image::SDL2_image
  54. SDL2_ttf::SDL2_ttf
  55. Boost::headers Boost::serialization Boost::program_options
  56. )