Skip to content

Commit 29bb39f

Browse files
committed
CMake: reworked SDL2 lookup & update depended projects
1 parent d16dfa5 commit 29bb39f

File tree

24 files changed

+91
-67
lines changed

24 files changed

+91
-67
lines changed

Externals/OPCODE/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
88
include_directories(
99
${CMAKE_CURRENT_SOURCE_DIR}/../../src
1010
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
11-
${SDL_INCLUDE_DIR}
11+
${SDL_INCLUDE_DIRS}
1212
)
1313

1414
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})

Externals/cximage/CMakeLists.txt

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,39 @@ cmake_minimum_required(VERSION 2.8.0)
22
project(cximage)
33

44
set(SOURCES
5-
ximacfg.cpp
6-
ximaenc.cpp
7-
ximaexif.cpp
8-
ximage.cpp
9-
ximainfo.cpp
10-
ximaint.cpp
11-
ximajpg.cpp
12-
ximalpha.cpp
13-
ximalyr.cpp
14-
ximapal.cpp
15-
ximasel.cpp
16-
ximath.cpp
17-
xmemfile.cpp
5+
ximacfg.cpp
6+
ximaenc.cpp
7+
ximaexif.cpp
8+
ximage.cpp
9+
ximainfo.cpp
10+
ximaint.cpp
11+
ximajpg.cpp
12+
ximalpha.cpp
13+
ximalyr.cpp
14+
ximapal.cpp
15+
ximasel.cpp
16+
ximath.cpp
17+
xmemfile.cpp
1818
)
1919

2020
set(HEADERS
21-
xfile.h
22-
ximacfg.h
23-
ximadef.h
24-
ximage.h
25-
ximaiter.h
26-
ximajpg.h
27-
ximath.h
28-
xiofile.h
29-
xmemfile.h
21+
xfile.h
22+
ximacfg.h
23+
ximadef.h
24+
ximage.h
25+
ximaiter.h
26+
ximajpg.h
27+
ximath.h
28+
xiofile.h
29+
xmemfile.h
3030
)
3131

3232
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive --std=c++14")
3333
add_definitions(-DCXIMAGE_BUILD)
3434

35-
include_directories("." ${CMAKE_SOURCE_DIR})
35+
include_directories(
36+
${CMAKE_CURRENT_SOURCE_DIR}
37+
)
3638

3739
add_library(cximage STATIC ${SOURCES} ${HEADERS})
3840

cmake/FindSDL2.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ find_package_handle_standard_args(SDL REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR
119119
VERSION_VAR SDL_VERSION)
120120

121121
if(SDL_FOUND)
122-
set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIRS})
122+
set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR})
123123

124124
if(NOT SDL_LIBRARIES)
125125
set(SDL_LIBRARIES ${SDL_LIBRARY})
@@ -157,4 +157,4 @@ if(SDL_FOUND)
157157

158158
add_dependencies(SDL::SDL SDL::main)
159159
endif()
160-
endif()
160+
endif()

src/Common/PlatformLinux.inl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
#include <dirent.h>
2222
#include <utime.h>
2323

24-
#include <SDL2/SDL.h>
25-
#define CONFIG_USE_SDL
26-
2724
#define _LINUX // for GameSpy
2825

2926
#if !defined(__INTEL_COMPILER)
@@ -85,11 +82,6 @@ inline pthread_t GetCurrentThreadId()
8582
return pthread_self();
8683
}
8784

