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

307 рядки
11 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. 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 src/packages/game/data/IZ_asset.c src/packages/game/data/IZ_asset.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. add_executable(
  196. asset-inv
  197. dependencies/minIni/dev/minIni.h
  198. dependencies/minIni/dev/minIni.c
  199. src/packages/common/IZ_common.h
  200. src/packages/asset-inv/main.c
  201. )
  202. target_link_libraries(
  203. server
  204. SDL2main
  205. SDL2
  206. libcrypto
  207. libssl
  208. websockets
  209. )
  210. if (WIN32)
  211. add_custom_command(TARGET game POST_BUILD
  212. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  213. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  214. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  215. add_custom_command(TARGET game POST_BUILD
  216. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  217. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}/SDL2_image.dll" # <--this is in-file
  218. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  219. add_custom_command(TARGET game POST_BUILD
  220. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  221. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.dll" # <--this is in-file
  222. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  223. add_custom_command(TARGET game POST_BUILD
  224. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  225. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release/portmidi.dll" # <--this is in-file
  226. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  227. add_custom_command(TARGET game POST_BUILD
  228. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  229. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  230. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  231. add_custom_command(TARGET game POST_BUILD
  232. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  233. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  234. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  235. add_custom_command(TARGET game POST_BUILD
  236. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  237. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  238. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  239. add_custom_command(TARGET server POST_BUILD
  240. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  241. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  242. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  243. add_custom_command(TARGET server POST_BUILD
  244. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  245. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  246. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  247. add_custom_command(TARGET server POST_BUILD
  248. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  249. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  250. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  251. add_custom_command(TARGET server POST_BUILD
  252. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  253. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  254. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  255. endif ()
  256. add_custom_command(TARGET game POST_BUILD
  257. COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..."
  258. "${PROJECT_SOURCE_DIR}/assets" # <--this is in-file
  259. $<TARGET_FILE_DIR:game>/assets) # <--this is out-file path
  260. add_custom_command(TARGET asset-inv POST_BUILD
  261. COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..."
  262. "${PROJECT_SOURCE_DIR}/assets" # <--this is in-file
  263. $<TARGET_FILE_DIR:game>/assets) # <--this is out-file path