cmake_minimum_required(VERSION 3.21) # Set your project name here project(izanagi C) set(CMAKE_C_STANDARD 11) include_directories( "${PROJECT_SOURCE_DIR}/dependencies/SDL2/include" "${PROJECT_SOURCE_DIR}/dependencies/minIni/dev" "${PROJECT_SOURCE_DIR}/dependencies/bdd-for-c" "${PROJECT_SOURCE_DIR}/dependencies/portmidi/pm_common" "${PROJECT_SOURCE_DIR}/dependencies/spine-runtimes/spine-c/spine-c/include" ) if (WIN32) if (CMAKE_SIZEOF_VOID_P EQUAL 8) set(PROJECT_ARCH x64) else () set(PROJECT_ARCH x86) endif () endif () link_directories( "${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}" "${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release" ) add_executable( game dependencies/minIni/dev/minIni.h dependencies/minIni/dev/minIni.c src/packages/game/output/IZ_video.h src/packages/game/output/IZ_video.c src/packages/game/IZ_common.h src/packages/game/IZ_action.h src/packages/game/IZ_app.h src/packages/game/IZ_app.c src/packages/game/main.c src/packages/game/input/IZ_joystick.c src/packages/game/input/IZ_joystick.h src/packages/game/input/IZ_keyboard.c src/packages/game/input/IZ_keyboard.h src/packages/game/IZ_config.c src/packages/game/IZ_config.h src/packages/game/geometry/IZ_point2d.c src/packages/game/geometry/IZ_point2d.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 src/packages/game/core/IZ_object.c src/packages/game/core/IZ_object.h src/packages/game/core/IZ_creature.c src/packages/game/core/IZ_creature.h src/packages/game/core/IZ_entity.c src/packages/game/core/IZ_entity.h src/packages/game/memory/IZ_pool.c src/packages/game/memory/IZ_pool.h) target_link_libraries( game SDL2main SDL2 ) add_executable( game-test-geometry dependencies/bdd-for-c/bdd-for-c.h src/packages/test/IZ_mock.h src/packages/test/IZ_test.h src/packages/game/geometry/IZ_point2d.h src/packages/game/geometry/IZ_point2d.c 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 src/packages/game/geometry/geometry.test.c) add_executable( game-test-input 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_keyboard.mock.h __mocks__/SDL_events.mock.h __mocks__/SDL_joystick.mock.h src/packages/game/IZ_config.h src/packages/game/__mocks__/IZ_config.mock.h src/packages/game/input/IZ_keyboard.h src/packages/game/input/IZ_keyboard.c src/packages/game/input/IZ_joystick.h src/packages/game/input/IZ_joystick.c src/packages/game/input/input.test.c ) add_executable( game-test-output dependencies/bdd-for-c/bdd-for-c.h src/packages/test/IZ_mock.h src/packages/test/IZ_test.h __mocks__/minIni.mock.h src/packages/game/IZ_config.h src/packages/game/__mocks__/IZ_config.mock.h src/packages/game/output/IZ_video.h src/packages/game/output/IZ_video.c src/packages/game/output/output.test.c ) 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 endif ()