2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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