2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

347 rivejä
12 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. set(PLATFORM WINDOWS)
  8. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  9. set(PROJECT_ARCH x64)
  10. add_definitions(
  11. -DIZ_WIN64
  12. )
  13. else ()
  14. set(PROJECT_ARCH x86)
  15. add_definitions(
  16. -DIZ_WIN32
  17. )
  18. endif ()
  19. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  20. set(PLATFORM MACOS)
  21. add_definitions(
  22. -DIZ_MACOS
  23. )
  24. else()
  25. set(PLATFORM UNIX)
  26. add_definitions(
  27. -DIZ_UNIX
  28. )
  29. endif ()
  30. add_definitions(
  31. -DIZ_APP_NAME="Izanagi"
  32. -DIZ_APP_DESCRIPTION="Run and gun game"
  33. -DIZ_APP_SERVER_DESCRIPTION="Dedicated server"
  34. -DIZ_PLAYERS=1
  35. )
  36. if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  37. add_definitions(-DIZ_DEBUG)
  38. endif()
  39. include_directories(
  40. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/include"
  41. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image"
  42. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/include"
  43. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/include"
  44. "${PROJECT_SOURCE_DIR}/dependencies/minIni/dev"
  45. "${PROJECT_SOURCE_DIR}/dependencies/bdd-for-c"
  46. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/pm_common"
  47. "${PROJECT_SOURCE_DIR}/dependencies/spine-runtimes/spine-c/spine-c/include"
  48. "${PROJECT_SOURCE_DIR}/dependencies/getopt-for-windows"
  49. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/include"
  50. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/include"
  51. "${PROJECT_SOURCE_DIR}/dependencies/sqlite"
  52. )
  53. if (WIN32)
  54. link_directories(
  55. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}"
  56. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}"
  57. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}"
  58. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release"
  59. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/lib/Release"
  60. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/lib"
  61. )
  62. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  63. include_directories(
  64. /usr/local/include
  65. /usr/local/include/SDL2
  66. /usr/local/include/openssl
  67. )
  68. link_directories(
  69. /usr/local/lib
  70. )
  71. endif()
  72. add_executable(
  73. game
  74. dependencies/minIni/dev/minIni.h
  75. dependencies/minIni/dev/minIni.c
  76. dependencies/getopt-for-windows/getopt.h
  77. dependencies/getopt-for-windows/getopt.c
  78. src/packages/game/output/video/IZ_video.h
  79. src/packages/game/output/video/IZ_video.c
  80. src/packages/common/IZ_common.h
  81. src/packages/game/input/IZ_action.h
  82. src/packages/game/IZ_app.h
  83. src/packages/game/IZ_app.c
  84. src/packages/game/main.c
  85. src/packages/game/input/IZ_joystick.c
  86. src/packages/game/input/IZ_joystick.h
  87. src/packages/game/input/IZ_keyboard.c
  88. src/packages/game/input/IZ_keyboard.h
  89. src/packages/config/IZ_config.c
  90. src/packages/config/IZ_config.h
  91. src/packages/game/geometry/IZ_vector2d.c
  92. src/packages/game/geometry/IZ_vector2d.h
  93. src/packages/game/geometry/IZ_rect.c
  94. src/packages/game/geometry/IZ_rect.h
  95. src/packages/game/core/IZ_object.c
  96. src/packages/game/core/IZ_object.h
  97. src/packages/game/core/IZ_creature.c
  98. src/packages/game/core/IZ_creature.h
  99. src/packages/game/core/IZ_entity.c
  100. src/packages/game/core/IZ_entity.h
  101. src/packages/game/memory/IZ_pool.c
  102. src/packages/game/memory/IZ_pool.h
  103. src/packages/game/input/IZ_input.c
  104. src/packages/game/input/IZ_input.h
  105. src/packages/game/input/IZ_midi.c
  106. src/packages/game/input/IZ_midi.h
  107. src/packages/game/data/IZ_list.c
  108. src/packages/game/data/IZ_list.h
  109. src/packages/net/svc/IZ_wsclient.c
  110. src/packages/net/svc/IZ_wsclient.h
  111. src/packages/log/IZ_log.c
  112. src/packages/log/IZ_log.h
  113. src/packages/game/util/IZ_midi.c
  114. src/packages/game/util/IZ_midi.h
  115. src/packages/net/core/IZ_websocket.h
  116. src/packages/net/core/IZ_websocket.c
  117. 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/asset/IZ_asset.c src/packages/game/asset/IZ_asset.h)
  118. if (WIN32)
  119. target_link_libraries(
  120. game
  121. SDL2main
  122. SDL2
  123. SDL2_image
  124. SDL2_ttf
  125. portmidi
  126. libcrypto
  127. libssl
  128. websockets
  129. )
  130. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  131. target_link_libraries(
  132. game
  133. SDL2main
  134. SDL2
  135. SDL2_image
  136. SDL2_ttf
  137. portmidi
  138. # libcrypto
  139. # libssl
  140. websockets
  141. )
  142. endif()
  143. add_executable(
  144. game-test-geometry
  145. dependencies/bdd-for-c/bdd-for-c.h
  146. src/packages/test/IZ_mock.h
  147. src/packages/test/IZ_test.h
  148. src/packages/game/geometry/IZ_rect.h
  149. src/packages/game/geometry/IZ_rect.c
  150. src/packages/game/geometry/IZ_vector2d.h
  151. src/packages/game/geometry/IZ_vector2d.c
  152. src/packages/game/geometry/geometry.test.c
  153. )
  154. add_executable(
  155. game-test-input
  156. dependencies/bdd-for-c/bdd-for-c.h
  157. src/packages/test/IZ_mock.h
  158. src/packages/test/IZ_test.h
  159. __mocks__/minIni.mock.h
  160. __mocks__/SDL_keyboard.mock.h
  161. __mocks__/SDL_events.mock.h
  162. __mocks__/SDL_joystick.mock.h
  163. __mocks__/SDL_stdinc.mock.h
  164. __mocks__/portmidi.mock.h
  165. src/packages/config/IZ_config.h
  166. src/packages/game/input/IZ_keyboard.h
  167. src/packages/game/input/IZ_keyboard.c
  168. src/packages/game/input/IZ_joystick.h
  169. src/packages/game/input/IZ_joystick.c
  170. src/packages/game/input/IZ_midi.h
  171. src/packages/game/input/IZ_midi.c
  172. src/packages/game/util/IZ_midi.c
  173. src/packages/game/util/IZ_midi.h
  174. src/packages/game/input/input.test.c
  175. )
  176. add_executable(
  177. game-test-output
  178. dependencies/bdd-for-c/bdd-for-c.h
  179. src/packages/test/IZ_mock.h
  180. src/packages/test/IZ_test.h
  181. __mocks__/minIni.mock.h
  182. __mocks__/SDL_stdinc.mock.h
  183. __mocks__/SDL_render.mock.h
  184. src/packages/config/IZ_config.h
  185. src/packages/game/output/video/IZ_video.h
  186. src/packages/game/output/video/IZ_video.c
  187. src/packages/game/output/output.test.c
  188. )
  189. add_executable(
  190. game-test-memory
  191. dependencies/bdd-for-c/bdd-for-c.h
  192. src/packages/test/IZ_mock.h
  193. src/packages/test/IZ_test.h
  194. src/packages/game/memory/IZ_pool.h
  195. src/packages/game/memory/IZ_pool.c
  196. src/packages/game/memory/memory.test.c
  197. src/packages/game/data/IZ_list.c
  198. src/packages/game/data/IZ_list.h
  199. )
  200. add_executable(
  201. game-test-data
  202. dependencies/bdd-for-c/bdd-for-c.h
  203. src/packages/test/IZ_mock.h
  204. src/packages/test/IZ_test.h
  205. src/packages/game/data/IZ_list.h
  206. src/packages/game/data/IZ_list.c
  207. src/packages/game/data/data.test.c
  208. )
  209. add_executable(
  210. server
  211. dependencies/sqlite/sqlite3.h
  212. dependencies/sqlite/sqlite3.c
  213. dependencies/minIni/dev/minIni.h
  214. dependencies/minIni/dev/minIni.c
  215. src/packages/log/IZ_log.h
  216. src/packages/log/IZ_log.c
  217. src/packages/server/main.c
  218. src/packages/server/IZ_app.c
  219. src/packages/server/IZ_app.h
  220. src/packages/server/IZ_app_config.h
  221. src/packages/server/IZ_app_config.c
  222. src/packages/net/svc/IZ_wsserver.c
  223. src/packages/net/svc/IZ_wsserver.h
  224. src/packages/net/core/IZ_websocket.h
  225. src/packages/net/core/IZ_websocket.c
  226. src/packages/config/IZ_config.h
  227. src/packages/config/IZ_config.c
  228. src/packages/net/IZ_net_server.c
  229. src/packages/net/IZ_net_server.h
  230. src/packages/server/db/IZ_repo.c
  231. src/packages/server/db/IZ_repo.h
  232. src/packages/server/IZ_subsystem.h
  233. )
  234. add_executable(
  235. asset-inv
  236. dependencies/minIni/dev/minIni.h
  237. dependencies/minIni/dev/minIni.c
  238. src/packages/common/IZ_common.h
  239. src/packages/asset-inv/main.c
  240. )
  241. target_link_libraries(
  242. server
  243. SDL2main
  244. SDL2
  245. libcrypto
  246. libssl
  247. websockets
  248. )
  249. if (WIN32)
  250. add_custom_command(TARGET game POST_BUILD
  251. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  252. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  253. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  254. add_custom_command(TARGET game POST_BUILD
  255. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  256. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}/SDL2_image.dll" # <--this is in-file
  257. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  258. add_custom_command(TARGET game POST_BUILD
  259. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  260. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.dll" # <--this is in-file
  261. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  262. add_custom_command(TARGET game POST_BUILD
  263. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  264. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release/portmidi.dll" # <--this is in-file
  265. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  266. add_custom_command(TARGET game POST_BUILD
  267. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  268. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  269. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  270. add_custom_command(TARGET game POST_BUILD
  271. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  272. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  273. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  274. add_custom_command(TARGET game POST_BUILD
  275. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  276. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  277. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  278. add_custom_command(TARGET server POST_BUILD
  279. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  280. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  281. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  282. add_custom_command(TARGET server POST_BUILD
  283. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  284. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  285. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  286. add_custom_command(TARGET server POST_BUILD
  287. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  288. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  289. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  290. add_custom_command(TARGET server POST_BUILD
  291. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  292. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  293. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  294. endif ()
  295. add_custom_command(TARGET game POST_BUILD
  296. COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..."
  297. "${PROJECT_SOURCE_DIR}/assets" # <--this is in-file
  298. $<TARGET_FILE_DIR:game>/assets) # <--this is out-file path
  299. add_custom_command(TARGET asset-inv POST_BUILD
  300. COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..."
  301. "${PROJECT_SOURCE_DIR}/assets" # <--this is in-file
  302. $<TARGET_FILE_DIR:game>/assets) # <--this is out-file path