Enabled sfml-audio on iOS

This commit is contained in:
Laurent 2015-02-28 23:38:22 +01:00 committed by Mario Liebisch
parent f17ea5872b
commit 6ab8d43b04
3 changed files with 21 additions and 8 deletions

View File

@ -31,8 +31,13 @@
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
#include <iostream> #include <iostream>
#include <string> #include <string>
#ifdef SFML_SYSTEM_IOS
#include <OpenAl/al.h>
#include <OpenAl/alc.h>
#else
#include <al.h> #include <al.h>
#include <alc.h> #include <alc.h>
#endif
namespace sf namespace sf

View File

@ -67,7 +67,9 @@ endif()
# find external libraries # find external libraries
if(NOT SFML_OS_ANDROID) if(NOT SFML_OS_ANDROID)
if(NOT SFML_OS_IOS)
find_package(OpenAL REQUIRED) find_package(OpenAL REQUIRED)
endif()
find_package(Vorbis REQUIRED) find_package(Vorbis REQUIRED)
find_package(FLAC REQUIRED) find_package(FLAC REQUIRED)
else() else()
@ -75,17 +77,25 @@ else()
find_host_package(Vorbis REQUIRED) find_host_package(Vorbis REQUIRED)
find_host_package(FLAC REQUIRED) find_host_package(FLAC REQUIRED)
endif() endif()
if(NOT SFML_OS_IOS)
include_directories(${OPENAL_INCLUDE_DIR}) include_directories(${OPENAL_INCLUDE_DIR})
endif()
include_directories(${VORBIS_INCLUDE_DIRS}) include_directories(${VORBIS_INCLUDE_DIRS})
include_directories(${FLAC_INCLUDE_DIR}) include_directories(${FLAC_INCLUDE_DIR})
add_definitions(-DOV_EXCLUDE_STATIC_CALLBACKS) # avoids warnings in vorbisfile.h add_definitions(-DOV_EXCLUDE_STATIC_CALLBACKS) # avoids warnings in vorbisfile.h
add_definitions(-DFLAC__NO_DLL) add_definitions(-DFLAC__NO_DLL)
# build the list of external libraries to link # build the list of external libraries to link
if(SFML_OS_IOS)
list(APPEND AUDIO_EXT_LIBS "-framework OpenAL")
else()
list(APPEND AUDIO_EXT_LIBS ${OPENAL_LIBRARY})
endif()
if(SFML_OS_ANDROID) if(SFML_OS_ANDROID)
list(APPEND AUDIO_EXT_LIBS android OpenSLES) list(APPEND AUDIO_EXT_LIBS android OpenSLES)
endif() endif()
list(APPEND AUDIO_EXT_LIBS ${OPENAL_LIBRARY} ${VORBIS_LIBRARIES} ${FLAC_LIBRARY}) list(APPEND AUDIO_EXT_LIBS ${VORBIS_LIBRARIES} ${FLAC_LIBRARY})
# define the sfml-audio target # define the sfml-audio target
sfml_add_library(sfml-audio sfml_add_library(sfml-audio

View File

@ -48,6 +48,4 @@ endif()
add_subdirectory(Window) add_subdirectory(Window)
add_subdirectory(Network) add_subdirectory(Network)
add_subdirectory(Graphics) add_subdirectory(Graphics)
if(NOT SFML_OS_IOS)
add_subdirectory(Audio) add_subdirectory(Audio)
endif()