2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
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.

CMakeLists.txt 11 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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_vector2d.c
  63. src/packages/game/geometry/IZ_vector2d.h
  64. src/packages/game/geometry/IZ_rect.c
  65. src/packages/game/geometry/IZ_rect.h
  66. src/packages/game/core/IZ_object.c
  67. src/packages/game/core/IZ_object.h
  68. src/packages/game/core/IZ_creature.c
  69. src/packages/game/core/IZ_creature.h
  70. src/packages/game/core/IZ_entity.c
  71. src/packages/game/core/IZ_entity.h
  72. src/packages/game/memory/IZ_pool.c
  73. src/packages/game/memory/IZ_pool.h
  74. src/packages/game/input/IZ_input.c
  75. src/packages/game/input/IZ_input.h
  76. src/packages/game/input/IZ_midi.c
  77. src/packages/game/input/IZ_midi.h
  78. src/packages/game/data/IZ_list.c
  79. src/packages/game/data/IZ_list.h
  80. src/packages/net/svc/IZ_wsclient.c
  81. src/packages/net/svc/IZ_wsclient.h
  82. src/packages/log/IZ_log.c
  83. src/packages/log/IZ_log.h
  84. src/packages/game/util/IZ_midi.c
  85. src/packages/game/util/IZ_midi.h
  86. src/packages/net/core/IZ_websocket.h
  87. src/packages/net/core/IZ_websocket.c
  88. 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)
  89. target_link_libraries(
  90. game
  91. SDL2main
  92. SDL2
  93. SDL2_image
  94. SDL2_ttf
  95. portmidi
  96. libcrypto
  97. libssl
  98. websockets
  99. )
  100. add_executable(
  101. game-test-geometry
  102. dependencies/bdd-for-c/bdd-for-c.h
  103. src/packages/test/IZ_mock.h
  104. src/packages/test/IZ_test.h
  105. src/packages/game/geometry/IZ_rect.h
  106. src/packages/game/geometry/IZ_rect.c
  107. src/packages/game/geometry/IZ_vector2d.h
  108. src/packages/game/geometry/IZ_vector2d.c
  109. src/packages/game/geometry/geometry.test.c
  110. )
  111. add_executable(
  112. game-test-input
  113. dependencies/bdd-for-c/bdd-for-c.h
  114. src/packages/test/IZ_mock.h
  115. src/packages/test/IZ_test.h
  116. __mocks__/minIni.mock.h
  117. __mocks__/SDL_keyboard.mock.h
  118. __mocks__/SDL_events.mock.h
  119. __mocks__/SDL_joystick.mock.h
  120. __mocks__/SDL_stdinc.mock.h
  121. __mocks__/portmidi.mock.h
  122. src/packages/config/IZ_config.h
  123. src/packages/game/input/IZ_keyboard.h
  124. src/packages/game/input/IZ_keyboard.c
  125. src/packages/game/input/IZ_joystick.h
  126. src/packages/game/input/IZ_joystick.c
  127. src/packages/game/input/IZ_midi.h
  128. src/packages/game/input/IZ_midi.c
  129. src/packages/game/util/IZ_midi.c
  130. src/packages/game/util/IZ_midi.h
  131. src/packages/game/input/input.test.c
  132. )
  133. add_executable(
  134. game-test-output
  135. dependencies/bdd-for-c/bdd-for-c.h
  136. src/packages/test/IZ_mock.h
  137. src/packages/test/IZ_test.h
  138. __mocks__/minIni.mock.h
  139. __mocks__/SDL_stdinc.mock.h
  140. __mocks__/SDL_render.mock.h
  141. src/packages/config/IZ_config.h
  142. src/packages/game/output/video/IZ_video.h
  143. src/packages/game/output/video/IZ_video.c
  144. src/packages/game/output/output.test.c
  145. )
  146. add_executable(
  147. game-test-memory
  148. dependencies/bdd-for-c/bdd-for-c.h
  149. src/packages/test/IZ_mock.h
  150. src/packages/test/IZ_test.h
  151. src/packages/game/memory/IZ_pool.h
  152. src/packages/game/memory/IZ_pool.c
  153. src/packages/game/memory/memory.test.c
  154. src/packages/game/data/IZ_list.c
  155. src/packages/game/data/IZ_list.h
  156. )
  157. add_executable(
  158. game-test-data
  159. dependencies/bdd-for-c/bdd-for-c.h
  160. src/packages/test/IZ_mock.h
  161. src/packages/test/IZ_test.h
  162. src/packages/game/data/IZ_list.h
  163. src/packages/game/data/IZ_list.c
  164. src/packages/game/data/data.test.c
  165. )
  166. add_executable(
  167. server
  168. dependencies/sqlite/sqlite3.h
  169. dependencies/sqlite/sqlite3.c
  170. dependencies/minIni/dev/minIni.h
  171. dependencies/minIni/dev/minIni.c
  172. src/packages/log/IZ_log.h
  173. src/packages/log/IZ_log.c
  174. src/packages/server/main.c
  175. src/packages/server/IZ_app.c
  176. src/packages/server/IZ_app.h
  177. src/packages/server/IZ_app_config.h
  178. src/packages/server/IZ_app_config.c
  179. src/packages/net/svc/IZ_wsserver.c
  180. src/packages/net/svc/IZ_wsserver.h
  181. src/packages/net/core/IZ_websocket.h
  182. src/packages/net/core/IZ_websocket.c
  183. src/packages/config/IZ_config.h
  184. src/packages/config/IZ_config.c
  185. src/packages/net/IZ_net_server.c
  186. src/packages/net/IZ_net_server.h
  187. src/packages/server/db/IZ_repo.c
  188. src/packages/server/db/IZ_repo.h
  189. src/packages/server/IZ_subsystem.h
  190. )
  191. add_executable(
  192. asset-inv
  193. dependencies/minIni/dev/minIni.h
  194. dependencies/minIni/dev/minIni.c
  195. src/packages/common/IZ_common.h
  196. src/packages/asset-inv/main.c
  197. )
  198. target_link_libraries(
  199. server
  200. SDL2main
  201. SDL2
  202. libcrypto
  203. libssl
  204. websockets
  205. )
  206. if (WIN32)
  207. add_custom_command(TARGET game POST_BUILD
  208. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  209. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  210. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  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_image/lib/${PROJECT_ARCH}/SDL2_image.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_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.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/portmidi/Release/portmidi.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/libwebsockets/build/bin/Release/websockets.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/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.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/libcrypto-1_1-x64.dll" # <--this is in-file
  234. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  235. add_custom_command(TARGET server POST_BUILD
  236. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  237. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  238. $<TARGET_FILE_DIR:server>) # <--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/libwebsockets/build/bin/Release/websockets.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/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.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/libcrypto-1_1-x64.dll" # <--this is in-file
  250. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  251. endif ()
  252. add_custom_command(TARGET game POST_BUILD
  253. COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..."
  254. "${PROJECT_SOURCE_DIR}/assets" # <--this is in-file
  255. $<TARGET_FILE_DIR:game>/assets) # <--this is out-file path
  256. add_custom_command(TARGET asset-inv 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