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