diff --git a/CMakeLists.txt b/CMakeLists.txt index e26d2c25..8ff74cf9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,10 @@ else() option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF) endif() +if (WIN32) + option(WIN32_USE_SDL2 "Force building client with SDL2 on Windows" ON) +endif() + #----------------- # MAIN BUILD CODE \ ###################\ diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 9c0819cb..3790da3e 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -52,6 +52,10 @@ if (GOLDSOURCE_SUPPORT) add_definitions(-DGOLDSOURCE_SUPPORT) endif() +if (WIN32_USE_SDL2) + add_definitions(-DWIN32_USE_SDL2) +endif() + if (USE_VGUI) add_definitions(-DUSE_VGUI) if (USE_NOVGUI_MOTD) @@ -164,6 +168,10 @@ endif() include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public) +if (WIN32_USE_SDL2) + include_directories (../external/) +endif() + if (USE_VGUI) SET(CMAKE_SKIP_RPATH TRUE) link_directories(${CMAKE_SOURCE_DIR}/vgui_support/vgui-dev/lib) diff --git a/cl_dll/input_goldsource.cpp b/cl_dll/input_goldsource.cpp index 74777ce6..8d570de6 100644 --- a/cl_dll/input_goldsource.cpp +++ b/cl_dll/input_goldsource.cpp @@ -23,13 +23,13 @@ #include "keydefs.h" #include "view.h" -#if !XASH_WIN32 +#if !XASH_WIN32 || WIN32_USE_SDL2 #define USE_SDL2 1 #endif #if USE_SDL2 -#define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) ) #if !_WIN32 +#define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) ) #include #endif #include