cmake: clean sdl management

* sdl is mandatory for spu2x
* cmake will include either /usr/include/SDL or /usr/include/SDL2 so no
  need to add extra ifdef
This commit is contained in:
Gregory Hainaut 2014-12-07 21:06:21 +01:00
parent 9e8b0b59ba
commit 0a4f9e43d9
8 changed files with 24 additions and 74 deletions

View File

@ -42,7 +42,6 @@ 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(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h)
# Tell cmake that we use SDL as a library and not as an application
if(SDL2_API)
check_lib(SDL2 SDL2 SDL.h)
else()
@ -51,19 +50,8 @@ else()
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
# 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...
# Current implementation:
# 1/ include 3rdparty sub-directory that we will used (either request or fallback)
# 2/ include system one
#----------------------------------------
# Fallback on 3rdparty libraries
#----------------------------------------
# Empty
#----------------------------------------
# Use system include (if not 3rdparty one)
# Use system include
#----------------------------------------
if(Linux)
if(GTK2_FOUND)
@ -109,7 +97,7 @@ if(wxWidgets_FOUND)
# 64 bits machine with 32 bits library in /usr/lib32
if(_ARCH_64 AND NOT 64BIT_BUILD_DONT_WORK)
## There is no guarantee that wx-config is a link to a 32 bits library. So you need to force the destinity
# Library can go into 3 path major paths (+ multiarch but you will see that later when implementation is done)
# Library can go into 3 path major paths (+ multiarch)
# 1/ /usr/lib32 (32 bits only)
# 2/ /usr/lib64 (64 bits only)
# 3/ /usr/lib (32 or 64 bits depends on distributions)

View File

