OpenAL-soft for windows

This commit is contained in:
RexTimmy 2016-10-22 09:22:33 +10:00
parent e2f2c4932b
commit 3a0a720115
207 changed files with 53310 additions and 13291 deletions

View file

@ -0,0 +1,9 @@
#include <sys/types.h>
#define KB ((off_t)(1024))
#define MB ((off_t)(KB*1024))
#define GB ((off_t)(MB*1024))
int tb[((GB+GB+GB) > GB) ? 1 : -1];
int main()
{ return 0; }

View file

@ -0,0 +1,39 @@
# - Check if the _FILE_OFFSET_BITS macro is needed for large files
# CHECK_FILE_OFFSET_BITS()
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2009, Chris Robinson
#
# Redistribution and use is allowed according to the terms of the LGPL license.
MACRO(CHECK_FILE_OFFSET_BITS)
IF(NOT DEFINED _FILE_OFFSET_BITS)
MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files")
TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CheckFileOffsetBits.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
IF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CheckFileOffsetBits.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - 64")
ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - not needed")
ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
ENDIF(NOT DEFINED _FILE_OFFSET_BITS)
ENDMACRO(CHECK_FILE_OFFSET_BITS)

View file

@ -0,0 +1,92 @@
# - Check if a symbol exists as a function, variable, or macro
# CHECK_SYMBOL_EXISTS(<symbol> <files> <variable>)
#
# Check that the <symbol> is available after including given header
# <files> and store the result in a <variable>. Specify the list
# of files in one argument as a semicolon-separated list.
#
# If the header files define the symbol as a macro it is considered
# available and assumed to work. If the header files declare the
# symbol as a function or variable then the symbol must also be
# available for linking. If the symbol is a type or enum value
# it will not be recognized (consider using CheckTypeSize or
# CheckCSourceCompiles).
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
#=============================================================================
# Copyright 2003-2011 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
MACRO(CHECK_SHARED_FUNCTION_EXISTS SYMBOL FILES LIBRARY LOCATION VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
IF(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_SYMBOL_EXISTS_LIBS
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES};${LIBRARY}")
ELSE(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_SYMBOL_EXISTS_LIBS
"-DLINK_LIBRARIES:STRING=${LIBRARY}")
ENDIF(CMAKE_REQUIRED_LIBRARIES)
IF(CMAKE_REQUIRED_INCLUDES)
SET(CMAKE_SYMBOL_EXISTS_INCLUDES
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
ELSE(CMAKE_REQUIRED_INCLUDES)
SET(CMAKE_SYMBOL_EXISTS_INCLUDES)
ENDIF(CMAKE_REQUIRED_INCLUDES)
FOREACH(FILE ${FILES})
SET(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
ENDFOREACH(FILE)
SET(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\nvoid cmakeRequireSymbol(int dummy,...){(void)dummy;}\nint main()\n{\n cmakeRequireSymbol(0,&${SYMBOL});\n return 0;\n}\n")
CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" @ONLY)
MESSAGE(STATUS "Looking for ${SYMBOL} in ${LIBRARY}")
TRY_COMPILE(${VARIABLE}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
-DLINK_DIRECTORIES:STRING=${LOCATION}
"${CHECK_SYMBOL_EXISTS_LIBS}"
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
MESSAGE(STATUS "Looking for ${SYMBOL} in ${LIBRARY} - found")
SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL} in ${LIBRARY}")
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the ${SYMBOL} "
"exist in ${LIBRARY} passed with the following output:\n"
"${OUTPUT}\nFile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n"
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${SYMBOL} in ${LIBRARY} - not found.")
SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL} in ${LIBRARY}")
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${SYMBOL} "
"exist in ${LIBRARY} failed with the following output:\n"
"${OUTPUT}\nFile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n"
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
ENDIF(${VARIABLE})
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_SHARED_FUNCTION_EXISTS)

View file

@ -0,0 +1,73 @@
# - Find alsa
# Find the alsa libraries (asound)
#
# This module defines the following variables:
# ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found
# ALSA_LIBRARIES - Set when ALSA_LIBRARY is found
# ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found
#
# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc.
# ALSA_LIBRARY - the asound library
# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8)
#
#=============================================================================
# Copyright 2009-2011 Kitware, Inc.
# Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * The names of Kitware, Inc., the Insight Consortium, or the names of
# any consortium members, or of any contributors, may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
DOC "The ALSA (asound) include directory"
)
find_library(ALSA_LIBRARY NAMES asound
DOC "The ALSA (asound) library"
)
if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
file(STRINGS "${ALSA_INCLUDE_DIR}/alsa/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"")
string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}")
unset(alsa_version_str)
endif()
# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ALSA
REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
VERSION_VAR ALSA_VERSION_STRING)
if(ALSA_FOUND)
set( ALSA_LIBRARIES ${ALSA_LIBRARY} )
set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} )
endif()
mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)

