Browse Source

Migrate SDL to subprojects

Remove old SDL dependency.
master
TheoryOfNekomata 1 year ago
parent
commit
30469008de
9 changed files with 22 additions and 47 deletions
  1. +15
    -10
      CMakeLists.txt
  2. +0
    -30
      __mocks__/dependencies/minIni/minIni.mock.h
  3. +0
    -0
      __mocks__/subprojects/SDL/SDL_events.mock.h
  4. +0
    -0
      __mocks__/subprojects/SDL/SDL_joystick.mock.h
  5. +0
    -0
      __mocks__/subprojects/SDL/SDL_keyboard.mock.h
  6. +0
    -0
      __mocks__/subprojects/SDL/SDL_render.mock.h
  7. +0
    -0
      __mocks__/subprojects/SDL/SDL_stdinc.mock.h
  8. +4
    -4
      src/packages/game/input/input.test.c
  9. +3
    -3
      src/packages/game/output/output.test.c

+ 15
- 10
CMakeLists.txt View File

@@ -61,7 +61,7 @@ endif()
# Specify directories
#
include_directories(
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/include"
"${PROJECT_SOURCE_DIR}/subprojects/SDL/include"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/include"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/include"
@@ -78,7 +78,7 @@ include_directories(

if (IZ_PLATFORM STREQUAL "WINDOWS")
link_directories(
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${IZ_PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/subprojects/SDL/build/Release"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${IZ_PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${IZ_PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release"
@@ -213,10 +213,10 @@ add_executable(
subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h

__mocks__/subprojects/minIni/minIni.mock.h
__mocks__/dependencies/SDL2/SDL_keyboard.mock.h
__mocks__/dependencies/SDL2/SDL_events.mock.h
__mocks__/dependencies/SDL2/SDL_joystick.mock.h
__mocks__/dependencies/SDL2/SDL_stdinc.mock.h
__mocks__/subprojects/SDL/SDL_keyboard.mock.h
__mocks__/subprojects/SDL/SDL_events.mock.h
__mocks__/subprojects/SDL/SDL_joystick.mock.h
__mocks__/subprojects/SDL/SDL_stdinc.mock.h
__mocks__/dependencies/portmidi/portmidi.mock.h

src/packages/config/IZ_config.h
@@ -255,8 +255,8 @@ add_executable(
subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h

__mocks__/subprojects/minIni/minIni.mock.h
__mocks__/dependencies/SDL2/SDL_stdinc.mock.h
__mocks__/dependencies/SDL2/SDL_render.mock.h
__mocks__/subprojects/SDL/SDL_stdinc.mock.h
__mocks__/subprojects/SDL/SDL_render.mock.h

src/packages/config/IZ_config.h
src/packages/game/output/video/IZ_video.h
@@ -369,7 +369,7 @@ add_executable(
if (IZ_PLATFORM STREQUAL "WINDOWS")
add_custom_command(TARGET game POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${IZ_PROJECT_ARCH}/SDL2.dll"
"${PROJECT_SOURCE_DIR}/subprojects/SDL/build/Release/SDL2.dll"
$<TARGET_FILE_DIR:game>)

add_custom_command(TARGET game POST_BUILD
@@ -404,7 +404,7 @@ if (IZ_PLATFORM STREQUAL "WINDOWS")

add_custom_command(TARGET server POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${IZ_PROJECT_ARCH}/SDL2.dll"
"${PROJECT_SOURCE_DIR}/subprojects/SDL/build/Release/SDL2.dll"
$<TARGET_FILE_DIR:server>)

add_custom_command(TARGET server POST_BUILD
@@ -421,6 +421,11 @@ if (IZ_PLATFORM STREQUAL "WINDOWS")
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${IZ_PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll"
$<TARGET_FILE_DIR:server>)

add_custom_command(TARGET game-test-input POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/subprojects/SDL/build/Release/SDL2.dll"
$<TARGET_FILE_DIR:game-test-input>)
endif ()

add_custom_command(TARGET game POST_BUILD


+ 0
- 30
__mocks__/dependencies/minIni/minIni.mock.h View File

@@ -1,30 +0,0 @@
#ifndef MININI_MOCK_H
#define MININI_MOCK_H

#include <bdd-for-c-mocks.h>
#include "../../../src/packages/common/IZ_common.h"

mock(ini_getl) long ini_getl(const char *Section, const char *Key, long DefValue, const char *Filename) {
mock_return(ini_getl) DefValue;
}

mock(ini_putl) i32 ini_putl(const char *Section, const char *Key, long Value, const char *Filename) {
mock_return(ini_putl) 1;
}

mock(ini_gets) i32 ini_gets(
const char *Section,
const char *Key,
const char *DefValue,
char *Buffer,
i32 BufferSize,
const char *Filename
) {
mock_return(ini_gets) 0;
}

mock(ini_puts) i32 ini_puts(const char *Section, const char *Key, const char *Value, const char *Filename) {
mock_return(ini_puts) 1;
}

#endif

__mocks__/dependencies/SDL2/SDL_events.mock.h → __mocks__/subprojects/SDL/SDL_events.mock.h View File


__mocks__/dependencies/SDL2/SDL_joystick.mock.h → __mocks__/subprojects/SDL/SDL_joystick.mock.h View File


__mocks__/dependencies/SDL2/SDL_keyboard.mock.h → __mocks__/subprojects/SDL/SDL_keyboard.mock.h View File


__mocks__/dependencies/SDL2/SDL_render.mock.h → __mocks__/subprojects/SDL/SDL_render.mock.h View File


__mocks__/dependencies/SDL2/SDL_stdinc.mock.h → __mocks__/subprojects/SDL/SDL_stdinc.mock.h View File


+ 4
- 4
src/packages/game/input/input.test.c View File

@@ -1,8 +1,8 @@
#include <bdd-for-c.h>
#include "../../../../__mocks__/dependencies/SDL2/SDL_keyboard.mock.h"
#include "../../../../__mocks__/dependencies/SDL2/SDL_joystick.mock.h"
#include "../../../../__mocks__/dependencies/SDL2/SDL_stdinc.mock.h"
#include "../../../../__mocks__/dependencies/minIni/minIni.mock.h"
#include "../../../../__mocks__/subprojects/SDL/SDL_keyboard.mock.h"
#include "../../../../__mocks__/subprojects/SDL/SDL_joystick.mock.h"
#include "../../../../__mocks__/subprojects/SDL/SDL_stdinc.mock.h"
#include "../../../../__mocks__/subprojects/minIni/minIni.mock.h"
#include "../../../../__mocks__/dependencies/portmidi/portmidi.mock.h"
#include "../../../../__mocks__/src/packages/stdinc/IZ_string.mock.h"
#include "../../../../__mocks__/src/packages/stdinc/IZ_stdlib.mock.h"


+ 3
- 3
src/packages/game/output/output.test.c View File

@@ -1,7 +1,7 @@
#include <bdd-for-c.h>
#include "../../../../__mocks__/dependencies/minIni/minIni.mock.h"
#include "../../../../__mocks__/dependencies/SDL2/SDL_stdinc.mock.h"
#include "../../../../__mocks__/dependencies/SDL2/SDL_render.mock.h"
#include "../../../../__mocks__/subprojects/minIni/minIni.mock.h"
#include "../../../../__mocks__/subprojects/SDL/SDL_stdinc.mock.h"
#include "../../../../__mocks__/subprojects/SDL/SDL_render.mock.h"
#include "video/IZ_video.h"

const char* IZ_ConfigGetCommandlineOption(u8 argc, const char* argv[], const char* val) {


Loading…
Cancel
Save