cmake: In AudioCommon, append sources and dependencies to a real target

This commit is contained in:
Florent Castelli 2017-02-05 00:33:53 +01:00
parent f1ba7832a5
commit ee8a21f1d0
1 changed files with 14 additions and 15 deletions

View File

@ -6,48 +6,47 @@ set(SRCS
NullSoundStream.cpp
)
set(LIBS "")
add_dolphin_library(audiocommon "${SRCS}" "")
find_package(OpenSLES)
if(OPENSLES_FOUND)
message(STATUS "OpenSLES found, enabling OpenSLES sound backend")
set(SRCS ${SRCS} OpenSLESStream.cpp)
set(LIBS ${LIBS} OpenSLES::OpenSLES)
target_sources(audiocommon PRIVATE OpenSLESStream.cpp)
target_link_libraries(audiocommon PRIVATE OpenSLES::OpenSLES)
endif()
if(ALSA_FOUND)
set(SRCS ${SRCS} AlsaSoundStream.cpp)
set(LIBS ${LIBS} ${ALSA_LIBRARIES})
target_sources(audiocommon PRIVATE AlsaSoundStream.cpp)
target_link_libraries(audiocommon PRIVATE ${ALSA_LIBRARIES})
endif()
if(AO_FOUND)
set(SRCS ${SRCS} AOSoundStream.cpp)
set(LIBS ${LIBS} ${AO_LIBRARIES})
target_sources(audiocommon PRIVATE AOSoundStream.cpp)
target_link_libraries(audiocommon PRIVATE ${AO_LIBRARIES})
endif()
if(OPENAL_FOUND)
set(SRCS ${SRCS} OpenALStream.cpp aldlist.cpp)
set(LIBS ${LIBS} ${OPENAL_LIBRARY} SoundTouch )
target_sources(audiocommon PRIVATE OpenALStream.cpp aldlist.cpp)
target_link_libraries(audiocommon PRIVATE ${OPENAL_LIBRARY} SoundTouch)
endif()
if(PULSEAUDIO_FOUND)
set(SRCS ${SRCS} PulseAudioStream.cpp)
set(LIBS ${LIBS} ${PULSEAUDIO_LIBRARIES})
target_sources(audiocommon PRIVATE PulseAudioStream.cpp)
target_link_libraries(audiocommon PRIVATE ${PULSEAUDIO_LIBRARIES})
endif()
if(WIN32)
set(SRCS ${SRCS} XAudio2Stream.cpp)
target_sources(audiocommon PRIVATE XAudio2Stream.cpp)
add_dolphin_library(audiocommon_xaudio27 "XAudio2_7Stream.cpp" "${LIBS}")
target_include_directories(audiocommon_xaudio27 PRIVATE
${PROJECT_SOURCE_DIR}/Externals
${PROJECT_SOURCE_DIR}/Externals/XAudio2_7
)
list(APPEND LIBS audiocommon_xaudio27)
target_link_libraries(audiocommon PRIVATE audiocommon_xaudio27)
elseif(APPLE)
set(SRCS ${SRCS} CoreAudioSoundStream.cpp)
target_sources(audiocommon PRIVATE CoreAudioSoundStream.cpp)
endif()
add_dolphin_library(audiocommon "${SRCS}" "${LIBS}")