Starter project for SDL2.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

CMakeLists.txt 1.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. cmake_minimum_required(VERSION 3.20)
  2. # Set your project name here
  3. project(izanagi C)
  4. set(CMAKE_C_STANDARD 11)
  5. include_directories(
  6. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/include"
  7. "${PROJECT_SOURCE_DIR}/dependencies/minIni/dev"
  8. "${PROJECT_SOURCE_DIR}/dependencies/bdd-for-c"
  9. )
  10. if (WIN32)
  11. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  12. set(PROJECT_ARCH x64)
  13. else ()
  14. set(PROJECT_ARCH x86)
  15. endif ()
  16. endif ()
  17. link_directories(
  18. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}"
  19. )
  20. add_executable(
  21. game
  22. dependencies/minIni/dev/minIni.h
  23. dependencies/minIni/dev/minIni.c
  24. src/packages/game/config/IZ_config.h
  25. src/packages/game/config/IZ_config.c
  26. src/packages/game/IZ_common.h
  27. src/packages/game/IZ_action.h
  28. src/packages/game/IZ_app.h
  29. src/packages/game/IZ_app.c
  30. src/packages/game/main.c
  31. )
  32. target_link_libraries(
  33. game
  34. SDL2main
  35. SDL2
  36. )
  37. add_executable(
  38. game-test
  39. src/packages/game/config/IZ_config.h
  40. src/packages/game/config/IZ_config.c
  41. dependencies/bdd-for-c/bdd-for-c.h
  42. src/packages/game-test/config/IZ_config.c
  43. )
  44. if (WIN32)
  45. add_custom_command(TARGET game POST_BUILD
  46. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  47. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  48. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  49. endif ()