Add support for XAudio2 redistributable

Bundle XAudio2 to better support Win7

Fix wangqr/Aegisub#59
This commit is contained in:
wangqr 2020-07-20 16:16:20 -04:00
parent 940181c7bc
commit e5f543c1ab
3 changed files with 24 additions and 0 deletions

View file

@ -569,6 +569,13 @@ if(WIN32)
if(WITH_XAUDIO2)
target_compile_definitions(Aegisub PRIVATE "WITH_XAUDIO2")
target_sources(Aegisub PRIVATE src/audio_player_xaudio2.cpp)
option(XAUDIO2_REDIST "Use XAudio redistributable")
if(XAUDIO2_REDIST)
find_package(XAudio2redist REQUIRED)
target_compile_definitions(Aegisub PRIVATE "XAUDIO2_REDIST")
target_include_directories(Aegisub PRIVATE ${XAudio2redist_INCLUDE_DIRS})
target_link_libraries(Aegisub PRIVATE ${XAudio2redist_LIBRARIES})
endif()
endif()
else()
set(WITH_DIRECTSOUND OFF)

View file

@ -0,0 +1,13 @@
find_path(XAudio2redist_INCLUDE_DIRS
NAMES xaudio2redist.h
)
find_library(XAudio2redist_LIBRARIES
NAMES xaudio2_9redist
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XAudio2redist
FOUND_VAR XAudio2redist_FOUND
REQUIRED_VARS
XAudio2redist_LIBRARIES
XAudio2redist_INCLUDE_DIRS
)

View file

@ -37,7 +37,11 @@
#include <libaegisub/log.h>
#include <libaegisub/make_unique.h>
#ifndef XAUDIO2_REDIST
#include <xaudio2.h>
#else
#include <xaudio2redist.h>
#endif
namespace {
class XAudio2Thread;