2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. cmake_minimum_required(VERSION 3.21)
  2. # Set your project name here
  3. project(izanagi C)
  4. set(CMAKE_C_STANDARD 11)
  5. if (WIN32)
  6. # TODO set arch on target instead of generator
  7. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  8. set(PROJECT_ARCH x64)
  9. else ()
  10. set(PROJECT_ARCH x86)
  11. endif ()
  12. endif ()
  13. add_definitions(
  14. -DIZ_APP_NAME="Izanagi"
  15. -DIZ_APP_DESCRIPTION="Run and gun game"
  16. -DIZ_APP_SERVER_DESCRIPTION="Dedicated server"
  17. -DIZ_PLAYERS=2
  18. )
  19. if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  20. add_definitions(-DIZ_DEBUG)
  21. endif()
  22. include_directories(
  23. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/include"
  24. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/include"
  25. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/include"
  26. "${PROJECT_SOURCE_DIR}/dependencies/minIni/dev"
  27. "${PROJECT_SOURCE_DIR}/dependencies/bdd-for-c"
  28. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/pm_common"
  29. "${PROJECT_SOURCE_DIR}/dependencies/spine-runtimes/spine-c/spine-c/include"
  30. "${PROJECT_SOURCE_DIR}/dependencies/getopt-for-windows"
  31. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/include"
  32. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/include"
  33. "${PROJECT_SOURCE_DIR}/dependencies/sqlite"
  34. )
  35. link_directories(
  36. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}"
  37. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}"
  38. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}"
  39. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release"
  40. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/lib/Release"
  41. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/lib"
  42. )
  43. add_executable(
  44. game
  45. dependencies/minIni/dev/minIni.h
  46. dependencies/minIni/dev/minIni.c
  47. dependencies/getopt-for-windows/getopt.h
  48. dependencies/getopt-for-windows/getopt.c
  49. src/packages/game/output/video/IZ_video.h
  50. src/packages/game/output/video/IZ_video.c
  51. src/packages/common/IZ_common.h
  52. src/packages/game/input/IZ_action.h
  53. src/packages/game/IZ_app.h
  54. src/packages/game/IZ_app.c
  55. src/packages/game/main.c
  56. src/packages/game/input/IZ_joystick.c
  57. src/packages/game/input/IZ_joystick.h
  58. src/packages/game/input/IZ_keyboard.c
  59. src/packages/game/input/IZ_keyboard.h
  60. src/packages/config/IZ_config.c
  61. src/packages/config/IZ_config.h
  62. src/packages/game/geometry/IZ_point2d.c
  63. src/packages/game/geometry/IZ_point2d.h
  64. src/packages/game/geometry/IZ_vector2d.c
  65. src/packages/game/geometry/IZ_vector2d.h
  66. src/packages/game/geometry/IZ_rect.c
  67. src/packages/game/geometry/IZ_rect.h
  68. src/packages/game/core/IZ_object.c
  69. src/packages/game/core/IZ_object.h
  70. src/packages/game/core/IZ_creature.c
  71. src/packages/game/core/IZ_creature.h
  72. src/packages/game/core/IZ_entity.c
  73. src/packages/game/core/IZ_entity.h
  74. src/packages/game/memory/IZ_pool.c
  75. src/packages/game/memory/IZ_pool.h
  76. src/packages/game/input/IZ_input.c
  77. src/packages/game/input/IZ_input.h
  78. src/packages/game/input/IZ_midi.c
  79. src/packages/game/input/IZ_midi.h
  80. src/packages/game/data/IZ_list.c
  81. src/packages/game/data/IZ_list.h
  82. src/packages/net/svc/IZ_wsclient.c
  83. src/packages/net/svc/IZ_wsclient.h
  84. src/packages/log/IZ_log.c
  85. src/packages/log/IZ_log.h
  86. src/packages/game/util/IZ_midi.c
  87. src/packages/game/util/IZ_midi.h
  88. src/packages/net/core/IZ_websocket.h
  89. src/packages/net/core/IZ_websocket.c
  90. src/packages/net/IZ_net_client.c src/packages/net/IZ_net_client.h src/packages/game/IZ_app_net.c src/packages/game/IZ_app_net.h src/packages/game/IZ_app_video.c src/packages/game/IZ_app_video.h src/packages/game/IZ_subsystem.h src/packages/game/IZ_app_input.c src/packages/game/IZ_app_input.h src/packages/game/IZ_app_config.c src/packages/game/IZ_app_config.h)
  91. target_link_libraries(
  92. game
  93. SDL2main
  94. SDL2
  95. SDL2_image
  96. SDL2_ttf
  97. portmidi
  98. libcrypto
  99. libssl
  100. websockets
  101. )
  102. add_executable(
  103. game-test-geometry
  104. dependencies/bdd-for-c/bdd-for-c.h
  105. src/packages/test/IZ_mock.h
  106. src/packages/test/IZ_test.h
  107. src/packages/game/geometry/IZ_point2d.h
  108. src/packages/game/geometry/IZ_point2d.c
  109. src/packages/game/geometry/IZ_rect.h
  110. src/packages/game/geometry/IZ_rect.c
  111. src/packages/game/geometry/IZ_vector2d.h
  112. src/packages/game/geometry/IZ_vector2d.c
  113. src/packages/game/geometry/geometry.test.c
  114. )
  115. add_executable(
  116. game-test-input
  117. dependencies/bdd-for-c/bdd-for-c.h
  118. src/packages/test/IZ_mock.h
  119. src/packages/test/IZ_test.h
  120. __mocks__/minIni.mock.h
  121. __mocks__/SDL_keyboard.mock.h
  122. __mocks__/SDL_events.mock.h
  123. __mocks__/SDL_joystick.mock.h
  124. __mocks__/SDL_stdinc.mock.h
  125. __mocks__/portmidi.mock.h
  126. src/packages/config/IZ_config.h
  127. src/packages/game/input/IZ_keyboard.h
  128. src/packages/game/input/IZ_keyboard.c
  129. src/packages/game/input/IZ_joystick.h
  130. src/packages/game/input/IZ_joystick.c
  131. src/packages/game/input/IZ_midi.h
  132. src/packages/game/input/IZ_midi.c
  133. src/packages/game/util/IZ_midi.c
  134. src/packages/game/util/IZ_midi.h
  135. src/packages/game/input/input.test.c
  136. )
  137. add_executable(
  138. game-test-output
  139. dependencies/bdd-for-c/bdd-for-c.h
  140. src/packages/test/IZ_mock.h
  141. src/packages/test/IZ_test.h
  142. __mocks__/minIni.mock.h
  143. __mocks__/SDL_stdinc.mock.h
  144. __mocks__/SDL_render.mock.h
  145. src/packages/config/IZ_config.h
  146. src/packages/game/output/video/IZ_video.h
  147. src/packages/game/output/video/IZ_video.c
  148. src/packages/game/output/output.test.c
  149. )
  150. add_executable(
  151. game-test-memory
  152. dependencies/bdd-for-c/bdd-for-c.h
  153. src/packages/test/IZ_mock.h
  154. src/packages/test/IZ_test.h
  155. src/packages/game/memory/IZ_pool.h
  156. src/packages/game/memory/IZ_pool.c
  157. src/packages/game/memory/memory.test.c
  158. src/packages/game/data/IZ_list.c
  159. src/packages/game/data/IZ_list.h
  160. )
  161. add_executable(
  162. game-test-data
  163. dependencies/bdd-for-c/bdd-for-c.h
  164. src/packages/test/IZ_mock.h
  165. src/packages/test/IZ_test.h
  166. src/packages/game/data/IZ_list.h
  167. src/packages/game/data/IZ_list.c
  168. src/packages/game/data/data.test.c
  169. )
  170. add_executable(
  171. server
  172. dependencies/sqlite/sqlite3.h
  173. dependencies/sqlite/sqlite3.c
  174. dependencies/minIni/dev/minIni.h
  175. dependencies/minIni/dev/minIni.c
  176. src/packages/log/IZ_log.h
  177. src/packages/log/IZ_log.c
  178. src/packages/server/main.c
  179. src/packages/server/IZ_app.c
  180. src/packages/server/IZ_app.h
  181. src/packages/server/IZ_app_config.h
  182. src/packages/server/IZ_app_config.c
  183. src/packages/net/svc/IZ_wsserver.c
  184. src/packages/net/svc/IZ_wsserver.h
  185. src/packages/net/core/IZ_websocket.h
  186. src/packages/net/core/IZ_websocket.c
  187. src/packages/config/IZ_config.h
  188. src/packages/config/IZ_config.c
  189. src/packages/net/IZ_net_server.c
  190. src/packages/net/IZ_net_server.h
  191. src/packages/server/db/IZ_repo.c
  192. src/packages/server/db/IZ_repo.h
  193. src/packages/server/IZ_subsystem.h
  194. )
  195. target_link_libraries(
  196. server
  197. SDL2main
  198. SDL2
  199. libcrypto
  200. libssl
  201. websockets
  202. )
  203. if (WIN32)
  204. add_custom_command(TARGET game POST_BUILD
  205. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  206. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  207. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  208. add_custom_command(TARGET game POST_BUILD
  209. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  210. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}/SDL2_image.dll" # <--this is in-file
  211. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  212. add_custom_command(TARGET game POST_BUILD
  213. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  214. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.dll" # <--this is in-file
  215. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  216. add_custom_command(TARGET game POST_BUILD
  217. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  218. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release/portmidi.dll" # <--this is in-file
  219. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  220. add_custom_command(TARGET game POST_BUILD
  221. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  222. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  223. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  224. add_custom_command(TARGET game POST_BUILD
  225. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  226. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  227. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  228. add_custom_command(TARGET game POST_BUILD
  229. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  230. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  231. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  232. add_custom_command(TARGET server POST_BUILD
  233. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  234. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  235. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  236. add_custom_command(TARGET server POST_BUILD
  237. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  238. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  239. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  240. add_custom_command(TARGET server POST_BUILD
  241. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  242. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  243. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  244. add_custom_command(TARGET server POST_BUILD
  245. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  246. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  247. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  248. endif ()
  249. add_custom_command(TARGET game POST_BUILD
  250. COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..."
  251. "${PROJECT_SOURCE_DIR}/assets" # <--this is in-file
  252. $<TARGET_FILE_DIR:game>/assets) # <--this is out-file path