View file

@ -0,0 +1,21 @@
# - Find AudioIO includes and libraries
#
# AUDIOIO_FOUND - True if AUDIOIO_INCLUDE_DIR is found
# AUDIOIO_INCLUDE_DIRS - Set when AUDIOIO_INCLUDE_DIR is found
#
# AUDIOIO_INCLUDE_DIR - where to find sys/audioio.h, etc.
#
find_path(AUDIOIO_INCLUDE_DIR
NAMES sys/audioio.h
DOC "The AudioIO include directory"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AudioIO REQUIRED_VARS AUDIOIO_INCLUDE_DIR)
if(AUDIOIO_FOUND)
set(AUDIOIO_INCLUDE_DIRS ${AUDIOIO_INCLUDE_DIR})
endif()
mark_as_advanced(AUDIOIO_INCLUDE_DIR)

View file

@ -0,0 +1,35 @@
# - Find DirectSound includes and libraries
#
# DSOUND_FOUND - True if DSOUND_INCLUDE_DIR & DSOUND_LIBRARY are found
# DSOUND_LIBRARIES - Set when DSOUND_LIBRARY is found
# DSOUND_INCLUDE_DIRS - Set when DSOUND_INCLUDE_DIR is found
#
# DSOUND_INCLUDE_DIR - where to find dsound.h, etc.
# DSOUND_LIBRARY - the dsound library
#
find_path(DSOUND_INCLUDE_DIR
NAMES dsound.h
PATHS "${DXSDK_DIR}"
PATH_SUFFIXES include
DOC "The DirectSound include directory"
)
find_library(DSOUND_LIBRARY
NAMES dsound
PATHS "${DXSDK_DIR}"
PATH_SUFFIXES lib lib/x86 lib/x64
DOC "The DirectSound library"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DSound
REQUIRED_VARS DSOUND_LIBRARY DSOUND_INCLUDE_DIR
)
if(DSOUND_FOUND)
set(DSOUND_LIBRARIES ${DSOUND_LIBRARY})
set(DSOUND_INCLUDE_DIRS ${DSOUND_INCLUDE_DIR})
endif()
mark_as_advanced(DSOUND_INCLUDE_DIR DSOUND_LIBRARY)

View file

