From dc478666a334599adcd2a1f22fd3e95022a81c40 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Tue, 26 Jan 2016 12:45:40 +0000 Subject: [PATCH] Add OpenAL to build. --- .travis-deps.sh | 10 +++++++++- CMakeLists.txt | 24 ++++++++++++++++++++---- appveyor.yml | 2 +- src/citra_qt/CMakeLists.txt | 17 +++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/.travis-deps.sh b/.travis-deps.sh index 4b907abb3..47db47241 100755 --- a/.travis-deps.sh +++ b/.travis-deps.sh @@ -23,8 +23,16 @@ if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then make -j4 && make install ) + ( + git clone https://github.com/kcat/openal-soft.git + git reset --hard 14df326876d92f63c9c007da3c0434fba47c30b8 + mkdir openal-soft/build && cd openal-soft/build + cmake .. + make -j4 && make install + ) + elif [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update > /dev/null # silence the very verbose output - brew install qt5 glfw3 + brew install qt5 glfw3 openal-soft gem install xcpretty fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 59bcb3ad7..46c2ff3d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,8 @@ project(citra) option(ENABLE_GLFW "Enable the GLFW frontend" ON) option(CITRA_USE_BUNDLED_GLFW "Download bundled GLFW binaries" OFF) +option(CITRA_USE_BUNDLED_OPENAL "Download bundled OpenAL binaries" OFF) + option(ENABLE_QT "Enable the Qt frontend" ON) option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) option(CITRA_FORCE_QT4 "Use Qt4 even if Qt5 is available." OFF) @@ -159,10 +161,24 @@ if (ENABLE_GLFW) endif() endif() -set(OPENAL_PREFIX "${CMAKE_BINARY_DIR}/externals/openal-soft-1.17.1-bin") -set(OPENAL_INCLUDE_DIRS "${OPENAL_PREFIX}/include" CACHE PATH "Path to OpenAL-Soft headers") -set(OPENAL_LIBRARY_DIRS "${OPENAL_PREFIX}/libs/Win64" CACHE PATH "Path to OpenAL-Soft libraries") -set(OPENAL_LIBRARIES OpenAL32) +if (CITRA_USE_BUNDLED_OPENAL) + if (WIN32) + set(OPENAL_VER "openal-soft-1.17.1-bin") + else() + message(FATAL_ERROR "No bundled OpenAL binaries for your toolchain. Disable CITRA_USER_BUNDLED_OPENAL and provide your own.") + endif() + + if (DEFINED OPENAL_VER) + download_bundled_external("openal/" ${OPENAL_VER} OPENAL_PREFIX) + endif() + + set(OPENAL_INCLUDE_DIRS "${OPENAL_PREFIX}/include" CACHE PATH "Path to OpenAL-Soft headers") + set(OPENAL_LIBRARY_DIRS "${OPENAL_PREFIX}/libs/Win64" CACHE PATH "Path to OpenAL-Soft libraries") + set(OPENAL_LIBRARIES OpenAL32.lib) +else() + find_package(OpenAL REQUIRED) +endif() +link_directories(${OPENAL_LIBRARY_DIRS}) include_directories(${OPENAL_INCLUDE_DIRS}) IF (APPLE) diff --git a/appveyor.yml b/appveyor.yml index a5ed35392..963b04aa2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,7 @@ install: before_build: - mkdir build - cd build - - cmake -G "Visual Studio 14 2015 Win64" -DCITRA_USE_BUNDLED_GLFW=1 -DCITRA_USE_BUNDLED_QT=1 .. + - cmake -G "Visual Studio 14 2015 Win64" -DCITRA_USE_BUNDLED_GLFW=1 -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_OPENAL .. - cd .. after_build: diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index bbf6ae001..2b1e2cf0b 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -82,6 +82,7 @@ endif() target_link_libraries(citra-qt core video_core common qhexedit) target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) target_link_libraries(citra-qt ${PLATFORM_LIBRARIES}) +target_link_libraries(citra-qt ${OPENAL_LIBRARIES}) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") @@ -122,3 +123,19 @@ if (Qt5_FOUND AND MSVC) unset(DLL_DEST) unset(PLATFORMS) endif() + +if (MSVC) + set(OPENAL_DLL_DIR "${OPENAL_PREFIX}/bin/Win64/") + set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$/") + + string(REPLACE "/" "\\\\" OPENAL_DLL_DIR ${OPENAL_DLL_DIR}) + string(REPLACE "/" "\\\\" DLL_DEST ${DLL_DEST}) + + add_custom_command(TARGET citra-qt POST_BUILD + COMMAND robocopy ${OPENAL_DLL_DI} R${DLL_DEST} soft_oal.dll /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0" + COMMAND rename ${DLL_DEST}soft_oal.dll OpenAL.dll || cmd /c "exit /b 0" + ) + + unset(OPENAL_DLL_DIR) + unset(DLL_DEST) +endif() \ No newline at end of file