|
|
@@ -1,10 +1,10 @@ |
|
|
|
cmake_minimum_required(VERSION 3.21) |
|
|
|
|
|
|
|
# Set your project name here |
|
|
|
project(izanagi C) |
|
|
|
|
|
|
|
set(CMAKE_C_STANDARD 11) |
|
|
|
|
|
|
|
# |
|
|
|
# Set platform |
|
|
|
# |
|
|
|
if (WIN32) |
|
|
|
# TODO set arch on target instead of generator |
|
|
|
set(PLATFORM WINDOWS) |
|
|
@@ -31,6 +31,9 @@ else() |
|
|
|
) |
|
|
|
endif () |
|
|
|
|
|
|
|
# |
|
|
|
# Add configurations |
|
|
|
# |
|
|
|
add_definitions( |
|
|
|
-DIZ_APP_NAME="Izanagi" |
|
|
|
-DIZ_APP_DESCRIPTION="Run and gun game" |
|
|
@@ -42,6 +45,9 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") |
|
|
|
add_definitions(-DIZ_DEBUG) |
|
|
|
endif() |
|
|
|
|
|
|
|
# |
|
|
|
# Specify directories |
|
|
|
# |
|
|
|
include_directories( |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/include" |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image" |
|
|
@@ -78,15 +84,18 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
|
) |
|
|
|
endif() |
|
|
|
|
|
|
|
# |
|
|
|
# Define executables |
|
|
|
# |
|
|
|
add_executable( |
|
|
|
game |
|
|
|
dependencies/minIni/dev/minIni.h |
|
|
|
dependencies/minIni/dev/minIni.c |
|
|
|
dependencies/getopt-for-windows/getopt.h |
|
|
|
dependencies/getopt-for-windows/getopt.c |
|
|
|
src/packages/game/output/video/IZ_video.h |
|
|
|
src/packages/game/output/video/IZ_video.c |
|
|
|
src/packages/common/IZ_common.h |
|
|
|
src/packages/game/output/video/IZ_video.h |
|
|
|
src/packages/game/output/video/IZ_video.c |
|
|
|
src/packages/common/IZ_common.h |
|
|
|
src/packages/game/input/IZ_action.h |
|
|
|
src/packages/game/IZ_app.h |
|
|
|
src/packages/game/IZ_app.c |
|
|
@@ -95,9 +104,9 @@ add_executable( |
|
|
|
src/packages/game/input/IZ_joystick.h |
|
|
|
src/packages/game/input/IZ_keyboard.c |
|
|
|
src/packages/game/input/IZ_keyboard.h |
|
|
|
src/packages/config/IZ_config.c |
|
|
|
src/packages/config/IZ_config.h |
|
|
|
src/packages/game/geometry/IZ_vector2d.c |
|
|
|
src/packages/config/IZ_config.c |
|
|
|
src/packages/config/IZ_config.h |
|
|
|
src/packages/game/geometry/IZ_vector2d.c |
|
|
|
src/packages/game/geometry/IZ_vector2d.h |
|
|
|
src/packages/game/geometry/IZ_rect.c |
|
|
|
src/packages/game/geometry/IZ_rect.h |
|
|
@@ -115,15 +124,32 @@ add_executable( |
|
|
|
src/packages/game/input/IZ_midi.h |
|
|
|
src/packages/game/data/IZ_list.c |
|
|
|
src/packages/game/data/IZ_list.h |
|
|
|
src/packages/net/svc/IZ_wsclient.c |
|
|
|
src/packages/net/svc/IZ_wsclient.h |
|
|
|
src/packages/log/IZ_log.c |
|
|
|
src/packages/log/IZ_log.h |
|
|
|
src/packages/midi/IZ_midi.c |
|
|
|
src/packages/midi/IZ_midi.h |
|
|
|
src/packages/net/core/IZ_websocket.h |
|
|
|
src/packages/net/core/IZ_websocket.c |
|
|
|
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 src/packages/string/IZ_string.c src/packages/string/IZ_string.h) |
|
|
|
src/packages/net/svc/IZ_wsclient.c |
|
|
|
src/packages/net/svc/IZ_wsclient.h |
|
|
|
src/packages/log/IZ_log.c |
|
|
|
src/packages/log/IZ_log.h |
|
|
|
src/packages/midi/IZ_midi.c |
|
|
|
src/packages/midi/IZ_midi.h |
|
|
|
src/packages/net/core/IZ_websocket.h |
|
|
|
src/packages/net/core/IZ_websocket.c |
|
|
|
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 |
|
|
|
src/packages/string/IZ_string.c |
|
|
|
src/packages/string/IZ_string.h |
|
|
|
src/packages/io/IZ_io.c |
|
|
|
src/packages/io/IZ_io.h |
|
|
|
) |
|
|
|
|
|
|
|
if (WIN32) |
|
|
|
target_link_libraries( |
|
|
@@ -140,14 +166,15 @@ if (WIN32) |
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
|
target_link_libraries( |
|
|
|
game |
|
|
|
SDL2main |
|
|
|
SDL2 |
|
|
|
SDL2_image |
|
|
|
SDL2_ttf |
|
|
|
portmidi |
|
|
|
# libcrypto |
|
|
|
# libssl |
|
|
|
websockets |
|
|
|
SDL2main |
|
|
|
SDL2 |
|
|
|
SDL2_image |
|
|
|
SDL2_ttf |
|
|
|
portmidi |
|
|
|
# FIXME |
|
|
|
# libcrypto |
|
|
|
# libssl |
|
|
|
websockets |
|
|
|
) |
|
|
|
endif() |
|
|
|
|
|
|
@@ -157,7 +184,7 @@ add_executable( |
|
|
|
src/packages/test/IZ_mock.h |
|
|
|
src/packages/test/IZ_test.h |
|
|
|
|
|
|
|
src/packages/game/geometry/IZ_rect.h |
|
|
|
src/packages/game/geometry/IZ_rect.h |
|
|
|
src/packages/game/geometry/IZ_rect.c |
|
|
|
src/packages/game/geometry/IZ_vector2d.h |
|
|
|
src/packages/game/geometry/IZ_vector2d.c |
|
|
@@ -177,7 +204,7 @@ add_executable( |
|
|
|
__mocks__/SDL_stdinc.mock.h |
|
|
|
__mocks__/portmidi.mock.h |
|
|
|
|
|
|
|
src/packages/config/IZ_config.h |
|
|
|
src/packages/config/IZ_config.h |
|
|
|
|
|
|
|
src/packages/game/input/IZ_keyboard.h |
|
|
|
src/packages/game/input/IZ_keyboard.c |
|
|
@@ -188,8 +215,8 @@ add_executable( |
|
|
|
src/packages/game/input/IZ_midi.h |
|
|
|
src/packages/game/input/IZ_midi.c |
|
|
|
|
|
|
|
src/packages/midi/IZ_midi.c |
|
|
|
src/packages/midi/IZ_midi.h |
|
|
|
src/packages/midi/IZ_midi.c |
|
|
|
src/packages/midi/IZ_midi.h |
|
|
|
|
|
|
|
src/packages/game/input/input.test.c |
|
|
|
) |
|
|
@@ -199,15 +226,12 @@ add_executable( |
|
|
|
dependencies/bdd-for-c/bdd-for-c.h |
|
|
|
src/packages/test/IZ_mock.h |
|
|
|
src/packages/test/IZ_test.h |
|
|
|
|
|
|
|
__mocks__/minIni.mock.h |
|
|
|
__mocks__/SDL_stdinc.mock.h |
|
|
|
__mocks__/SDL_render.mock.h |
|
|
|
|
|
|
|
src/packages/config/IZ_config.h |
|
|
|
|
|
|
|
src/packages/game/output/video/IZ_video.h |
|
|
|
src/packages/game/output/video/IZ_video.c |
|
|
|
src/packages/config/IZ_config.h |
|
|
|
src/packages/game/output/video/IZ_video.h |
|
|
|
src/packages/game/output/video/IZ_video.c |
|
|
|
src/packages/game/output/output.test.c |
|
|
|
) |
|
|
|
|
|
|
@@ -216,7 +240,6 @@ add_executable( |
|
|
|
dependencies/bdd-for-c/bdd-for-c.h |
|
|
|
src/packages/test/IZ_mock.h |
|
|
|
src/packages/test/IZ_test.h |
|
|
|
|
|
|
|
src/packages/game/memory/IZ_pool.h |
|
|
|
src/packages/game/memory/IZ_pool.c |
|
|
|
src/packages/game/memory/memory.test.c |
|
|
@@ -229,7 +252,6 @@ add_executable( |
|
|
|
dependencies/bdd-for-c/bdd-for-c.h |
|
|
|
src/packages/test/IZ_mock.h |
|
|
|
src/packages/test/IZ_test.h |
|
|
|
|
|
|
|
src/packages/game/data/IZ_list.h |
|
|
|
src/packages/game/data/IZ_list.c |
|
|
|
src/packages/game/data/data.test.c |
|
|
@@ -259,14 +281,10 @@ add_executable( |
|
|
|
src/packages/server/db/IZ_repo.c |
|
|
|
src/packages/server/db/IZ_repo.h |
|
|
|
src/packages/server/IZ_subsystem.h |
|
|
|
src/packages/string/IZ_string.c src/packages/string/IZ_string.h) |
|
|
|
|
|
|
|
add_executable( |
|
|
|
asset-inv |
|
|
|
dependencies/minIni/dev/minIni.h |
|
|
|
dependencies/minIni/dev/minIni.c |
|
|
|
src/packages/common/IZ_common.h |
|
|
|
src/packages/asset-inv/main.c |
|
|
|
src/packages/string/IZ_string.c |
|
|
|
src/packages/string/IZ_string.h |
|
|
|
src/packages/io/IZ_io.c |
|
|
|
src/packages/io/IZ_io.h |
|
|
|
) |
|
|
|
|
|
|
|
target_link_libraries( |
|
|
@@ -278,69 +296,80 @@ target_link_libraries( |
|
|
|
websockets |
|
|
|
) |
|
|
|
|
|
|
|
add_executable( |
|
|
|
asset-inv |
|
|
|
dependencies/minIni/dev/minIni.h |
|
|
|
dependencies/minIni/dev/minIni.c |
|
|
|
src/packages/common/IZ_common.h |
|
|
|
src/packages/asset-inv/main.c |
|
|
|
) |
|
|
|
|
|
|
|
# |
|
|
|
# Add DLLs and required assets to the build directory |
|
|
|
# |
|
|
|
if (WIN32) |
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" |
|
|
|
$<TARGET_FILE_DIR:game>) |
|
|
|
|
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}/SDL2_image.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}/SDL2_image.dll" |
|
|
|
$<TARGET_FILE_DIR:game>) |
|
|
|
|
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.dll" |
|
|
|
$<TARGET_FILE_DIR:game>) |
|
|
|
|
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release/portmidi.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release/portmidi.dll" |
|
|
|
$<TARGET_FILE_DIR:game>) |
|
|
|
|
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" |
|
|
|
$<TARGET_FILE_DIR:game>) |
|
|
|
|
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" |
|
|
|
$<TARGET_FILE_DIR:game>) |
|
|
|
|
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" |
|
|
|
$<TARGET_FILE_DIR:game>) |
|
|
|
|
|
|
|
add_custom_command(TARGET server POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:server>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll" |
|
|
|
$<TARGET_FILE_DIR:server>) |
|
|
|
|
|
|
|
add_custom_command(TARGET server POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:server>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/bin/Release/websockets.dll" |
|
|
|
$<TARGET_FILE_DIR:server>) |
|
|
|
|
|
|
|
add_custom_command(TARGET server POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:server>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll" |
|
|
|
$<TARGET_FILE_DIR:server>) |
|
|
|
|
|
|
|
add_custom_command(TARGET server POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:server>) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll" |
|
|
|
$<TARGET_FILE_DIR:server>) |
|
|
|
endif () |
|
|
|
|
|
|
|
add_custom_command(TARGET game POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/assets" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>/assets) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory |
|
|
|
"${PROJECT_SOURCE_DIR}/assets" |
|
|
|
$<TARGET_FILE_DIR:game>/assets) |
|
|
|
|
|
|
|
add_custom_command(TARGET asset-inv POST_BUILD |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory # which executes "cmake - E copy_if_different..." |
|
|
|
"${PROJECT_SOURCE_DIR}/assets" # <--this is in-file |
|
|
|
$<TARGET_FILE_DIR:game>/assets) # <--this is out-file path |
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory |
|
|
|
"${PROJECT_SOURCE_DIR}/assets" |
|
|
|
$<TARGET_FILE_DIR:game>/assets) |