@ -0,0 +1,173 @@
# vim: ts=2 sw=2
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
#
# Once done this will define
# FFMPEG_FOUND - System has the all required components.
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
#
# For each of the components it will additionaly set.
# - AVCODEC
# - AVDEVICE
# - AVFORMAT
# - AVUTIL
# - POSTPROC
# - SWSCALE
# - SWRESAMPLE
# the following variables will be defined
# <component>_FOUND - System has <component>
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
# <component>_LIBRARIES - Link these to use <component>
# <component>_DEFINITIONS - Compiler switches required for using <component>
# <component>_VERSION - The components version
#
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
#
# Redistribution and use is allowed according to the terms of the BSD license.
include(FindPackageHandleStandardArgs)
if(NOT FFmpeg_FIND_COMPONENTS)
set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL)
endif()
#
### Macro: set_component_found
#
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
#
macro(set_component_found _component)
if(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
# message(STATUS " - ${_component} found.")
set(${_component}_FOUND TRUE)
else()
# message(STATUS " - ${_component} not found.")
endif()
endmacro()
#
### Macro: find_component
#
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
# include directories.
#
macro(find_component _component _pkgconfig _library _header)
if(NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_${_component} ${_pkgconfig})
endif()
endif()
find_path(${_component}_INCLUDE_DIRS ${_header}
HINTS
${FFMPEGSDK_INC}
${PC_LIB${_component}_INCLUDEDIR}
${PC_LIB${_component}_INCLUDE_DIRS}
PATH_SUFFIXES
ffmpeg
)
find_library(${_component}_LIBRARIES NAMES ${_library}
HINTS
${FFMPEGSDK_LIB}
${PC_LIB${_component}_LIBDIR}
${PC_LIB${_component}_LIBRARY_DIRS}
)
STRING(REGEX REPLACE "/.*" "/version.h" _ver_header ${_header})
if(EXISTS "${${_component}_INCLUDE_DIRS}/${_ver_header}")
file(STRINGS "${${_component}_INCLUDE_DIRS}/${_ver_header}" version_str REGEX "^#define[\t ]+LIB${_component}_VERSION_M.*")
foreach(_str "${version_str}")
if(NOT version_maj)
string(REGEX REPLACE "^.*LIB${_component}_VERSION_MAJOR[\t ]+([0-9]*).*$" "\\1" version_maj "${_str}")
endif()
if(NOT version_min)
string(REGEX REPLACE "^.*LIB${_component}_VERSION_MINOR[\t ]+([0-9]*).*$" "\\1" version_min "${_str}")
endif()
if(NOT version_mic)
string(REGEX REPLACE "^.*LIB${_component}_VERSION_MICRO[\t ]+([0-9]*).*$" "\\1" version_mic "${_str}")
endif()
endforeach()
unset(version_str)
set(${_component}_VERSION "${version_maj}.${version_min}.${version_mic}" CACHE STRING "The ${_component} version number.")
unset(version_maj)
unset(version_min)
unset(version_mic)
endif(EXISTS "${${_component}_INCLUDE_DIRS}/${_ver_header}")
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
set_component_found(${_component})
mark_as_advanced(
${_component}_INCLUDE_DIRS
${_component}_LIBRARIES
${_component}_DEFINITIONS
${_component}_VERSION)
endmacro()
set(FFMPEGSDK $ENV{FFMPEG_HOME})
if(FFMPEGSDK)
set(FFMPEGSDK_INC "${FFMPEGSDK}/include")
set(FFMPEGSDK_LIB "${FFMPEGSDK}/lib")
endif()
# Check for all possible components.
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
foreach(_component ${FFmpeg_FIND_COMPONENTS})
if(${_component}_FOUND)
# message(STATUS "Required component ${_component} present.")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
else()
# message(STATUS "Required component ${_component} missing.")
endif()
endforeach()
# Build the include path and library list with duplicates removed.
if(FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
endif()
if(FFMPEG_LIBRARIES)
list(REMOVE_DUPLICATES FFMPEG_LIBRARIES)
endif()
# cache the vars.
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS)
# Now set the noncached _FOUND vars for the components.
foreach(_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWRESAMPLE SWSCALE)
set_component_found(${_component})
endforeach ()
# Compile the list of required vars
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
foreach(_component ${FFmpeg_FIND_COMPONENTS})
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
endforeach()
# Give a nice error message if some of the required vars are missing.
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})

View file

