mirror of https://github.com/PCSX2/pcsx2.git
cmake: better support of SDL2
Description: Building with SDL2_API=TRUE is incomplete SDL_FOUND does not imply SDL2_FOUND Use check_libs for detection Only include ${SDL_INCLUDE_DIR} when needed Use SDL2_LIBRARIES Author: Miguel A. Colón Vélez Gregory: add back SDL_BUILDING_LIBRARY
This commit is contained in:
parent
16284d0a59
commit
c945aead54
|
@ -32,8 +32,6 @@ option(BUILD_REPLAY_LOADERS "Build GS replayer to ease testing (developer option
|
||||||
option(PACKAGE_MODE "Use this option to ease packaging of PCSX2 (developer/distribution option)")
|
option(PACKAGE_MODE "Use this option to ease packaging of PCSX2 (developer/distribution option)")
|
||||||
option(XDG_STD "Use XDG standard path instead of the standard PCSX2 path")
|
option(XDG_STD "Use XDG standard path instead of the standard PCSX2 path")
|
||||||
option(EXTRA_PLUGINS "Build various 'extra' plugins")
|
option(EXTRA_PLUGINS "Build various 'extra' plugins")
|
||||||
# FIXME do a proper detection
|
|
||||||
set(SDL2_LIBRARY "-lSDL2")
|
|
||||||
option(SDL2_API "Use SDL2 on spu2x and onepad")
|
option(SDL2_API "Use SDL2 on spu2x and onepad")
|
||||||
option(WX28_API "Force wxWidget 2.8 lib")
|
option(WX28_API "Force wxWidget 2.8 lib")
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,6 @@ find_package(Gettext) # translation tool
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
find_package(JPEG)
|
find_package(JPEG)
|
||||||
find_package(OpenGL)
|
find_package(OpenGL)
|
||||||
# Tell cmake that we use SDL as a library and not as an application
|
|
||||||
set(SDL_BUILDING_LIBRARY TRUE)
|
|
||||||
find_package(SDL)
|
|
||||||
# The requirement of wxWidgets is checked in SelectPcsx2Plugins module
|
# The requirement of wxWidgets is checked in SelectPcsx2Plugins module
|
||||||
# Does not require the module (allow to compile non-wx plugins)
|
# Does not require the module (allow to compile non-wx plugins)
|
||||||
# Force the unicode build (the variable is only supported on cmake 2.8.3 and above)
|
# Force the unicode build (the variable is only supported on cmake 2.8.3 and above)
|
||||||
|
@ -45,6 +42,16 @@ check_lib(GLESV2 GLESv2 GLES3/gl3ext.h) # NOTE: looking for GLESv3, not GLESv2
|
||||||
check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h)
|
check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h)
|
||||||
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h)
|
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h)
|
||||||
|
|
||||||
|
# Tell cmake that we use SDL as a library and not as an application
|
||||||
|
set(SDL_BUILDING_LIBRARY TRUE)
|
||||||
|
if(SDL2_API)
|
||||||
|
check_lib(SDL2 SDL2 SDL.h)
|
||||||
|
else()
|
||||||
|
# Tell cmake that we use SDL as a library and not as an application
|
||||||
|
set(SDL_BUILDING_LIBRARY TRUE)
|
||||||
|
find_package(SDL)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2
|
# Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2
|
||||||
# If you include first 3rdparty, all 3rdpary include will have a higer priority...
|
# If you include first 3rdparty, all 3rdpary include will have a higer priority...
|
||||||
# If you include first /usr/include, all system include will have a higer priority over the pcsx2 one...
|
# If you include first /usr/include, all system include will have a higer priority over the pcsx2 one...
|
||||||
|
@ -93,7 +100,7 @@ if(OPENGL_FOUND)
|
||||||
include_directories(${OPENGL_INCLUDE_DIR})
|
include_directories(${OPENGL_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SDL_FOUND)
|
if(SDL_FOUND AND NOT SDL2_API)
|
||||||
include_directories(${SDL_INCLUDE_DIR})
|
include_directories(${SDL_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ set(msg_dep_pcsx2 "check these libraries -> wxWidgets (>=2.8.10), gtk2 (>=
|
||||||
set(msg_dep_cdvdiso "check these libraries -> bzip2 (>=1.0.5), gtk2 (>=2.16)")
|
set(msg_dep_cdvdiso "check these libraries -> bzip2 (>=1.0.5), gtk2 (>=2.16)")
|
||||||
set(msg_dep_zerogs "check these libraries -> glew (>=1.6), opengl, X11, nvidia-cg-toolkit (>=2.1)")
|
set(msg_dep_zerogs "check these libraries -> glew (>=1.6), opengl, X11, nvidia-cg-toolkit (>=2.1)")
|
||||||
set(msg_dep_gsdx "check these libraries -> opengl, egl, X11")
|
set(msg_dep_gsdx "check these libraries -> opengl, egl, X11")
|
||||||
set(msg_dep_onepad "check these libraries -> sdl (==1.2)")
|
set(msg_dep_onepad "check these libraries -> sdl (>=1.2)")
|
||||||
set(msg_dep_spu2x "check these libraries -> soundtouch (>=1.5), alsa, portaudio (>=1.9), sdl (==1.2) pcsx2 common libs")
|
set(msg_dep_spu2x "check these libraries -> soundtouch (>=1.5), alsa, portaudio (>=1.9), sdl (>=1.2) pcsx2 common libs")
|
||||||
set(msg_dep_zerospu2 "check these libraries -> soundtouch (>=1.5), alsa")
|
set(msg_dep_zerospu2 "check these libraries -> soundtouch (>=1.5), alsa")
|
||||||
if(GLSL_API)
|
if(GLSL_API)
|
||||||
set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, pcsx2 common libs")
|
set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, pcsx2 common libs")
|
||||||
|
@ -208,7 +208,7 @@ endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# requires: -SDL
|
# requires: -SDL
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
if(SDL_FOUND)
|
if(SDL_FOUND OR SDL2_FOUND)
|
||||||
set(onepad TRUE)
|
set(onepad TRUE)
|
||||||
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad")
|
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad")
|
||||||
set(onepad FALSE)
|
set(onepad FALSE)
|
||||||
|
@ -236,7 +236,7 @@ endif()
|
||||||
# -SDL
|
# -SDL
|
||||||
# -common_libs
|
# -common_libs
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
if(ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND AND SDL_FOUND AND common_libs)
|
if(ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND AND (SDL_FOUND OR SDL2_FOUND) AND common_libs)
|
||||||
set(spu2-x TRUE)
|
set(spu2-x TRUE)
|
||||||
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/spu2-x")
|
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/spu2-x")
|
||||||
set(spu2-x FALSE)
|
set(spu2-x FALSE)
|
||||||
|
|
|
@ -82,7 +82,7 @@ set(onepadWindowsHeaders
|
||||||
|
|
||||||
if (SDL2_API)
|
if (SDL2_API)
|
||||||
set(onepadFinalLibs
|
set(onepadFinalLibs
|
||||||
${SDL2_LIBRARY}
|
${SDL2_LIBRARIES}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(onepadFinalLibs
|
set(onepadFinalLibs
|
||||||
|
|
|
@ -122,7 +122,7 @@ include_directories(Linux)
|
||||||
# endif(GCC_VERSION VERSION_GREATER 4.7)
|
# endif(GCC_VERSION VERSION_GREATER 4.7)
|
||||||
# endif()
|
# endif()
|
||||||
|
|
||||||
if(SDL_FOUND)
|
if(SDL_FOUND OR SDL2_FOUND)
|
||||||
list(APPEND spu2xSources SndOut_SDL.cpp)
|
list(APPEND spu2xSources SndOut_SDL.cpp)
|
||||||
if (SDL2_API)
|
if (SDL2_API)
|
||||||
set(spu2xFinalFlags
|
set(spu2xFinalFlags
|
||||||
|
@ -155,7 +155,7 @@ set(spu2xFinalLibs
|
||||||
if (SDL2_API)
|
if (SDL2_API)
|
||||||
set(spu2xFinalLibs
|
set(spu2xFinalLibs
|
||||||
${spu2xFinalLibs}
|
${spu2xFinalLibs}
|
||||||
${SDL2_LIBRARY}
|
${SDL2_LIBRARIES}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(spu2xFinalLibs
|
set(spu2xFinalLibs
|
||||||
|
|
Loading…
Reference in New Issue