mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 17:04:10 +02:00
link PortAudio as a static library instead of compiling as dependency
This commit is contained in:
parent
669336a5a5
commit
4c9d1c19ff
6 changed files with 1222 additions and 22 deletions
44
cmake/modules/FindPortAudio.cmake
Normal file
44
cmake/modules/FindPortAudio.cmake
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Find the static PortAudio library
|
||||
#
|
||||
# You must provide a PORTAUDIO_ROOT_DIR which contains lib and include directories
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# PORTAUDIO_FOUND - system found PortAudio
|
||||
# PORTAUDIO_INCLUDE_DIRS - the PortAudio include directory
|
||||
# PORTAUDIO_LIBRARY - Link this to use PortAudio
|
||||
#
|
||||
# Created on 5/14/2013 by Stephen Birarda
|
||||
# Copyright (c) 2013 High Fidelity
|
||||
#
|
||||
|
||||
if (PORTAUDIO_LIBRARY AND PORTAUDIO_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
set(PORTAUDIO_FOUND TRUE)
|
||||
else (PORTAUDIO_LIBRARY AND PORTAUDIO_INCLUDE_DIRS)
|
||||
set(PORTAUDIO_INCLUDE_DIRS ${PORTAUDIO_ROOT_DIR}/include)
|
||||
|
||||
if (APPLE)
|
||||
set(PORTAUDIO_LIBRARY ${PORTAUDIO_ROOT_DIR}/lib/MacOS/libportaudio.a)
|
||||
else (WIN32)
|
||||
set(PORTAUDIO_LIBRARY ${PORTAUDIO_ROOT_DIR}/lib/UNIX/libportaudio.a)
|
||||
endif ()
|
||||
|
||||
if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARY)
|
||||
set(PORTAUDIO_FOUND TRUE)
|
||||
endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARY)
|
||||
|
||||
if (PORTAUDIO_FOUND)
|
||||
if (NOT PortAudio_FIND_QUIETLY)
|
||||
message(STATUS "Found PortAudio: ${PORTAUDIO_LIBRARY}")
|
||||
endif (NOT PortAudio_FIND_QUIETLY)
|
||||
else (PORTAUDIO_FOUND)
|
||||
if (PortAudio_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find PortAudio")
|
||||
endif (PortAudio_FIND_REQUIRED)
|
||||
endif (PORTAUDIO_FOUND)
|
||||
|
||||
# show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARY variables only in the advanced view
|
||||
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARY)
|
||||
|
||||
endif (PORTAUDIO_LIBRARY AND PORTAUDIO_INCLUDE_DIRS)
|
|
@ -10,7 +10,7 @@ project(${TARGET_NAME})
|
|||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/")
|
||||
set(LODEPNG_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/LodePNG)
|
||||
set(LIBOVR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/LibOVR)
|
||||
set(PORTAUDIO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/portaudio)
|
||||
set(PORTAUDIO_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/portaudio)
|
||||
|
||||
if (APPLE)
|
||||
set(GL_HEADERS "#include <GLUT/glut.h>\n#include <OpenGL/glext.h>")
|
||||
|
@ -131,28 +131,10 @@ if (WIN32)
|
|||
else (WIN32)
|
||||
target_link_libraries(${TARGET_NAME} ${LODEPNG_LIBRARY})
|
||||
|
||||
# include PortAudio as external project
|
||||
include(ExternalProject)
|
||||
set(PORTAUDIO_PROJ_DIR external/portaudio)
|
||||
ExternalProject_Add(
|
||||
portaudio
|
||||
PREFIX ${PORTAUDIO_PROJ_DIR}
|
||||
BINARY_DIR ${PORTAUDIO_PROJ_DIR}/src/portaudio
|
||||
URL ${PORTAUDIO_DIR}/pa_snapshot_020813.tgz
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix "${PROJECT_BINARY_DIR}/${PORTAUDIO_PROJ_DIR}"
|
||||
BUILD_COMMAND make
|
||||
)
|
||||
|
||||
# make PortAudio a dependency of the interface executable
|
||||
add_dependencies(${TARGET_NAME} portaudio)
|
||||
|
||||
# include the PortAudio headers
|
||||
ExternalProject_Get_Property(portaudio source_dir)
|
||||
include_directories(${source_dir}/include)
|
||||
|
||||
# link the PortAudio library
|
||||
ExternalProject_Get_Property(portaudio binary_dir)
|
||||
target_link_libraries(${TARGET_NAME} ${binary_dir}/lib/.libs/libportaudio.a)
|
||||
find_package(PortAudio REQUIRED)
|
||||
include_directories(${PORTAUDIO_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${PORTAUDIO_LIBRARY})
|
||||
|
||||
# link required libraries on UNIX
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
|
1174
interface/external/PortAudio/include/portaudio.h
vendored
Normal file
1174
interface/external/PortAudio/include/portaudio.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
BIN
interface/external/PortAudio/lib/MacOS/libportaudio.a
vendored
Normal file
BIN
interface/external/PortAudio/lib/MacOS/libportaudio.a
vendored
Normal file
Binary file not shown.
BIN
interface/external/PortAudio/lib/UNIX/libportaudio.a
vendored
Normal file
BIN
interface/external/PortAudio/lib/UNIX/libportaudio.a
vendored
Normal file
Binary file not shown.
BIN
interface/external/portaudio/pa_snapshot_020813.tgz
vendored
BIN
interface/external/portaudio/pa_snapshot_020813.tgz
vendored
Binary file not shown.
Loading…
Reference in a new issue