Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-19 12:20:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-19 12:20:02 +0400
commit167bcc2b6709177c0f93af8bf06db1c1a944eede (patch)
treeb4d0060cf537ca182ba5db24c87497be68f07d13
parentb15a2b0ffc3a8c91020f59613ed89078101eb435 (diff)
cmake: add libsamplerate find module
-rw-r--r--CMakeLists.txt8
-rw-r--r--build_files/cmake/Modules/FindSamplerate.cmake67
2 files changed, 71 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c22266c06c6..8ed9b03c161 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -376,10 +376,10 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_SAMPLERATE)
- set(SAMPLERATE /usr)
- set(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE}/include)
- set(SAMPLERATE_LIBRARIES samplerate)
- set(SAMPLERATE_LIBPATH ${SAMPLERATE}/lib)
+ find_package(Samplerate)
+ if(NOT SAMPLERATE_FOUND)
+ set(WITH_SAMPLERATE OFF)
+ endif()
endif()
if(WITH_OPENCOLLADA)
diff --git a/build_files/cmake/Modules/FindSamplerate.cmake b/build_files/cmake/Modules/FindSamplerate.cmake
new file mode 100644
index 00000000000..1312693346d
--- /dev/null
+++ b/build_files/cmake/Modules/FindSamplerate.cmake
@@ -0,0 +1,67 @@
+# - Find Samplerate library
+# Find the native Samplerate includes and library
+# This module defines
+# SAMPLERATE_INCLUDE_DIRS, where to find samplerate.h, Set when
+# SAMPLERATE_INCLUDE_DIR is found.
+# SAMPLERATE_LIBRARIES, libraries to link against to use Samplerate.
+# SAMPLERATE_ROOT_DIR, The base directory to search for Samplerate.
+# This can also be an environment variable.
+# SAMPLERATE_FOUND, If false, do not try to use Samplerate.
+#
+# also defined, but not for general use are
+# SAMPLERATE_LIBRARY, where to find the Samplerate library.
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# If SAMPLERATE_ROOT_DIR was defined in the environment, use it.
+IF(NOT SAMPLERATE_ROOT_DIR AND NOT $ENV{SAMPLERATE_ROOT_DIR} STREQUAL "")
+ SET(SAMPLERATE_ROOT_DIR $ENV{SAMPLERATE_ROOT_DIR})
+ENDIF()
+
+SET(_samplerate_SEARCH_DIRS
+ ${SAMPLERATE_ROOT_DIR}
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+)
+
+FIND_PATH(SAMPLERATE_INCLUDE_DIR samplerate.h
+ HINTS
+ ${_samplerate_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include
+)
+
+FIND_LIBRARY(SAMPLERATE_LIBRARY
+ NAMES "samplerate"
+ HINTS ${_samplerate_SEARCH_DIRS}
+ PATH_SUFFIXES lib64 lib
+ )
+
+# handle the QUIETLY and REQUIRED arguments and set SAMPLERATE_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Samplerate DEFAULT_MSG
+ SAMPLERATE_LIBRARY SAMPLERATE_INCLUDE_DIR)
+
+IF(SAMPLERATE_FOUND)
+ SET(SAMPLERATE_LIBRARIES ${SAMPLERATE_LIBRARY})
+ SET(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE_INCLUDE_DIR})
+ENDIF(SAMPLERATE_FOUND)
+
+MARK_AS_ADVANCED(
+ SAMPLERATE_INCLUDE_DIR
+ SAMPLERATE_LIBRARY
+)