Only build OpenAL on Windows

This commit is contained in:
Michael Maltese 2017-06-25 23:52:51 -07:00
parent 42ea1c8ecf
commit 18e70cdf91
5 changed files with 15 additions and 33 deletions

View File

@ -21,7 +21,6 @@ option(ENABLE_GENERIC "Enables generic build that should run on any little-endia
option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
option(ENABLE_ALSA "Enables ALSA sound backend" ON)
option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON)
option(ENABLE_OPENAL "Enables OpenAL sound backend" ON)
option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON)
# Maintainers: if you consider blanket disabling this for your users, please

View File

@ -32,23 +32,6 @@ else()
message(STATUS "ALSA explicitly disabled, disabling ALSA sound backend")
endif()
if(ENABLE_OPENAL)
if(WIN32)
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/Externals/OpenAL)
endif()
find_package(OpenAL)
if(OPENAL_FOUND)
message(STATUS "OpenAL found, enabling OpenAL sound backend")
target_sources(audiocommon PRIVATE OpenALStream.cpp)
target_link_libraries(audiocommon PRIVATE OpenAL::OpenAL)
target_compile_definitions(audiocommon PRIVATE HAVE_OPENAL=1)
else()
message(STATUS "OpenAL NOT found, disabling OpenAL sound backend")
endif()
else()
message(STATUS "OpenAL explicitly disabled, disabling OpenAL sound backend")
endif()
if(ENABLE_PULSEAUDIO)
# PulseAudio ships with a PulseAudioConfig.cmake with no imported target
# So we use our own FindPulseAudio instead with "MODULE"
@ -75,6 +58,16 @@ if(WIN32)
)
target_link_libraries(audiocommon PRIVATE audiocommon_xaudio27)
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/Externals/OpenAL)
find_package(OpenAL)
if(OPENAL_FOUND)
message(STATUS "OpenAL found, enabling OpenAL sound backend")
target_sources(audiocommon PRIVATE OpenALStream.cpp)
target_link_libraries(audiocommon PRIVATE OpenAL::OpenAL)
else()
message(FATAL_ERROR "OpenAL NOT found in Externals")
endif()
elseif(APPLE)
target_sources(audiocommon PRIVATE CoreAudioSoundStream.cpp)
endif()

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#if defined HAVE_OPENAL && HAVE_OPENAL
#ifdef _WIN32
#include <climits>
#include <cstring>
@ -347,4 +347,4 @@ void OpenALStream::SoundLoop()
}
}
#endif // HAVE_OPENAL
#endif // _WIN32

View File

@ -12,19 +12,10 @@
#include "Core/HW/AudioInterface.h"
#include "Core/HW/SystemTimers.h"
#if defined HAVE_OPENAL && HAVE_OPENAL
#ifdef _WIN32
#include <OpenAL/include/al.h>
#include <OpenAL/include/alc.h>
#include <OpenAL/include/alext.h>
#elif defined __APPLE__
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#endif
#define SFX_MAX_SOURCE 1
#define OAL_MAX_BUFFERS 32
@ -40,7 +31,7 @@
#define FRAME_SURROUND_FLOAT SURROUND_CHANNELS* SIZE_FLOAT
#define FRAME_SURROUND_SHORT SURROUND_CHANNELS* SIZE_SHORT
#define FRAME_SURROUND_INT32 SURROUND_CHANNELS* SIZE_INT32
#endif
#endif // _WIN32
// From AL_EXT_float32
#ifndef AL_FORMAT_STEREO_FLOAT32
@ -63,7 +54,7 @@
class OpenALStream final : public SoundStream
{
#if defined HAVE_OPENAL && HAVE_OPENAL
#ifdef _WIN32
public:
OpenALStream() : uiSource(0) {}
bool Start() override;
@ -87,5 +78,5 @@ private:
ALfloat fVolume;
u8 numBuffers;
#endif // HAVE_OPENAL
#endif // _WIN32
};

View File

@ -61,7 +61,6 @@
<PreprocessorDefinitions>SFML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_ANALYTICS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_OPENAL=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_ARCH_64=1;_M_X86_64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!--
Make sure we include a clean version of windows.h.