summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt82
1 files changed, 63 insertions, 19 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 84526df9b..25d1e9be9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,9 +1,21 @@
-FIND_PACKAGE(SDL REQUIRED)
-FIND_PACKAGE(SDL_image REQUIRED)
-FIND_PACKAGE(SDL_mixer REQUIRED)
-FIND_PACKAGE(SDL_net REQUIRED)
-FIND_PACKAGE(SDL_ttf REQUIRED)
-FIND_PACKAGE(SDL_gfx REQUIRED)
+
+IF (USE_SDL2)
+ include(FindPkgConfig)
+ pkg_search_module(SDL2 REQUIRED sdl2)
+ pkg_search_module(SDL2IMAGE REQUIRED SDL2_image)
+ pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer)
+ pkg_search_module(SDL2NET REQUIRED SDL2_net)
+ pkg_search_module(SDL2TTF REQUIRED SDL2_ttf)
+ pkg_search_module(SDL2GFX REQUIRED SDL2_gfx)
+else()
+ FIND_PACKAGE(SDL REQUIRED)
+ FIND_PACKAGE(SDL_image REQUIRED)
+ FIND_PACKAGE(SDL_mixer REQUIRED)
+ FIND_PACKAGE(SDL_net REQUIRED)
+ FIND_PACKAGE(SDL_ttf REQUIRED)
+ FIND_PACKAGE(SDL_gfx REQUIRED)
+endif()
+
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
@@ -31,6 +43,10 @@ ENDIF()
SET(FLAGS "${FLAGS} -DENABLE_LIBXML -DENABLE_ASSERTS")
+IF (USE_SDL2)
+ SET(FLAGS "${FLAGS} -DUSE_SDL2")
+ENDIF()
+
IF (CMAKE_BUILD_TYPE)
STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR
@@ -67,14 +83,29 @@ IF (USE_X11)
SET(FLAGS "${FLAGS} -DUSE_X11")
ENDIF (USE_X11)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+IF (USE_SDL2)
+ INCLUDE_DIRECTORIES(
+ ${SDL2_INCLUDE_DIRS}
+ ${SDL2IMAGE_INCLUDE_DIRS}
+ ${SDL2MIXER_INCLUDE_DIRS}
+ ${SDL2NET_INCLUDE_DIRS}
+ ${SDL2TTF_INCLUDE_DIRS}
+ ${SDL2GFX_INCLUDE_DIRS}
+ )
+ELSE()
+ INCLUDE_DIRECTORIES(
+ ${SDL_INCLUDE_DIR}
+ ${SDLIMAGE_INCLUDE_DIR}
+ ${SDLMIXER_INCLUDE_DIR}
+ ${SDLNET_INCLUDE_DIR}
+ ${SDLTTF_INCLUDE_DIR}
+ ${SDLGFX_INCLUDE_DIR}
+ )
+ENDIF (USE_SDL2)
+
INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${SDL_INCLUDE_DIR}
- ${SDLIMAGE_INCLUDE_DIR}
- ${SDLMIXER_INCLUDE_DIR}
- ${SDLNET_INCLUDE_DIR}
- ${SDLTTF_INCLUDE_DIR}
- ${SDLGFX_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${CURL_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
@@ -2206,14 +2237,27 @@ ENDIF(ENABLE_TMWA)
ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_EVOL})
#ADD_EXECUTABLE(dyecmd WIN32 ${DYE_CMD_SRCS})
+IF (USE_SDL2)
+ SET(SDL_LIBS
+ ${SDL2_LIBRARIES}
+ ${SDL2GFX_LIBRARIES}
+ ${SDL2IMAGE_LIBRARIES}
+ ${SDL2MIXER_LIBRARIES}
+ ${SDL2NET_LIBRARIES}
+ ${SDL2TTF_LIBRARIES})
+ELSE()
+ SET(SDL_LIBS
+ ${SDL_LIBRARY}
+ ${SDLGFX_LIBRARIES}
+ ${SDLIMAGE_LIBRARY}
+ ${SDLMIXER_LIBRARY}
+ ${SDLNET_LIBRARY}
+ ${SDLTTF_LIBRARY})
+ENDIF (USE_SDL2)
+
TARGET_LINK_LIBRARIES(manaplus
${X11_LIBRARIES}
- ${SDLGFX_LIBRARIES}
- ${SDL_LIBRARY}
- ${SDLIMAGE_LIBRARY}
- ${SDLMIXER_LIBRARY}
- ${SDLNET_LIBRARY}
- ${SDLTTF_LIBRARY}
+ ${SDL_LIBS}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${CURL_LIBRARIES}