2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CMakeLists.txt 12 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. cmake_minimum_required(VERSION 3.21)
  2. project(izanagi C)
  3. set(CMAKE_C_STANDARD 11)
  4. #
  5. # Set platform
  6. #
  7. if (WIN32)
  8. # TODO set arch on target instead of generator
  9. set(PLATFORM WINDOWS)
  10. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  11. set(PROJECT_ARCH x64)
  12. add_definitions(
  13. -DIZ_WIN64
  14. )
  15. else ()
  16. set(PROJECT_ARCH x86)
  17. add_definitions(
  18. -DIZ_WIN32
  19. )
  20. endif ()
  21. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  22. set(PLATFORM MACOS)
  23. add_definitions(
  24. -DIZ_MACOS
  25. )
  26. else()
  27. set(PLATFORM UNIX)
  28. add_definitions(
  29. -DIZ_UNIX
  30. )
  31. endif ()
  32. #
  33. # Add configurations
  34. #
  35. add_definitions(
  36. -DIZ_APP_NAME="Izanagi"
  37. -DIZ_APP_DESCRIPTION="Run and gun game"
  38. -DIZ_APP_SERVER_DESCRIPTION="Dedicated server"
  39. -DIZ_PLAYERS=1
  40. #-DIZ_LOG_DATE_FUNCTION=IZ_TimerElapsed
  41. -DIZ_LOG_DATE_FUNCTION=IZ_TimerNow
  42. -DIZ_CONFIG_GAME_PATH="config-game.ini"
  43. -DIZ_CONFIG_SERVER_PATH="config-server.ini"
  44. )
  45. if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  46. add_definitions(-DIZ_DEBUG)
  47. endif()
  48. #
  49. # Specify directories
  50. #
  51. include_directories(
  52. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/include"
  53. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image"
  54. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/include"
  55. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/include"
  56. "${PROJECT_SOURCE_DIR}/dependencies/minIni/dev"
  57. "${PROJECT_SOURCE_DIR}/dependencies/bdd-for-c"
  58. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/pm_common"
  59. "${PROJECT_SOURCE_DIR}/dependencies/spine-runtimes/spine-c/spine-c/include"
  60. "${PROJECT_SOURCE_DIR}/dependencies/getopt-for-windows"
  61. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/include"
  62. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/include"
  63. "${PROJECT_SOURCE_DIR}/dependencies/sqlite"
  64. )
  65. if (WIN32)
  66. link_directories(
  67. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}"
  68. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}"
  69. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}"
  70. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release"
  71. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/lib/Release"
  72. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/lib"
  73. )
  74. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  75. include_directories(
  76. /usr/local/include
  77. /usr/local/include/SDL2
  78. /usr/local/include/openssl
  79. )
  80. link_directories(
  81. /usr/local/lib
  82. )
  83. endif()
  84. #
  85. # Define executables
  86. #
  87. add_executable(
  88. game
  89. dependencies/minIni/dev/minIni.h
  90. dependencies/minIni/dev/minIni.c
  91. dependencies/getopt-for-windows/getopt.h
  92. dependencies/getopt-for-windows/getopt.c
  93. src/packages/game/output/video/IZ_video.h
  94. src/packages/game/output/video/IZ_video.c
  95. src/packages/common/IZ_common.h
  96. src/packages/game/input/IZ_action.h
  97. src/packages/game/IZ_app.h
  98. src/packages/game/IZ_app.c
  99. src/packages/game/main.c
  100. src/packages/game/input/IZ_joystick.c
  101. src/packages/game/input/IZ_joystick.h
  102. src/packages/game/input/IZ_keyboard.c
  103. src/packages/game/input/IZ_keyboard.h
  104. src/packages/config/IZ_config.c
  105. src/packages/config/IZ_config.h
  106. src/packages/game/geometry/IZ_vector2d.c
  107. src/packages/game/geometry/IZ_vector2d.h
  108. src/packages/game/geometry/IZ_rect.c
  109. src/packages/game/geometry/IZ_rect.h
  110. src/packages/game/core/IZ_object.c
  111. src/packages/game/core/IZ_object.h
  112. src/packages/game/core/IZ_creature.c
  113. src/packages/game/core/IZ_creature.h
  114. src/packages/game/core/IZ_entity.c
  115. src/packages/game/core/IZ_entity.h
  116. src/packages/game/memory/IZ_pool.c
  117. src/packages/game/memory/IZ_pool.h
  118. src/packages/game/input/IZ_input.c
  119. src/packages/game/input/IZ_input.h
  120. src/packages/game/input/IZ_midi.c
  121. src/packages/game/input/IZ_midi.h
  122. src/packages/game/data/IZ_list.c
  123. src/packages/game/data/IZ_list.h
  124. src/packages/net/svc/IZ_wsclient.c
  125. src/packages/net/svc/IZ_wsclient.h
  126. src/packages/log/IZ_intercept.c
  127. src/packages/log/IZ_intercept.h
  128. src/packages/midi/IZ_midi.c
  129. src/packages/midi/IZ_midi.h
  130. src/packages/net/core/IZ_websocket.h
  131. src/packages/net/core/IZ_websocket.c
  132. src/packages/net/IZ_net_client.c
  133. src/packages/net/IZ_net_client.h
  134. src/packages/game/IZ_app_net.c
  135. src/packages/game/IZ_app_net.h
  136. src/packages/game/IZ_app_video.c
  137. src/packages/game/IZ_app_video.h
  138. src/packages/game/IZ_subsystem.h
  139. src/packages/game/IZ_app_input.c
  140. src/packages/game/IZ_app_input.h
  141. src/packages/game/IZ_app_config.c
  142. src/packages/game/IZ_app_config.h
  143. src/packages/game/asset/IZ_asset.c
  144. src/packages/game/asset/IZ_asset.h
  145. src/packages/stdinc/IZ_string.c
  146. src/packages/stdinc/IZ_string.h
  147. src/packages/io/IZ_io.c
  148. src/packages/io/IZ_io.h
  149. src/packages/log/IZ_log.c
  150. src/packages/log/IZ_log.h
  151. src/packages/timer/IZ_timer.c
  152. src/packages/timer/IZ_timer.h
  153. src/packages/compat/IZ_windows.h
  154. src/packages/stdinc/IZ_stdlib.c
  155. src/packages/stdinc/IZ_stdlib.h
  156. )
  157. if (WIN32)
  158. target_link_libraries(
  159. game
  160. SDL2main
  161. SDL2
  162. SDL2_image
  163. SDL2_ttf
  164. portmidi
  165. libcrypto
  166. libssl
  167. websockets
  168. )
  169. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  170. target_link_libraries(
  171. game
  172. SDL2main
  173. SDL2
  174. SDL2_image
  175. SDL2_ttf
  176. portmidi
  177. crypto
  178. ssl
  179. websockets
  180. )
  181. endif()
  182. add_executable(
  183. game-test-geometry
  184. dependencies/bdd-for-c/bdd-for-c.h
  185. src/packages/test/IZ_mock.h
  186. src/packages/test/IZ_test.h
  187. src/packages/game/geometry/IZ_rect.h
  188. src/packages/game/geometry/IZ_rect.c
  189. src/packages/game/geometry/IZ_vector2d.h
  190. src/packages/game/geometry/IZ_vector2d.c
  191. src/packages/game/geometry/geometry.test.c
  192. )
  193. add_executable(
  194. game-test-input
  195. dependencies/bdd-for-c/bdd-for-c.h
  196. src/packages/test/IZ_mock.h
  197. src/packages/test/IZ_test.h
  198. __mocks__/dependencies/minIni/minIni.mock.h
  199. __mocks__/dependencies/SDL2/SDL_keyboard.mock.h
  200. __mocks__/dependencies/SDL2/SDL_events.mock.h
  201. __mocks__/dependencies/SDL2/SDL_joystick.mock.h
  202. __mocks__/dependencies/SDL2/SDL_stdinc.mock.h
  203. __mocks__/dependencies/portmidi/portmidi.mock.h
  204. src/packages/config/IZ_config.h
  205. src/packages/game/input/IZ_keyboard.h
  206. src/packages/game/input/IZ_keyboard.c
  207. src/packages/game/input/IZ_joystick.h
  208. src/packages/game/input/IZ_joystick.c
  209. src/packages/game/input/IZ_midi.h
  210. src/packages/game/input/IZ_midi.c
  211. src/packages/midi/IZ_midi.c
  212. src/packages/midi/IZ_midi.h
  213. src/packages/game/input/input.test.c
  214. )
  215. add_executable(
  216. game-test-output
  217. dependencies/bdd-for-c/bdd-for-c.h
  218. src/packages/test/IZ_mock.h
  219. src/packages/test/IZ_test.h
  220. __mocks__/dependencies/minIni/minIni.mock.h
  221. __mocks__/dependencies/SDL2/SDL_stdinc.mock.h
  222. __mocks__/dependencies/SDL2/SDL_render.mock.h
  223. src/packages/config/IZ_config.h
  224. src/packages/game/output/video/IZ_video.h
  225. src/packages/game/output/video/IZ_video.c
  226. src/packages/game/output/output.test.c
  227. )
  228. add_executable(
  229. game-test-memory
  230. dependencies/bdd-for-c/bdd-for-c.h
  231. src/packages/test/IZ_mock.h
  232. src/packages/test/IZ_test.h
  233. src/packages/timer/IZ_timer.h
  234. src/packages/timer/IZ_timer.c
  235. src/packages/stdinc/IZ_stdlib.h
  236. __mocks__/src/packages/stdinc/IZ_stdlib.mock.h
  237. src/packages/stdinc/IZ_string.h
  238. __mocks__/src/packages/stdinc/IZ_string.mock.h
  239. src/packages/log/IZ_log.h
  240. __mocks__/src/packages/log/IZ_log.mock.h
  241. src/packages/game/memory/IZ_pool.h
  242. src/packages/game/memory/IZ_pool.c
  243. src/packages/game/memory/memory.test.c
  244. src/packages/game/data/IZ_list.c
  245. src/packages/game/data/IZ_list.h
  246. )
  247. target_link_libraries(
  248. game-test-memory
  249. SDL2main
  250. SDL2
  251. )
  252. add_executable(
  253. game-test-data
  254. dependencies/bdd-for-c/bdd-for-c.h
  255. src/packages/test/IZ_mock.h
  256. src/packages/test/IZ_test.h
  257. src/packages/game/data/IZ_list.h
  258. src/packages/game/data/IZ_list.c
  259. src/packages/game/data/data.test.c
  260. )
  261. add_executable(
  262. server
  263. dependencies/sqlite/sqlite3.h
  264. dependencies/sqlite/sqlite3.c
  265. dependencies/minIni/dev/minIni.h
  266. dependencies/minIni/dev/minIni.c
  267. src/packages/log/IZ_intercept.h
  268. src/packages/log/IZ_intercept.c
  269. src/packages/server/main.c
  270. src/packages/server/IZ_app.c
  271. src/packages/server/IZ_app.h
  272. src/packages/server/IZ_app_config.h
  273. src/packages/server/IZ_app_config.c
  274. src/packages/net/svc/IZ_wsserver.c
  275. src/packages/net/svc/IZ_wsserver.h
  276. src/packages/net/core/IZ_websocket.h
  277. src/packages/net/core/IZ_websocket.c
  278. src/packages/config/IZ_config.h
  279. src/packages/config/IZ_config.c
  280. src/packages/net/IZ_net_server.c
  281. src/packages/net/IZ_net_server.h
  282. src/packages/server/db/IZ_repo.c
  283. src/packages/server/db/IZ_repo.h
  284. src/packages/server/IZ_subsystem.h
  285. src/packages/stdinc/IZ_string.c
  286. src/packages/stdinc/IZ_string.h
  287. src/packages/io/IZ_io.c
  288. src/packages/io/IZ_io.h
  289. src/packages/log/IZ_log.c
  290. src/packages/log/IZ_log.h
  291. src/packages/timer/IZ_timer.c
  292. src/packages/timer/IZ_timer.h
  293. )
  294. if (WIN32)
  295. target_link_libraries(
  296. server
  297. SDL2main
  298. SDL2
  299. libcrypto
  300. libssl
  301. websockets
  302. )
  303. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  304. target_link_libraries(
  305. server
  306. SDL2main
  307. SDL2
  308. crypto
  309. ssl
  310. websockets
  311. )
  312. endif()
  313. add_executable(
  314. asset-inv
  315. dependencies/minIni/dev/minIni.h
  316. dependencies/minIni/dev/minIni.c
  317. src/packages/common/IZ_common.h
  318. src/packages/asset-inv/main.c
  319. )
  320. #
  321. # Add DLLs and required assets to the build directory
  322. #
  323. if (WIN32)
  324. add_custom_command(TARGET game POST_BUILD
  325. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  326. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll"
  327. $<TARGET_FILE_DIR:game>)
  328. add_custom_command(TARGET game POST_BUILD
  329. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  330. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}/SDL2_image.dll"
  331. $<TARGET_FILE_DIR:game>)
  332. add_custom_command(TARGET game POST_BUILD
  333. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  334. "${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.dll"
  335. $<TARGET_FILE_DIR:game>)
  336. add_custom_command(TARGET game POST_BUILD
  337. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  338. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release/portmidi.dll"
  339. $<TARGET_FILE_DIR:game>)
  340. add_custom_command(TARGET game POST_BUILD
  341. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  342. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll"
  343. $<TARGET_FILE_DIR:game>)
  344. add_custom_command(TARGET game POST_BUILD
  345. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  346. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll"
  347. $<TARGET_FILE_DIR:game>)
  348. add_custom_command(TARGET game POST_BUILD
  349. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  350. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll"
  351. $<TARGET_FILE_DIR:game>)
  352. add_custom_command(TARGET server POST_BUILD
  353. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  354. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll"
  355. $<TARGET_FILE_DIR:server>)
  356. add_custom_command(TARGET server POST_BUILD
  357. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  358. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll"
  359. $<TARGET_FILE_DIR:server>)
  360. add_custom_command(TARGET server POST_BUILD
  361. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  362. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll"
  363. $<TARGET_FILE_DIR:server>)
  364. add_custom_command(TARGET server POST_BUILD
  365. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  366. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll"
  367. $<TARGET_FILE_DIR:server>)
  368. endif ()
  369. add_custom_command(TARGET game POST_BUILD
  370. COMMAND ${CMAKE_COMMAND} -E copy_directory
  371. "${PROJECT_SOURCE_DIR}/assets"
  372. $<TARGET_FILE_DIR:game>/assets)
  373. add_custom_command(TARGET asset-inv POST_BUILD
  374. COMMAND ${CMAKE_COMMAND} -E copy_directory
  375. "${PROJECT_SOURCE_DIR}/assets"
  376. $<TARGET_FILE_DIR:game>/assets)