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. SDL2
  9. GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
  10. GIT_TAG 15ead9a40d09a1eb9972215cceac2bf29c9b77f6 # release-2.28.5
  11. FIND_PACKAGE_ARGS
  12. )
  13. FetchContent_Declare(
  14. SDL2_image
  15. GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git
  16. GIT_TAG 28b9daa15a59aa2829cd29944ca9ffbf049d7667 # release-2.8.1
  17. FIND_PACKAGE_ARGS
  18. )
  19. FetchContent_Declare(
  20. SDL2_ttf
  21. GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf.git
  22. GIT_TAG 89d1692fd8fe91a679bb943d377bfbd709b52c23 # release-2.20.2
  23. FIND_PACKAGE_ARGS
  24. )
  25. FetchContent_MakeAvailable(SDL2 SDL2_image SDL2_ttf)
  26. set(Boost_USE_MULTITHREADED ON)
  27. set(Boost_USE_STATIC_LIBS ON)
  28. set(Boost_USE_STATIC_RUNTIME OFF)
  29. find_package(Boost 1.74.0 REQUIRED COMPONENTS serialization program_options)
  30. add_executable(Snake WIN32 MACOSX_BUNDLE
  31. main.cxx
  32. SDL.cxx SDL.hxx
  33. SDLWindow.cxx SDLWindow.hxx
  34. SDLRenderer.cxx SDLRenderer.hxx
  35. game/GameState.hxx
  36. game/GameStateManager.cxx game/GameStateManager.hxx
  37. game/LoadingState.cxx game/LoadingState.hxx
  38. game/SplashState.cxx game/SplashState.hxx
  39. game/MenuState.cxx game/MenuState.hxx
  40. game/PlayingState.cxx game/PlayingState.hxx
  41. game/GameOverState.cxx game/GameOverState.hxx
  42. game/HighScoreState.cxx game/HighScoreState.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. )
  50. target_link_libraries(Snake PRIVATE
  51. SDL2::SDL2-static SDL2::SDL2main
  52. SDL2_image::SDL2_image-static
  53. SDL2_ttf::SDL2_ttf-static
  54. Boost::headers Boost::serialization Boost::program_options
  55. )