Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add SDL2 support for the build system

Defaults to off, tree doesn't yet compile with SDL2.
  • Loading branch information...
commit 264fdfa10e1fe4d631baa55b8e03dc2f3039365d 1 parent 5639720
@dhewg dhewg authored
Showing with 19 additions and 6 deletions.
  1. +19 −6 neo/CMakeLists.txt
View
25 neo/CMakeLists.txt
@@ -29,6 +29,7 @@ option(BASE "Build the base game code" ON)
option(D3XP "Build the d3xp game code" ON)
option(DEDICATED "Build the dedicated server" OFF)
option(ONATIVE "Optimize for the host CPU" OFF)
+option(SDL2 "Use SDL2 instead of SDL1.2" OFF)
if(NOT CMAKE_SYSTEM_PROCESSOR)
message(FATAL_ERROR "No target CPU architecture set")
@@ -73,6 +74,7 @@ if(DHEWM3LIBS)
# these are too stupid, give them a hint
set(ENV{OPENALDIR} ${DHEWM3LIBS})
set(ENV{SDLDIR} ${DHEWM3LIBS})
+ set(ENV{SDL2DIR} ${DHEWM3LIBS})
endif()
# libs
@@ -98,12 +100,23 @@ include_directories(${VORBISFILE_INCLUDE_DIR})
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
-if(APPLE OR WIN32)
+if (SDL2)
+ # skip SDL2main
+ if(APPLE OR WIN32)
+ set(SDL2_BUILDING_LIBRARY TRUE)
+ endif()
+ find_package(SDL2 REQUIRED)
+ include_directories(${SDL2_INCLUDE_DIR})
+ set(SDLx_LIBRARY ${SDL2_LIBRARY})
+else()
# skip SDLmain
- set(SDL_BUILDING_LIBRARY TRUE)
+ if(APPLE OR WIN32)
+ set(SDL_BUILDING_LIBRARY TRUE)
+ endif()
+ find_package(SDL REQUIRED)
+ include_directories(${SDL_INCLUDE_DIR})
+ set(SDLx_LIBRARY ${SDL_LIBRARY})
endif()
-find_package(SDL REQUIRED)
-include_directories(${SDL_INCLUDE_DIR})
find_package(CURL QUIET)
if(CURL_FOUND)
@@ -737,7 +750,7 @@ if(CORE)
${CURL_LIBRARY}
${JPEG_LIBRARY}
${ZLIB_LIBRARY}
- ${SDL_LIBRARY}
+ ${SDLx_LIBRARY}
${sys_libs}
)
@@ -767,7 +780,7 @@ if(DEDICATED)
${CURL_LIBRARY}
${JPEG_LIBRARY}
${ZLIB_LIBRARY}
- ${SDL_LIBRARY}
+ ${SDLx_LIBRARY}
${sys_libs}
)
Please sign in to comment.
Something went wrong with that request. Please try again.