88-
inline void Sleep(int ms)
89-
{
90-
SDL_Delay(ms);
91-
}
92-
9385
inline void _splitpath (
9486
const char* path, // Path Input
9587
char* drive, // Drive : Output
@@ -196,8 +188,7 @@ typedef LONG_PTR LPARAM;
196188
typedef long HRESULT;
197189
typedef long LRESULT;
198190
typedef long _W64;
199-
//typedef void* HWND;
200-
typedef SDL_Window* HWND;
191+
typedef void* HWND;
201192
typedef void* HDC;
202193
typedef float FLOAT;
203194
typedef unsigned char UINT8;
@@ -291,8 +282,6 @@ inline int _filelength(int fd)
291282
#define __max(a, b) std::max(a, b)
292283
#define __min(a, b) std::min(a, b)
293284

294-
#define itoa SDL_itoa
295-
#define _itoa_s(value, buffer, radix) SDL_itoa(value, buffer, radix)
296285
#define _locale_t locale_t
297286
#define _isalpha_l isalpha_l
298287
#define _create_locale(category, arg) newlocale(category, arg, (locale_t) 0)

src/utils/xrLCUtil/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
project(xrLCUtil)
22

33
list(APPEND DIRS
4-
"."
5-
)
4+
"."
5+
)
66

77
add_dir("${DIRS}")
88

99
include_directories(
10-
${CMAKE_CURRENT_SOURCE_DIR}/../..
11-
${CMAKE_CURRENT_SOURCE_DIR}/../../../sdk/include
12-
)
10+
${CMAKE_CURRENT_SOURCE_DIR}/../..
11+
${CMAKE_CURRENT_SOURCE_DIR}/../../../sdk/include
12+
${SDL_INCLUDE_DIRS}
13+
)
1314

1415
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./LevelCompilerLoggerWindow.cpp")
1516
list(REMOVE_ITEM ${PROJECT_NAME}__INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/./LevelCompilerLoggerWindow.hpp")

src/utils/xrLCUtil/xrThread.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "pch.hpp"
22
#include "xrThread.hpp"
3+
#include "SDL.h"
34

45
void CThread::StubLog(const char*, ...) {}
56
void CThread::startup(void* P)
@@ -30,7 +31,7 @@ void CThreadManager::wait(u32 sleep_time)
3031
return;
3132
for (;;)
3233
{
33-
Sleep(sleep_time);
34+
SDL_Delay(sleep_time);
3435

3536
perf[0] = 0;
3637
float sumProgress = 0;

src/utils/xrMiscMath/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ add_dir("${DIRS}")
99
include_directories(
1010
${CMAKE_CURRENT_SOURCE_DIR}/../..
1111
${CMAKE_CURRENT_SOURCE_DIR}/../../../sdk/include
12+
${SDL_INCLUDE_DIRS}
1213
)
1314

1415
#list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./LevelCompilerLoggerWindow.cpp")

src/utils/xrQSlim/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
project(xrQSlim)
22

33
list(APPEND DIRS
4-
"src"
5-
)
4+
"src"
5+
)
66

77
add_dir("${DIRS}")
88

99
include_directories(
10-
${CMAKE_CURRENT_SOURCE_DIR}/../..
11-
${CMAKE_CURRENT_SOURCE_DIR}/../../../sdk/include
12-
)
10+
${CMAKE_CURRENT_SOURCE_DIR}/../..
11+
${CMAKE_CURRENT_SOURCE_DIR}/../../../sdk/include
12+
${SDL_INCLUDE_DIRS}
13+
)
1314

1415
#list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./LevelCompilerLoggerWindow.cpp")
1516
#ist(REMOVE_ITEM ${PROJECT_NAME}__INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/./LevelCompilerLoggerWindow.hpp")

src/xrAICore/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ include_directories(
1414
${CMAKE_CURRENT_SOURCE_DIR}/..
1515
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
1616
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
17+
${SDL_INCLUDE_DIRS}
1718
)
1819

1920
#foreach(header ${${PROJECT_NAME}__INCLUDES})

src/xrCDB/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ add_dir("${DIRS}")
99
include_directories(
1010
${CMAKE_CURRENT_SOURCE_DIR}/..
1111
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
12-
${SDL_INCLUDE_DIR}
12+
${SDL_INCLUDE_DIRS}
1313
)
1414

1515
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})

0 commit comments

Comments
 (0)