Add WIN32_USE_SDL2 option

This commit is contained in:
FreeSlave 2023-02-19 03:57:52 +03:00 committed by Andrey Akhmichin
parent 8337b367d8
commit de1e971fc5
3 changed files with 14 additions and 2 deletions

View File

@ -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 \
###################\

View File

@ -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)

View File

@ -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 <dlfcn.h>
#endif
#include <SDL2/SDL_mouse.h>