Starter project for SDL2.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

97 rindas
2.5 KiB

  1. cmake_minimum_required(VERSION 3.21)
  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. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/pm_common"
  10. )
  11. if (WIN32)
  12. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  13. set(PROJECT_ARCH x64)
  14. else ()
  15. set(PROJECT_ARCH x86)
  16. endif ()
  17. endif ()
  18. link_directories(
  19. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}"
  20. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release"
  21. )
  22. add_executable(
  23. game
  24. dependencies/minIni/dev/minIni.h
  25. dependencies/minIni/dev/minIni.c
  26. src/packages/game/output/IZ_video.h
  27. src/packages/game/output/IZ_video.c
  28. src/packages/game/IZ_common.h
  29. src/packages/game/IZ_action.h
  30. src/packages/game/IZ_app.h
  31. src/packages/game/IZ_app.c
  32. src/packages/game/main.c
  33. src/packages/game/input/IZ_joystick.c
  34. src/packages/game/input/IZ_joystick.h
  35. src/packages/game/input/IZ_keyboard.c
  36. src/packages/game/input/IZ_keyboard.h
  37. src/packages/game/IZ_config.c
  38. src/packages/game/IZ_config.h
  39. )
  40. target_link_libraries(
  41. game
  42. SDL2main
  43. SDL2
  44. )
  45. add_executable(
  46. game-test-output
  47. dependencies/bdd-for-c/bdd-for-c.h
  48. src/packages/test/IZ_mock.h
  49. src/packages/test/IZ_test.h
  50. __mocks__/minIni.mock.h
  51. src/packages/game/IZ_config.h
  52. src/packages/game/__mocks__/IZ_config.mock.h
  53. src/packages/game/output/IZ_video.h
  54. src/packages/game/output/IZ_video.c
  55. src/packages/game/output/output.test.c
  56. )
  57. add_executable(
  58. game-test-input
  59. dependencies/bdd-for-c/bdd-for-c.h
  60. src/packages/test/IZ_mock.h
  61. src/packages/test/IZ_test.h
  62. __mocks__/minIni.mock.h
  63. __mocks__/SDL_keyboard.mock.h
  64. __mocks__/SDL_events.mock.h
  65. __mocks__/SDL_joystick.mock.h
  66. src/packages/game/IZ_config.h
  67. src/packages/game/__mocks__/IZ_config.mock.h
  68. src/packages/game/input/IZ_keyboard.h
  69. src/packages/game/input/IZ_keyboard.c
  70. src/packages/game/input/IZ_joystick.h
  71. src/packages/game/input/IZ_joystick.c
  72. src/packages/game/input/input.test.c
  73. )
  74. if (WIN32)
  75. add_custom_command(TARGET game POST_BUILD
  76. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  77. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  78. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  79. endif ()