Skip to content

Commit 23d76af

Browse files
committed
Fixed compilation of demo on Linux and when not using a separate memory library
1 parent f148940 commit 23d76af

9 files changed

+17
-19
lines changed

CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ file(GLOB_RECURSE InputSources
1010
"Typedefs.h"
1111
"LogInput.h"
1212
)
13-
13+
set(INPUT_MEMORY_LIB)
1414
if(USE_CUSTOM_ALLOCATOR_HEADER_FOR_INPUT)
15+
set(INPUT_MEMORY_LIB Memory)
16+
add_definitions(-DINPUT_ALLOCATION_HEADER=${CUSTOM_ALLOCATOR_HEADER_FOR_INPUT})
1517
else(USE_CUSTOM_ALLOCATOR_HEADER_FOR_INPUT)
1618
list(APPEND InputSources "Alloc.h")
17-
add_definitions(-DINPUT_ALLOCATION_HEADER=${CUSTOM_ALLOCATOR_HEADER_FOR_INPUT})
19+
add_definitions(-DINPUT_ALLOCATION_HEADER="Alloc.h")
1820
endif(USE_CUSTOM_ALLOCATOR_HEADER_FOR_INPUT)
1921

2022
add_definitions(-DINPUT_DLL_EXPORT)
2123
add_library(Input SHARED ${InputSources})
22-
target_link_libraries(Input Utility ${SDL2Library} Memory)
24+
target_link_libraries(Input Utility ${SDL2Library} ${INPUT_MEMORY_LIB})
2325

2426
install(
2527
TARGETS Input DESTINATION lib

Input.h

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include <SDL2/SDL_mouse.h>
55
#include <SDL2/SDL_events.h>
66
#include "InputLibraryDefine.h"
7-
//#include "Alloc.h"
8-
#include INPUT_ALLOCATION_HEADER
97

108
#define g_Input Input::GetInstance()
119

InputLibraryDefine.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@
88
#endif
99
#else
1010
#define INPUT_API
11-
#endif
11+
#endif
12+
13+
#ifndef INPUT_ALLOCATION_HEADER
14+
#include "Alloc.h"
15+
#else
16+
#include INPUT_ALLOCATION_HEADER
17+
#endif

KeyBindingCollection.h

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22
#include <SDL2/SDL_scancode.h>
3-
//#include "Alloc.h"
4-
#include INPUT_ALLOCATION_HEADER
53
#include "InputLibraryDefine.h"
64
#include "Typedefs.h"
75

KeyBindings.h

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include <map>
44
#include <SDL2/SDL_scancode.h>
5-
//#include "Alloc.h"
6-
#include INPUT_ALLOCATION_HEADER
75
#include "InputLibraryDefine.h"
86
#include "KeyBindingCollection.h"
97

LogInput.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

3-
//#include "Alloc.h"
4-
#include INPUT_ALLOCATION_HEADER
3+
#include "InputLibraryDefine.h"
54

65
#ifdef LOG_TO_COUT
76
static void LogInput( const rString& message, const char* category = "Input", int severityMask = 0)

TextInput.h

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#pragma once
22
#include <SDL2/SDL_events.h>
33
#include "Input.h"
4-
//#include "Alloc.h"
5-
#include INPUT_ALLOCATION_HEADER
64

75
#define g_TextInput TextInput::GetInstance()
86

demo/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
add_executable(${CMAKE_PROJECT_NAME} main.cpp)
1+
add_executable(${CMAKE_PROJECT_NAME} Main.cpp)
22
# Link libraries to the executable
3-
target_link_libraries(${CMAKE_PROJECT_NAME} Utility Input ${SDL2Libraries})
3+
target_link_libraries(${CMAKE_PROJECT_NAME} Utility Input ${SDL2Libraries})

demo/Main.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#include "core/CompileFlags.h"
21
#include "../Alloc.h"
32

43
#include <SDL2/SDL.h>
54
#include <SDL2/SDL_main.h>
65
#include <utility/Logger.h>
7-
#include <Input.h>
8-
#include <TextInput.h>
6+
#include <input/Input.h>
7+
#include <input/TextInput.h>
98

109
void RegisterLogger( );
1110

0 commit comments

Comments
 (0)