Skip to content

Commit

Permalink
Set PortAudio dependencies on toolchain's STATIC IMPORTED library
Browse files Browse the repository at this point in the history
find_library is now performed in build/portaudio/CMakeLists.txt
instead of build/portaudio.cmake.
  • Loading branch information
bear101 committed Oct 6, 2023
1 parent 757394a commit 4fc64bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
20 changes: 0 additions & 20 deletions Library/TeamTalkLib/build/portaudio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,3 @@ else()
set (PORTAUDIO_LINK_FLAGS ${PORTAUDIO_LIBRARY})

endif()

if ( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
find_library (CARBON_LIBRARY Carbon)
list (APPEND PORTAUDIO_LINK_FLAGS ${CARBON_LIBRARY})
find_library (AUDIOUNIT_LIBRARY AudioUnit)
list (APPEND PORTAUDIO_LINK_FLAGS ${AUDIOUNIT_LIBRARY} )
find_library (COREAUDIO_LIBRARY CoreAudio)
list (APPEND PORTAUDIO_LINK_FLAGS ${COREAUDIO_LIBRARY} )
find_library (AUDIOTOOLBOX_LIBRARY AudioToolBox )
list (APPEND PORTAUDIO_LINK_FLAGS ${AUDIOTOOLBOX_LIBRARY} )
endif()

if ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
# Ubuntu: libasound2-dev
find_library(ASOUND_LIBRARY asound)
list (APPEND PORTAUDIO_LINK_FLAGS ${ASOUND_LIBRARY})
# Ubuntu: libpulse-dev
find_library(PULSE_LIBRARY pulse)
list (APPEND PORTAUDIO_LINK_FLAGS ${PULSE_LIBRARY})
endif()
14 changes: 14 additions & 0 deletions Library/TeamTalkLib/build/portaudio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,19 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (INSTALL_DIR ${TOOLCHAIN_INSTALL_PREFIX_PORTAUDIO})
endif()

find_library (CARBON_LIBRARY Carbon)
find_library (AUDIOUNIT_LIBRARY AudioUnit)
find_library (COREAUDIO_LIBRARY CoreAudio)
find_library (AUDIOTOOLBOX_LIBRARY AudioToolBox )

add_library(portaudio STATIC IMPORTED GLOBAL)
if (TOOLCHAIN_BUILD_EXTERNALPROJECTS)
add_dependencies(portaudio portaudio-src)
endif()
target_include_directories (portaudio INTERFACE ${INSTALL_DIR}/include)
set_target_properties(portaudio PROPERTIES
IMPORTED_LOCATION ${INSTALL_DIR}/lib/libportaudio.a)
target_link_libraries(portaudio INTERFACE ${CARBON_LIBRARY} ${AUDIOUNIT_LIBRARY} ${COREAUDIO_LIBRARY} ${AUDIOTOOLBOX_LIBRARY})

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")

Expand Down Expand Up @@ -100,14 +106,22 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (TOOLCHAIN_BUILD_EXTERNALPROJECTS)
add_dependencies(portaudio portaudio-src)
endif()

# Ubuntu: libasound2-dev
find_library(ASOUND_LIBRARY asound)
# Ubuntu: libpulse-dev
find_library(PULSE_LIBRARY pulse)

if (${CMAKE_VERSION} VERSION_LESS "3.11.0")
set_target_properties(portaudio PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include
IMPORTED_LOCATION ${INSTALL_DIR}/lib/libportaudio.a)
target_link_libraries(portaudio INTERFACE ${ASOUND_LIBRARY} ${PULSE_LIBRARY})
else()
target_include_directories (portaudio INTERFACE ${INSTALL_DIR}/include)
set_target_properties(portaudio PROPERTIES
IMPORTED_LOCATION ${INSTALL_DIR}/lib/libportaudio.a)
target_link_libraries(portaudio INTERFACE ${ASOUND_LIBRARY} ${PULSE_LIBRARY})
endif()

endif()

0 comments on commit 4fc64bf

Please sign in to comment.