From f5390ad4a6b4de4229a8734de3104a3896c982fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timmy=20Sj=C3=B6stedt?= Date: Tue, 24 May 2016 19:49:19 +0200 Subject: [PATCH] Include libsndfile & OpenAL --- CMakeLists.txt | 2 ++ cmake/modules/FindLibSndFile.cmake | 34 +++++++++++++++++++++++++ rwengine/CMakeLists.txt | 4 +++ rwengine/include/audio/SoundManager.hpp | 5 ++++ 4 files changed, 45 insertions(+) create mode 100644 cmake/modules/FindLibSndFile.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d92d329..a176f570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,10 +65,12 @@ IF(APPLE) ENDIF() find_package(OpenGL REQUIRED) +find_package(OpenAL REQUIRED) find_package(Bullet REQUIRED) find_package(SFML 2 COMPONENTS system window audio graphics network REQUIRED) find_package(MAD REQUIRED) find_package(GLM REQUIRED) +find_package(LibSndFile REQUIRED) include_directories("${GLM_INCLUDE_DIRS}") diff --git a/cmake/modules/FindLibSndFile.cmake b/cmake/modules/FindLibSndFile.cmake new file mode 100644 index 00000000..0d4e5dc8 --- /dev/null +++ b/cmake/modules/FindLibSndFile.cmake @@ -0,0 +1,34 @@ +# - Try to find libsndfile +# Once done, this will define +# +# LIBSNDFILE_FOUND - system has libsndfile +# LIBSNDFILE_INCLUDE_DIRS - the libsndfile include directories +# LIBSNDFILE_LIBRARIES - link these to use libsndfile + +# Use pkg-config to get hints about paths +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(LIBSNDFILE_PKGCONF sndfile) +endif(PKG_CONFIG_FOUND) + +# Include dir +find_path(LIBSNDFILE_INCLUDE_DIR + NAMES sndfile.h + PATHS ${LIBSNDFILE_PKGCONF_INCLUDE_DIRS} +) + +# Library +find_library(LIBSNDFILE_LIBRARY + NAMES sndfile libsndfile-1 + PATHS ${LIBSNDFILE_PKGCONF_LIBRARY_DIRS} +) + +find_package(PackageHandleStandardArgs) +find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR) + +if(LIBSNDFILE_FOUND) + set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY}) + set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR}) +endif(LIBSNDFILE_FOUND) + +mark_as_advanced(LIBSNDFILE_LIBRARY LIBSNDFILE_LIBRARIES LIBSNDFILE_INCLUDE_DIR LIBSNDFILE_INCLUDE_DIRS) diff --git a/rwengine/CMakeLists.txt b/rwengine/CMakeLists.txt index 9174a1d4..b75dd4c3 100644 --- a/rwengine/CMakeLists.txt +++ b/rwengine/CMakeLists.txt @@ -13,12 +13,16 @@ target_link_libraries(rwengine rwlib ${MAD_LIBRARY} ${SFML_LIBRARIES} + ${LIBSNDFILE_LIBRARY} + ${OPENAL_LIBRARY} ${OPENRW_PLATFORM_LIBS}) include_directories(SYSTEM ${BULLET_INCLUDE_DIR} ${MAD_INCLUDE_DIR} ${SFML_INCLUDE_DIR} + ${LIBSNDFILE_INCLUDE_DIR} + ${OPENAL_INCLUDE_DIR} ) include_directories( diff --git a/rwengine/include/audio/SoundManager.hpp b/rwengine/include/audio/SoundManager.hpp index 597f7d51..dbe5b673 100644 --- a/rwengine/include/audio/SoundManager.hpp +++ b/rwengine/include/audio/SoundManager.hpp @@ -1,4 +1,9 @@ #pragma once + +#include +#include +#include + #include #include