@ -0,0 +1,60 @@
# - Find JACK
# Find the JACK libraries
#
# This module defines the following variables:
# JACK_FOUND - True if JACK_INCLUDE_DIR & JACK_LIBRARY are found
# JACK_INCLUDE_DIRS - where to find jack.h, etc.
# JACK_LIBRARIES - the jack library
#
#=============================================================================
# Copyright 2009-2011 Kitware, Inc.
# Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * The names of Kitware, Inc., the Insight Consortium, or the names of
# any consortium members, or of any contributors, may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_path(JACK_INCLUDE_DIR NAMES jack/jack.h
DOC "The JACK include directory"
)
find_library(JACK_LIBRARY NAMES jack
DOC "The JACK library"
)
# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JACK REQUIRED_VARS JACK_LIBRARY JACK_INCLUDE_DIR)
if(JACK_FOUND)
set(JACK_LIBRARIES ${JACK_LIBRARY})
set(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR})
endif()
mark_as_advanced(JACK_INCLUDE_DIR JACK_LIBRARY)

View file

@ -0,0 +1,21 @@
# - Find OSS includes
#
# OSS_FOUND - True if OSS_INCLUDE_DIR is found
# OSS_INCLUDE_DIRS - Set when OSS_INCLUDE_DIR is found
#
# OSS_INCLUDE_DIR - where to find sys/soundcard.h, etc.
#
find_path(OSS_INCLUDE_DIR
NAMES sys/soundcard.h
DOC "The OSS include directory"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OSS REQUIRED_VARS OSS_INCLUDE_DIR)
if(OSS_FOUND)
set(OSS_INCLUDE_DIRS ${OSS_INCLUDE_DIR})
endif()
mark_as_advanced(OSS_INCLUDE_DIR)

View file

@ -0,0 +1,32 @@
# - Find PortAudio includes and libraries
#
# PORTAUDIO_FOUND - True if PORTAUDIO_INCLUDE_DIR & PORTAUDIO_LIBRARY
# are found
# PORTAUDIO_LIBRARIES - Set when PORTAUDIO_LIBRARY is found
# PORTAUDIO_INCLUDE_DIRS - Set when PORTAUDIO_INCLUDE_DIR is found
#
# PORTAUDIO_INCLUDE_DIR - where to find portaudio.h, etc.
# PORTAUDIO_LIBRARY - the portaudio library
#
find_path(PORTAUDIO_INCLUDE_DIR
NAMES portaudio.h
DOC "The PortAudio include directory"
)
find_library(PORTAUDIO_LIBRARY
NAMES portaudio
DOC "The PortAudio library"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PortAudio
REQUIRED_VARS PORTAUDIO_LIBRARY PORTAUDIO_INCLUDE_DIR
)
if(PORTAUDIO_FOUND)
set(PORTAUDIO_LIBRARIES ${PORTAUDIO_LIBRARY})
set(PORTAUDIO_INCLUDE_DIRS ${PORTAUDIO_INCLUDE_DIR})
endif()
mark_as_advanced(PORTAUDIO_INCLUDE_DIR PORTAUDIO_LIBRARY)

View file

@ -0,0 +1,43 @@
# - Find PulseAudio includes and libraries
#
# PULSEAUDIO_FOUND - True if PULSEAUDIO_INCLUDE_DIR &
# PULSEAUDIO_LIBRARY are found
# PULSEAUDIO_LIBRARIES - Set when PULSEAUDIO_LIBRARY is found
# PULSEAUDIO_INCLUDE_DIRS - Set when PULSEAUDIO_INCLUDE_DIR is found
#
# PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
# PULSEAUDIO_LIBRARY - the pulse library
# PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
#
find_path(PULSEAUDIO_INCLUDE_DIR
NAMES pulse/pulseaudio.h
DOC "The PulseAudio include directory"
)
find_library(PULSEAUDIO_LIBRARY
NAMES pulse
DOC "The PulseAudio library"
)
if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
unset(pulse_version_str)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PulseAudio
REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
VERSION_VAR PULSEAUDIO_VERSION_STRING
)
if(PULSEAUDIO_FOUND)
set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY})
set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR})
endif()
mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)

View file