@ -21,6 +21,8 @@ endif()
# Check for additional dependencies.
# If all dependencies are available, including OS, build it
#-------------------------------------------------------------------------------
set(GTKn_FOUND GTK2_FOUND OR GTK3_FOUND)
set(SDLn_FOUND SDL_FOUND OR SDL2_FOUND)
#---------------------------------------
# Common libs
@ -55,7 +57,7 @@ else()
message(STATUS "${msg_dep_pcsx2}")
endif()
# Linux need also gtk2
if(Linux AND pcsx2_core AND NOT GTK2_FOUND)
if(Linux AND pcsx2_core AND NOT GTKn_FOUND)
set(pcsx2_core FALSE)
message(STATUS "Skip build of pcsx2 core: miss some dependencies")
message(STATUS "${msg_dep_pcsx2}")
@ -73,7 +75,7 @@ endif()
#---------------------------------------
# CDVDnull
#---------------------------------------
if(GTK2_FOUND)
if(GTKn_FOUND)
set(CDVDnull TRUE)
endif()
#---------------------------------------
@ -85,7 +87,7 @@ endif()
# -gtk2 (linux)
#---------------------------------------
if(EXTRA_PLUGINS)
if(BZIP2_FOUND AND GTK2_FOUND)
if(BZIP2_FOUND AND GTKn_FOUND)
set(CDVDiso TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/CDVDiso")
set(CDVDiso FALSE)
@ -106,7 +108,7 @@ endif()
#---------------------------------------
# dev9null
#---------------------------------------
if(GTK2_FOUND)
if(GTKn_FOUND)
set(dev9null TRUE)
endif()
#---------------------------------------
@ -114,7 +116,7 @@ endif()
#---------------------------------------
# FWnull
#---------------------------------------
if(GTK2_FOUND)
if(GTKn_FOUND)
set(FWnull TRUE)
endif()
#---------------------------------------
@ -122,7 +124,7 @@ endif()
#---------------------------------------
# GSnull
#---------------------------------------
if(GTK2_FOUND AND EXTRA_PLUGINS)
if(GTKn_FOUND AND EXTRA_PLUGINS)
set(GSnull TRUE)
endif()
#---------------------------------------
@ -198,7 +200,7 @@ endif()
#---------------------------------------
# PadNull
#---------------------------------------
if(GTK2_FOUND AND EXTRA_PLUGINS)
if(GTKn_FOUND AND EXTRA_PLUGINS)
set(PadNull TRUE)
endif()
#---------------------------------------
@ -208,7 +210,7 @@ endif()
#---------------------------------------
# requires: -SDL
#---------------------------------------
if(SDL_FOUND OR SDL2_FOUND)
if(SDLn_FOUND)
set(onepad TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad")
set(onepad FALSE)
@ -222,7 +224,7 @@ endif()
#---------------------------------------
# SPU2null
#---------------------------------------
if(GTK2_FOUND AND EXTRA_PLUGINS)
if(GTKn_FOUND AND EXTRA_PLUGINS)
set(SPU2null TRUE)
endif()
#---------------------------------------
@ -236,7 +238,7 @@ endif()
# -SDL
# -common_libs
#---------------------------------------
if(ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND AND (SDL_FOUND OR SDL2_FOUND) AND common_libs)
if(ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND AND SDLn_FOUND AND common_libs)
set(spu2-x TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/spu2-x")
set(spu2-x FALSE)
@ -273,7 +275,7 @@ endif()
#---------------------------------------
# USBnull
#---------------------------------------
if(GTK2_FOUND)
if(GTKn_FOUND)
set(USBnull TRUE)
endif()
#---------------------------------------

View File

@ -38,13 +38,6 @@ if(CMAKE_BUILD_TYPE STREQUAL Release)
)
endif(CMAKE_BUILD_TYPE STREQUAL Release)
if (SDL2_API)
set(onepadFinalFlags
${onepadFinalFlags}
-DONEPAD_SDL2
)
endif()
# onepad sources
set(onepadSources
controller.cpp

View File

@ -22,11 +22,9 @@
#ifndef __JOYSTICK_H__
#define __JOYSTICK_H__
#ifdef ONEPAD_SDL2
#include "SDL2/SDL.h"
#include "SDL2/SDL_haptic.h"
#else
#include "SDL/SDL.h"
#include <SDL.h>
#if SDL_MAJOR_VERSION >= 2
#include <SDL_haptic.h>
#endif

View File

@ -65,6 +65,7 @@ set(spu2xSources
Reverb.cpp
SndOut.cpp
SndOut_Portaudio.cpp
SndOut_SDL.cpp
spu2freeze.cpp
Spu2replay.cpp
spu2sys.cpp
@ -111,32 +112,6 @@ set(spu2xLinuxHeaders
# add additional include directories
include_directories(Linux)
### Don't use yet c11 feature. I will bump gcc requirement to 4.7 when 4.9 is out.
### Note: actually it might work on 4.6 too
# # If compiling on GCC Version 4.7 or higher we build SDLMod in C++11 mode
# if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
# execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
# if(GCC_VERSION VERSION_GREATER 4.7)
# set_source_files_properties(SndOut_SDL.cpp PROPERTIES COMPILE_FLAGS -std=c++11)
# message(STATUS "GCC has C++11 support for SDLAudioMod")
# endif(GCC_VERSION VERSION_GREATER 4.7)
# endif()
if(SDL_FOUND OR SDL2_FOUND)
list(APPEND spu2xSources SndOut_SDL.cpp)
if (SDL2_API)
set(spu2xFinalFlags
${spu2xFinalFlags}
-DSPU2X_SDL2
)
else()
set(spu2xFinalFlags
${spu2xFinalFlags}
-DSPU2X_SDL
)
endif()
endif()
set(spu2xFinalSources
${spu2xSources}
${spu2xHeaders}

View File

@ -92,10 +92,8 @@ SndOutModule* mods[]=
WaveOut,
#endif
PortaudioOut,
#if defined(SPU2X_SDL) || defined(SPU2X_SDL2)
SDLOut,
#endif
#ifdef __linux__
SDLOut,
AlsaOut,
#endif
NULL // signals the end of our list

View File

@ -672,10 +672,8 @@ extern SndOutModule* DSoundOut;
extern SndOutModule* XAudio2Out;
#endif
extern SndOutModule* PortaudioOut;
#if defined(SPU2X_SDL) || defined(SPU2X_SDL2)
extern SndOutModule * const SDLOut;
#endif
#ifdef __linux__
extern SndOutModule * const SDLOut;
extern SndOutModule* AlsaOut;
#endif

View File

@ -28,13 +28,11 @@
/* Using SDL2 requires other SDL dependencies in pcsx2 get upgraded as well, or the
* symbol tables would conflict. Other dependencies in Linux are wxwidgets (you can
* build wx without sdl support, though) and onepad at the time of writing this. */
#ifdef SPU2X_SDL2
#include <SDL2/SDL.h>
#include <SDL2/SDL_audio.h>
#include <SDL.h>
#include <SDL_audio.h>
#if SDL_MAJOR_VERSION >= 2
typedef StereoOut32 StereoOut_SDL;
#else
#include <SDL/SDL.h>
#include <SDL/SDL_audio.h>
typedef StereoOut16 StereoOut_SDL;
#endif