Add OpenAL to build.

This commit is contained in:
MerryMage 2016-01-26 12:45:40 +00:00 committed by Sean Maas
parent 9f4d3a5db7
commit dc478666a3
4 changed files with 47 additions and 6 deletions

View file

@ -23,8 +23,16 @@ if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then
make -j4 && make install 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 elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew update > /dev/null # silence the very verbose output brew update > /dev/null # silence the very verbose output
brew install qt5 glfw3 brew install qt5 glfw3 openal-soft
gem install xcpretty gem install xcpretty
fi fi

View file

@ -38,6 +38,8 @@ project(citra)
option(ENABLE_GLFW "Enable the GLFW frontend" ON) option(ENABLE_GLFW "Enable the GLFW frontend" ON)
option(CITRA_USE_BUNDLED_GLFW "Download bundled GLFW binaries" OFF) 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(ENABLE_QT "Enable the Qt frontend" ON)
option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF)
option(CITRA_FORCE_QT4 "Use Qt4 even if Qt5 is available." OFF) option(CITRA_FORCE_QT4 "Use Qt4 even if Qt5 is available." OFF)
@ -159,10 +161,24 @@ if (ENABLE_GLFW)
endif() endif()
endif() endif()
set(OPENAL_PREFIX "${CMAKE_BINARY_DIR}/externals/openal-soft-1.17.1-bin") 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_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_LIBRARY_DIRS "${OPENAL_PREFIX}/libs/Win64" CACHE PATH "Path to OpenAL-Soft libraries")
set(OPENAL_LIBRARIES OpenAL32) set(OPENAL_LIBRARIES OpenAL32.lib)
else()
find_package(OpenAL REQUIRED)
endif()
link_directories(${OPENAL_LIBRARY_DIRS})
include_directories(${OPENAL_INCLUDE_DIRS}) include_directories(${OPENAL_INCLUDE_DIRS})
IF (APPLE) IF (APPLE)

View file

@ -19,7 +19,7 @@ install:
before_build: before_build:
- mkdir build - mkdir build
- cd 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 .. - cd ..
after_build: after_build:

View file

@ -82,6 +82,7 @@ endif()
target_link_libraries(citra-qt core video_core common qhexedit) 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 ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
target_link_libraries(citra-qt ${PLATFORM_LIBRARIES}) target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
target_link_libraries(citra-qt ${OPENAL_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
@ -122,3 +123,19 @@ if (Qt5_FOUND AND MSVC)
unset(DLL_DEST) unset(DLL_DEST)
unset(PLATFORMS) unset(PLATFORMS)
endif() endif()
if (MSVC)
set(OPENAL_DLL_DIR "${OPENAL_PREFIX}/bin/Win64/")
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
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()