@ -0,0 +1,34 @@
# - Find QSA includes and libraries
#
# QSA_FOUND - True if QSA_INCLUDE_DIR & QSA_LIBRARY are found
# QSA_LIBRARIES - Set when QSA_LIBRARY is found
# QSA_INCLUDE_DIRS - Set when QSA_INCLUDE_DIR is found
#
# QSA_INCLUDE_DIR - where to find sys/asoundlib.h, etc.
# QSA_LIBRARY - the asound library
#
# Only check for QSA on QNX, because it conflicts with ALSA.
if("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
find_path(QSA_INCLUDE_DIR
NAMES sys/asoundlib.h
DOC "The QSA include directory"
)
find_library(QSA_LIBRARY
NAMES asound
DOC "The QSA library"
)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QSA
REQUIRED_VARS QSA_LIBRARY QSA_INCLUDE_DIR
)
if(QSA_FOUND)
set(QSA_LIBRARIES ${QSA_LIBRARY})
set(QSA_INCLUDE_DIRS ${QSA_INCLUDE_DIR})
endif()
mark_as_advanced(QSA_INCLUDE_DIR QSA_LIBRARY)

View file

@ -0,0 +1,193 @@
# Locate SDL2 library
# This module defines
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL2
# SDL2_INCLUDE_DIR, where to find SDL.h
#
# This module responds to the the flag:
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
# Don't forget to include SDL2main.h and SDL2main.m your project for the
# OS X framework based version. (Other versions link to -lSDL2main which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final SDL2_LIBRARY
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
#
#
# $SDL2DIR is an environment variable that would
# correspond to the ./configure --prefix=$SDL2DIR
# used in building SDL2.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL2 guidelines.
# Added a search for SDL2main which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL2_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
# This needed to change because "proper" SDL2 convention
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
# reasons because not all systems place things in SDL2/ (see FreeBSD).
#
# Ported by Johnny Patterson. This is a literal port for SDL2 of the FindSDL.cmake
# module with the minor edit of changing "SDL" to "SDL2" where necessary. This
# was not created for redistribution, and exists temporarily pending official
# SDL2 CMake modules.
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL2
/usr/include/SDL2
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
#MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}")
FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}")
IF(NOT SDL2_BUILDING_LIBRARY)
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# SDL2 may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
IF(NOT APPLE)
FIND_PACKAGE(Threads)
ENDIF(NOT APPLE)
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
IF(MINGW)
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)
SET(SDL2_FOUND "NO")
IF(SDL2_LIBRARY_TEMP)
# For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(SDL2MAIN_LIBRARY)
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
ENDIF(APPLE)
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
IF(NOT APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)
# For MinGW library
IF(MINGW)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(MINGW)
IF(WIN32)
SET(SDL2_LIBRARY_TEMP winmm imm32 version msimg32 ${SDL2_LIBRARY_TEMP})
ENDIF(WIN32)
# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
SET(SDL2_FOUND "YES")
ENDIF(SDL2_LIBRARY_TEMP)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
IF(SDL2_STATIC)
if (UNIX AND NOT APPLE)
EXECUTE_PROCESS(COMMAND sdl2-config --static-libs OUTPUT_VARIABLE SDL2_LINK_FLAGS)
STRING(REGEX REPLACE "(\r?\n)+$" "" SDL2_LINK_FLAGS "${SDL2_LINK_FLAGS}")
SET(SDL2_LIBRARY ${SDL2_LINK_FLAGS})
ENDIF()
ENDIF(SDL2_STATIC)

View file

