2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

CMakeLists.txt 8.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  7. set(PROJECT_ARCH x64)
  8. else ()
  9. set(PROJECT_ARCH x86)
  10. endif ()
  11. endif ()
  12. add_definitions(-DIZ_APP_NAME="Izanagi" -DIZ_PLAYERS=1)
  13. if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  14. add_definitions(-DIZ_DEBUG)
  15. endif()
  16. include_directories(
  17. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/include"
  18. "${PROJECT_SOURCE_DIR}/dependencies/minIni/dev"
  19. "${PROJECT_SOURCE_DIR}/dependencies/bdd-for-c"
  20. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/pm_common"
  21. "${PROJECT_SOURCE_DIR}/dependencies/spine-runtimes/spine-c/spine-c/include"
  22. "${PROJECT_SOURCE_DIR}/dependencies/getopt-for-windows"
  23. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/include"
  24. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/include"
  25. "${PROJECT_SOURCE_DIR}/dependencies/sqlite"
  26. )
  27. link_directories(
  28. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}"
  29. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release"
  30. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/lib/Release"
  31. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/lib"
  32. )
  33. add_executable(
  34. game
  35. dependencies/minIni/dev/minIni.h
  36. dependencies/minIni/dev/minIni.c
  37. dependencies/getopt-for-windows/getopt.h
  38. dependencies/getopt-for-windows/getopt.c
  39. src/packages/game/output/IZ_video.h
  40. src/packages/game/output/IZ_video.c
  41. src/packages/game/IZ_common.h
  42. src/packages/game/input/IZ_action.h
  43. src/packages/game/IZ_app.h
  44. src/packages/game/IZ_app.c
  45. src/packages/game/main.c
  46. src/packages/game/input/IZ_joystick.c
  47. src/packages/game/input/IZ_joystick.h
  48. src/packages/game/input/IZ_keyboard.c
  49. src/packages/game/input/IZ_keyboard.h
  50. src/packages/game/IZ_config.c
  51. src/packages/game/IZ_config.h
  52. src/packages/game/geometry/IZ_point2d.c
  53. src/packages/game/geometry/IZ_point2d.h
  54. src/packages/game/geometry/IZ_vector2d.c
  55. src/packages/game/geometry/IZ_vector2d.h
  56. src/packages/game/geometry/IZ_rect.c
  57. src/packages/game/geometry/IZ_rect.h
  58. src/packages/game/core/IZ_object.c
  59. src/packages/game/core/IZ_object.h
  60. src/packages/game/core/IZ_creature.c
  61. src/packages/game/core/IZ_creature.h
  62. src/packages/game/core/IZ_entity.c
  63. src/packages/game/core/IZ_entity.h
  64. src/packages/game/memory/IZ_pool.c
  65. src/packages/game/memory/IZ_pool.h
  66. src/packages/game/input/IZ_input.c
  67. src/packages/game/input/IZ_input.h
  68. src/packages/game/input/IZ_midi.c
  69. src/packages/game/input/IZ_midi.h
  70. src/packages/game/data/IZ_list.c
  71. src/packages/game/data/IZ_list.h
  72. src/packages/game/net/svc/IZ_wsclient.c
  73. src/packages/game/net/svc/IZ_wsclient.h
  74. src/packages/game/log/IZ_log.c
  75. src/packages/game/log/IZ_log.h
  76. src/packages/game/util/IZ_midi.c
  77. src/packages/game/util/IZ_midi.h
  78. src/packages/game/net/core/IZ_websocket.h
  79. src/packages/game/net/core/IZ_websocket.c
  80. )
  81. target_link_libraries(
  82. game
  83. SDL2main
  84. SDL2
  85. portmidi
  86. libcrypto
  87. libssl
  88. websockets
  89. )
  90. add_executable(
  91. game-test-geometry
  92. dependencies/bdd-for-c/bdd-for-c.h
  93. src/packages/test/IZ_mock.h
  94. src/packages/test/IZ_test.h
  95. src/packages/game/geometry/IZ_point2d.h
  96. src/packages/game/geometry/IZ_point2d.c
  97. src/packages/game/geometry/IZ_rect.h
  98. src/packages/game/geometry/IZ_rect.c
  99. src/packages/game/geometry/IZ_vector2d.h
  100. src/packages/game/geometry/IZ_vector2d.c
  101. src/packages/game/geometry/geometry.test.c
  102. )
  103. add_executable(
  104. game-test-input
  105. dependencies/bdd-for-c/bdd-for-c.h
  106. src/packages/test/IZ_mock.h
  107. src/packages/test/IZ_test.h
  108. __mocks__/minIni.mock.h
  109. __mocks__/SDL_keyboard.mock.h
  110. __mocks__/SDL_events.mock.h
  111. __mocks__/SDL_joystick.mock.h
  112. __mocks__/SDL_stdinc.mock.h
  113. __mocks__/portmidi.mock.h
  114. src/packages/game/IZ_config.h
  115. src/packages/game/input/IZ_keyboard.h
  116. src/packages/game/input/IZ_keyboard.c
  117. src/packages/game/input/IZ_joystick.h
  118. src/packages/game/input/IZ_joystick.c
  119. src/packages/game/input/IZ_midi.h
  120. src/packages/game/input/IZ_midi.c
  121. src/packages/game/util/IZ_midi.c
  122. src/packages/game/util/IZ_midi.h
  123. src/packages/game/input/input.test.c
  124. )
  125. add_executable(
  126. game-test-output
  127. dependencies/bdd-for-c/bdd-for-c.h
  128. src/packages/test/IZ_mock.h
  129. src/packages/test/IZ_test.h
  130. __mocks__/minIni.mock.h
  131. __mocks__/SDL_stdinc.mock.h
  132. __mocks__/SDL_render.mock.h
  133. src/packages/game/IZ_config.h
  134. src/packages/game/output/IZ_video.h
  135. src/packages/game/output/IZ_video.c
  136. src/packages/game/output/output.test.c
  137. )
  138. add_executable(
  139. game-test-memory
  140. dependencies/bdd-for-c/bdd-for-c.h
  141. src/packages/test/IZ_mock.h
  142. src/packages/test/IZ_test.h
  143. src/packages/game/memory/IZ_pool.h
  144. src/packages/game/memory/IZ_pool.c
  145. src/packages/game/memory/memory.test.c
  146. src/packages/game/data/IZ_list.c
  147. src/packages/game/data/IZ_list.h
  148. )
  149. add_executable(
  150. game-test-data
  151. dependencies/bdd-for-c/bdd-for-c.h
  152. src/packages/test/IZ_mock.h
  153. src/packages/test/IZ_test.h
  154. src/packages/game/data/IZ_list.h
  155. src/packages/game/data/IZ_list.c
  156. src/packages/game/data/data.test.c
  157. )
  158. add_executable(
  159. server
  160. # dependencies/sqlite/sqlite3.h
  161. # dependencies/sqlite/sqlite3.c
  162. dependencies/minIni/dev/minIni.h
  163. dependencies/minIni/dev/minIni.c
  164. src/packages/server/IZ_common.h
  165. src/packages/server/log/IZ_log.h
  166. src/packages/server/log/IZ_log.c
  167. src/packages/server/main.c
  168. src/packages/server/IZ_app.c
  169. src/packages/server/IZ_app.h
  170. src/packages/server/IZ_config.c
  171. src/packages/server/IZ_config.h
  172. src/packages/server/net/svc/IZ_wsserver.c
  173. src/packages/server/net/svc/IZ_wsserver.h
  174. src/packages/server/net/core/IZ_websocket.h
  175. src/packages/server/net/core/IZ_websocket.c
  176. src/packages/server/net/IZ_net.c src/packages/server/net/IZ_net.h)
  177. target_link_libraries(
  178. server
  179. SDL2main
  180. SDL2
  181. libcrypto
  182. libssl
  183. websockets
  184. )
  185. if (WIN32)
  186. add_custom_command(TARGET game POST_BUILD
  187. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  188. "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file
  189. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  190. add_custom_command(TARGET game POST_BUILD
  191. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  192. "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release/portmidi.dll" # <--this is in-file
  193. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  194. add_custom_command(TARGET game POST_BUILD
  195. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  196. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  197. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  198. add_custom_command(TARGET game POST_BUILD
  199. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  200. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  201. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  202. add_custom_command(TARGET game POST_BUILD
  203. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  204. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  205. $<TARGET_FILE_DIR:game>) # <--this is out-file path
  206. add_custom_command(TARGET server POST_BUILD
  207. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  208. "${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file
  209. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  210. add_custom_command(TARGET server POST_BUILD
  211. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  212. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file
  213. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  214. add_custom_command(TARGET server POST_BUILD
  215. COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
  216. "${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file
  217. $<TARGET_FILE_DIR:server>) # <--this is out-file path
  218. endif ()