@ -0,0 +1,429 @@
# - Locates the SDL_sound library
#
# This module depends on SDL being found and
# must be called AFTER FindSDL.cmake or FindSDL2.cmake is called.
#
# This module defines
# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
# SDL_SOUND_FOUND, if false, do not try to link to SDL_sound
# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
# to link against. This is a read-only variable and is marked INTERNAL.
# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
# This is available mostly for cases this module failed to anticipate for
# and you must add additional flags. This is marked as ADVANCED.
# SDL_SOUND_VERSION_STRING, human-readable string containing the version of SDL_sound
#
# This module also defines (but you shouldn't need to use directly)
# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.
# And might define the following as needed
# MIKMOD_LIBRARY
# MODPLUG_LIBRARY
# OGG_LIBRARY
# VORBIS_LIBRARY
# SMPEG_LIBRARY
# FLAC_LIBRARY
# SPEEX_LIBRARY
#
# Typically, you should not use these variables directly, and you should use
# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries
# (if needed) to successfully compile on your system.
#
# Created by Eric Wing.
# This module is a bit more complicated than the other FindSDL* family modules.
# The reason is that SDL_sound can be compiled in a large variety of different ways
# which are independent of platform. SDL_sound may dynamically link against other 3rd
# party libraries to get additional codec support, such as Ogg Vorbis, SMPEG, ModPlug,
# MikMod, FLAC, Speex, and potentially others.
# Under some circumstances which I don't fully understand,
# there seems to be a requirement
# that dependent libraries of libraries you use must also be explicitly
# linked against in order to successfully compile. SDL_sound does not currently
# have any system in place to know how it was compiled.
# So this CMake module does the hard work in trying to discover which 3rd party
# libraries are required for building (if any).
# This module uses a brute force approach to create a test program that uses SDL_sound,
# and then tries to build it. If the build fails, it parses the error output for
# known symbol names to figure out which libraries are needed.
#
# Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that would
# correspond to the ./configure --prefix=$SDLDIR used in building SDL.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL_LIBRARY or SDL2_LIBRARY to override this selection or set the CMake
# environment CMAKE_INCLUDE_PATH to modify the search paths.
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
set(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags")
mark_as_advanced(SDL_SOUND_EXTRAS)
# Find SDL_sound.h
find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11
)
find_library(SDL_SOUND_LIBRARY
NAMES SDL_sound
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
)
if(SDL2_FOUND OR SDL_FOUND)
if(SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# CMake is giving me problems using TRY_COMPILE with the CMAKE_FLAGS
# for the :STRING syntax if I have multiple values contained in a
# single variable. This is a problem for the SDL2_LIBRARY variable
# because it does just that. When I feed this variable to the command,
# only the first value gets the appropriate modifier (e.g. -I) and
# the rest get dropped.
# To get multiple single variables to work, I must separate them with a "\;"
# I could go back and modify the FindSDL2.cmake module, but that's kind of painful.
# The solution would be to try something like:
# set(SDL2_TRY_COMPILE_LIBRARY_LIST "${SDL2_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}")
# Instead, it was suggested on the mailing list to write a temporary CMakeLists.txt
# with a temporary test project and invoke that with TRY_COMPILE.
# See message thread "Figuring out dependencies for a library in order to build"
# 2005-07-16
# try_compile(
# MY_RESULT
# ${CMAKE_BINARY_DIR}
# ${PROJECT_SOURCE_DIR}/DetermineSoundLibs.c
# CMAKE_FLAGS
# -DINCLUDE_DIRECTORIES:STRING=${SDL2_INCLUDE_DIR}\;${SDL_SOUND_INCLUDE_DIR}
# -DLINK_LIBRARIES:STRING=${SDL_SOUND_LIBRARY}\;${SDL2_LIBRARY}
# OUTPUT_VARIABLE MY_OUTPUT
# )
# To minimize external dependencies, create a sdlsound test program
# which will be used to figure out if additional link dependencies are
# required for the link phase.
file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/DetermineSoundLibs.c
"#include \"SDL_sound.h\"
#include \"SDL.h\"
int main(int argc, char* argv[])
{
Sound_AudioInfo desired;
Sound_Sample* sample;
SDL_Init(0);
Sound_Init();
/* This doesn't actually have to work, but Init() is a no-op
* for some of the decoders, so this should force more symbols
* to be pulled in.
*/
sample = Sound_NewSampleFromFile(argv[1], &desired, 4096);
Sound_Quit();
SDL_Quit();
return 0;
}"
)
# Calling
# target_link_libraries(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL2_LIBRARY})
# causes problems when SDL2_LIBRARY looks like
# /Library/Frameworks/SDL2.framework;-framework Cocoa
# The ;-framework Cocoa seems to be confusing CMake once the OS X
# framework support was added. I was told that breaking up the list
# would fix the problem.
set(TMP_LIBS "")
if(SDL2_FOUND)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY} ${SDL2_LIBRARY})
foreach(lib ${SDL_SOUND_LIBRARY} ${SDL2_LIBRARY})
set(TMP_LIBS "${TMP_LIBS} \"${lib}\"")
endforeach()
set(TMP_INCLUDE_DIRS ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
else()
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY})
foreach(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY})
set(TMP_LIBS "${TMP_LIBS} \"${lib}\"")
endforeach()
set(TMP_INCLUDE_DIRS ${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
endif()
# Keep trying to build a temp project until we find all missing libs.
set(TRY_AGAIN TRUE)
WHILE(TRY_AGAIN)
set(TRY_AGAIN FALSE)
# message("TMP_TRY_LIBS ${TMP_TRY_LIBS}")
# Write the CMakeLists.txt and test project
# Weird, this is still sketchy. If I don't quote the variables
# in the TARGET_LINK_LIBRARIES, I seem to loose everything
# in the SDL2_LIBRARY string after the "-framework".
# But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work.
file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt
"cmake_minimum_required(VERSION 2.8)
project(DetermineSoundLibs C)
include_directories(${TMP_INCLUDE_DIRS})
add_executable(DetermineSoundLibs DetermineSoundLibs.c)
target_link_libraries(DetermineSoundLibs ${TMP_LIBS})"
)
try_compile(
MY_RESULT
${PROJECT_BINARY_DIR}/CMakeTmp
${PROJECT_BINARY_DIR}/CMakeTmp
DetermineSoundLibs
OUTPUT_VARIABLE MY_OUTPUT
)
# message("${MY_RESULT}")
# message(${MY_OUTPUT})
if(NOT MY_RESULT)
# I expect that MPGLIB, VOC, WAV, AIFF, and SHN are compiled in statically.
# I think Timidity is also compiled in statically.
# I've never had to explcitly link against Quicktime, so I'll skip that for now.
# Find libmath
if("${MY_OUTPUT}" MATCHES "cos@@GLIBC")
find_library(MATH_LIBRARY NAMES m)
if(MATH_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MATH_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${MATH_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif(MATH_LIBRARY)
endif("${MY_OUTPUT}" MATCHES "cos@@GLIBC")
# Find MikMod
if("${MY_OUTPUT}" MATCHES "MikMod_")
find_library(MIKMOD_LIBRARY
NAMES libmikmod-coreaudio mikmod
PATHS
ENV MIKMODDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(MIKMOD_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${MIKMOD_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif(MIKMOD_LIBRARY)
endif("${MY_OUTPUT}" MATCHES "MikMod_")
# Find ModPlug
if("${MY_OUTPUT}" MATCHES "MODPLUG_")
find_library(MODPLUG_LIBRARY
NAMES modplug
PATHS
ENV MODPLUGDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(MODPLUG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${MODPLUG_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
endif()
# Find Ogg and Vorbis
if("${MY_OUTPUT}" MATCHES "ov_")
find_library(VORBISFILE_LIBRARY
NAMES vorbisfile VorbisFile VORBISFILE
PATHS
ENV VORBISDIR
ENV OGGDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(VORBISFILE_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBISFILE_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${VORBISFILE_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
find_library(VORBIS_LIBRARY
NAMES vorbis Vorbis VORBIS
PATHS
ENV OGGDIR
ENV VORBISDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(VORBIS_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${VORBIS_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
find_library(OGG_LIBRARY
NAMES ogg Ogg OGG
PATHS
ENV OGGDIR
ENV VORBISDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(OGG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${OGG_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
endif()
# Find SMPEG
if("${MY_OUTPUT}" MATCHES "SMPEG_")
find_library(SMPEG_LIBRARY
NAMES smpeg SMPEG Smpeg SMpeg
PATHS
ENV SMPEGDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(SMPEG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${SMPEG_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
endif()
# Find FLAC
if("${MY_OUTPUT}" MATCHES "FLAC_")
find_library(FLAC_LIBRARY
NAMES flac FLAC
PATHS
ENV FLACDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(FLAC_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${FLAC_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
endif()
# Hmmm...Speex seems to depend on Ogg. This might be a problem if
# the TRY_COMPILE attempt gets blocked at SPEEX before it can pull
# in the Ogg symbols. I'm not sure if I should duplicate the ogg stuff
# above for here or if two ogg entries will screw up things.
if("${MY_OUTPUT}" MATCHES "speex_")
find_library(SPEEX_LIBRARY
NAMES speex SPEEX
PATHS
ENV SPEEXDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(SPEEX_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${SPEEX_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
# Find OGG (needed for Speex)
# We might have already found Ogg for Vorbis, so skip it if so.
if(NOT OGG_LIBRARY)
find_library(OGG_LIBRARY
NAMES ogg Ogg OGG
PATHS
ENV OGGDIR
ENV VORBISDIR
ENV SPEEXDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(OGG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
set(TMP_LIBS "${SDL_SOUND_LIBRARIES_TMP} \"${OGG_LIBRARY}\"")
set(TRY_AGAIN TRUE)
endif()
endif()
endif()
endif()
ENDWHILE()
unset(TMP_INCLUDE_DIRS)
unset(TMP_LIBS)
set(SDL_SOUND_LIBRARIES ${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP} CACHE INTERNAL "SDL_sound and dependent libraries")
endif()
endif()
if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SOUND_VER_MAJOR[ \t]+[0-9]+$")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MINOR_LINE REGEX "^#define[ \t]+SOUND_VER_MINOR[ \t]+[0-9]+$")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_PATCH_LINE REGEX "^#define[ \t]+SOUND_VER_PATCH[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MAJOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MAJOR "${SDL_SOUND_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MINOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MINOR "${SDL_SOUND_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_PATCH[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_PATCH "${SDL_SOUND_VERSION_PATCH_LINE}")
set(SDL_SOUND_VERSION_STRING ${SDL_SOUND_VERSION_MAJOR}.${SDL_SOUND_VERSION_MINOR}.${SDL_SOUND_VERSION_PATCH})
unset(SDL_SOUND_VERSION_MAJOR_LINE)
unset(SDL_SOUND_VERSION_MINOR_LINE)
unset(SDL_SOUND_VERSION_PATCH_LINE)
unset(SDL_SOUND_VERSION_MAJOR)
unset(SDL_SOUND_VERSION_MINOR)
unset(SDL_SOUND_VERSION_PATCH)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound
REQUIRED_VARS SDL_SOUND_LIBRARIES SDL_SOUND_INCLUDE_DIR
VERSION_VAR SDL_SOUND_VERSION_STRING)

View file

@ -0,0 +1,32 @@
# - Find SoundIO (sndio) includes and libraries
#
# SOUNDIO_FOUND - True if SOUNDIO_INCLUDE_DIR & SOUNDIO_LIBRARY are
# found
# SOUNDIO_LIBRARIES - Set when SOUNDIO_LIBRARY is found
# SOUNDIO_INCLUDE_DIRS - Set when SOUNDIO_INCLUDE_DIR is found
#
# SOUNDIO_INCLUDE_DIR - where to find sndio.h, etc.
# SOUNDIO_LIBRARY - the sndio library
#
find_path(SOUNDIO_INCLUDE_DIR
NAMES sndio.h
DOC "The SoundIO include directory"
)
find_library(SOUNDIO_LIBRARY
NAMES sndio
DOC "The SoundIO library"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SoundIO
REQUIRED_VARS SOUNDIO_LIBRARY SOUNDIO_INCLUDE_DIR
)
if(SOUNDIO_FOUND)
set(SOUNDIO_LIBRARIES ${SOUNDIO_LIBRARY})
set(SOUNDIO_INCLUDE_DIRS ${SOUNDIO_INCLUDE_DIR})
endif()
mark_as_advanced(SOUNDIO_INCLUDE_DIR SOUNDIO_LIBRARY)