mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-03 07:10:10 +01:00
Upgrade to libsoxr 0.0.2.
This commit is contained in:
@@ -1,24 +1,32 @@
|
||||
# SoX Resampler Library Copyright (c) 2007-12 robs@users.sourceforge.net
|
||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||
|
||||
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||
message(FATAL_ERROR "Usage: cmake <path-to-source> (from another directory)")
|
||||
endif ()
|
||||
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8 FATAL_ERROR)
|
||||
|
||||
project (soxr C)
|
||||
enable_testing ()
|
||||
|
||||
set (VERSION_MAJOR 0)
|
||||
set (VERSION_MINOR 0)
|
||||
set (VERSION_PATCH 1)
|
||||
|
||||
set (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
set (DESCRIPTION_SUMMARY "One-dimensional sample-rate conversion library")
|
||||
|
||||
|
||||
|
||||
# Options:
|
||||
# Release versioning:
|
||||
|
||||
set (PROJECT_VERSION_MAJOR 0)
|
||||
set (PROJECT_VERSION_MINOR 0)
|
||||
set (PROJECT_VERSION_PATCH 2)
|
||||
|
||||
# For shared-object; if, since the last public release:
|
||||
# * library code changed at all: ++revision
|
||||
# * interfaces changed at all: ++current, revision = 0
|
||||
# * interfaces added: ++age
|
||||
# * interfaces removed: age = 0
|
||||
|
||||
set (SO_VERSION_CURRENT 0)
|
||||
set (SO_VERSION_REVISION 0)
|
||||
set (SO_VERSION_AGE 0)
|
||||
|
||||
|
||||
|
||||
# Main options:
|
||||
|
||||
include (CMakeDependentOption)
|
||||
|
||||
@@ -26,9 +34,11 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif ()
|
||||
|
||||
option (BUILD_TESTS "Build sanity-tests." OFF)
|
||||
option (BUILD_SHARED_LIBS "Build shared libraries." ON)
|
||||
option (BUILD_EXAMPLES "Build examples." OFF)
|
||||
option (WITH_OPENMP "Include OpenMP threading." ON)
|
||||
option (WITH_LSR_IF "Include a `libsamplerate'-like interface." ON)
|
||||
option (WITH_LSR_BINDINGS "Include a `libsamplerate'-like interface." ON)
|
||||
cmake_dependent_option (WITH_SINGLE_PRECISION "Build with single precision (for up to 20-bit accuracy)." ON
|
||||
"WITH_DOUBLE_PRECISION" ON)
|
||||
cmake_dependent_option (WITH_DOUBLE_PRECISION "Build with double precision (for up to 32-bit accuracy)." ON
|
||||
@@ -40,24 +50,24 @@ cmake_dependent_option (WITH_AVFFT "Use libavcodec (LGPL) for SIMD DFT." OFF
|
||||
cmake_dependent_option (WITH_PFFFT "Use PFFFT (BSD-like licence) for SIMD DFT." ON
|
||||
"WITH_SIMD;NOT WITH_AVFFT" OFF)
|
||||
if (UNIX)
|
||||
cmake_dependent_option (WITH_LSR_TESTS "Build LSR tests." OFF
|
||||
"WITH_LSR_IF" OFF)
|
||||
cmake_dependent_option (BUILD_LSR_TESTS "Build LSR tests." OFF
|
||||
"WITH_LSR_BINDINGS" OFF)
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
# Introspection:
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||
|
||||
include (CheckFunctionExists)
|
||||
include (CheckIncludeFiles)
|
||||
include (CheckLibraryExists)
|
||||
include (TestBigEndian)
|
||||
|
||||
check_library_exists(m pow "" NEED_LIBM)
|
||||
check_library_exists (m pow "" NEED_LIBM)
|
||||
if (NEED_LIBM)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "m;${CMAKE_REQUIRED_LIBRARIES}")
|
||||
set (CMAKE_REQUIRED_LIBRARIES "m;${CMAKE_REQUIRED_LIBRARIES}")
|
||||
link_libraries (m)
|
||||
endif ()
|
||||
|
||||
@@ -74,7 +84,7 @@ if (WITH_SIMD)
|
||||
if (SIMD_FOUND)
|
||||
set (HAVE_SIMD 1)
|
||||
endif ()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (WITH_SINGLE_PRECISION)
|
||||
set (HAVE_SINGLE_PRECISION 1)
|
||||
@@ -93,6 +103,10 @@ if (WITH_AVFFT)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
check_function_exists (lrint HAVE_LRINT)
|
||||
check_include_files (fenv.h HAVE_FENV_H)
|
||||
test_big_endian (WORDS_BIGENDIAN)
|
||||
|
||||
macro (make_exist)
|
||||
foreach (x ${ARGN})
|
||||
if (NOT ${x})
|
||||
@@ -101,31 +115,33 @@ macro (make_exist)
|
||||
endforeach ()
|
||||
endmacro ()
|
||||
|
||||
check_function_exists (lrint HAVE_LRINT)
|
||||
check_include_files(fenv.h HAVE_FENV_H)
|
||||
test_big_endian(WORDS_BIGENDIAN)
|
||||
make_exist (HAVE_LRINT HAVE_FENV_H WORDS_BIGENDIAN HAVE_SIMD)
|
||||
make_exist (HAVE_SINGLE_PRECISION HAVE_DOUBLE_PRECISION HAVE_AVFFT)
|
||||
|
||||
configure_file (
|
||||
${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-config.h.in
|
||||
${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.h)
|
||||
include_directories (${PROJECT_BINARY_DIR})
|
||||
|
||||
|
||||
|
||||
# Compiler configuration:
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
set (PROJECT_DEFS "-Wconversion -Wall -W -Wmissing-prototypes
|
||||
-Wstrict-prototypes -pedantic -Wundef -Wno-long-long")
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (PROJECT_CXX_FLAGS "-Wconversion -Wall -W -pedantic -Wundef -Wcast-align -Wpointer-arith -Wno-long-long")
|
||||
set (PROJECT_C_FLAGS "${PROJECT_CXX_FLAGS} -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-s") # strip
|
||||
endif ()
|
||||
#option (VISIBILITY_HIDDEN "Build with -fvisibility=hidden." ON)
|
||||
if (VISIBILITY_HIDDEN)
|
||||
add_definitions (-fvisibility=hidden)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions (-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS)
|
||||
option (ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically." OFF)
|
||||
if (ENABLE_STATIC_RUNTIME)
|
||||
foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
# By default, do not warn when built on machines using only VS Express:
|
||||
if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
|
||||
set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||
@@ -137,15 +153,13 @@ endif ()
|
||||
# Build configuration:
|
||||
|
||||
if (${BUILD_SHARED_LIBS} AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) # Allow exes to find dlls:
|
||||
set (bin ${PROJECT_BINARY_DIR}/bin/)
|
||||
set (obin ${bin})
|
||||
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${bin}
|
||||
CACHE PATH "Single directory for all shared libraries")
|
||||
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${bin}
|
||||
CACHE PATH "Single directory for all executables.")
|
||||
set (BIN ${PROJECT_BINARY_DIR}/bin/)
|
||||
set (EXAMPLES_BIN ${BIN})
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BIN})
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN})
|
||||
else ()
|
||||
set (bin ./)
|
||||
set (obin ../examples/)
|
||||
set (BIN ./)
|
||||
set (EXAMPLES_BIN ../examples/)
|
||||
endif ()
|
||||
|
||||
set (LIB_TYPE STATIC)
|
||||
@@ -158,28 +172,81 @@ endif ()
|
||||
|
||||
|
||||
|
||||
# Installation configuration:
|
||||
|
||||
set (LIB_SUFFIX "" CACHE STRING "Define suffix of libraries directory name (32 or 64).")
|
||||
set (BIN_INSTALL_DIR "bin" CACHE PATH "The subdirectory to the binaries." FORCE)
|
||||
set (LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory to the libraries." FORCE)
|
||||
set (INCLUDE_INSTALL_DIR "include" CACHE PATH "The subdirectory to the headers." FORCE)
|
||||
|
||||
if (APPLE)
|
||||
option (BUILD_FRAMEWORK "Build an OS X framework." OFF)
|
||||
set (FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.")
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
# Top-level:
|
||||
|
||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
math (EXPR SO_VERSION_MAJOR "${SO_VERSION_CURRENT} - ${SO_VERSION_AGE}")
|
||||
math (EXPR SO_VERSION_MINOR "${SO_VERSION_AGE}")
|
||||
math (EXPR SO_VERSION_PATCH "${SO_VERSION_REVISION}")
|
||||
set (SO_VERSION ${SO_VERSION_MAJOR}.${SO_VERSION_MINOR}.${SO_VERSION_PATCH})
|
||||
|
||||
configure_file (
|
||||
${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-config.h.in
|
||||
${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.h)
|
||||
include_directories (${PROJECT_BINARY_DIR})
|
||||
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
file (COPY doc/logo.png DESTINATION doc)
|
||||
add_custom_target (docs doxygen)
|
||||
|
||||
if (BUILD_TESTS OR BUILD_LSR_TESTS)
|
||||
enable_testing ()
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
# Subdirectories:
|
||||
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
add_subdirectory (src)
|
||||
add_subdirectory (examples)
|
||||
add_subdirectory (tests)
|
||||
if (WITH_LSR_TESTS)
|
||||
if (BUILD_TESTS)
|
||||
add_subdirectory (tests)
|
||||
endif ()
|
||||
if (BUILD_LSR_TESTS)
|
||||
add_subdirectory (lsr-tests)
|
||||
endif ()
|
||||
if (BUILD_EXAMPLES OR BUILD_TESTS)
|
||||
add_subdirectory (examples)
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
# Deinstallation:
|
||||
|
||||
configure_file (
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/deinstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target (deinstall
|
||||
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/deinstall.cmake")
|
||||
|
||||
|
||||
|
||||
# Packaging:
|
||||
|
||||
if (UNIX)
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
|
||||
set (CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
|
||||
set (CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||
set (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||
set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||
|
||||
set (CPACK_SOURCE_GENERATOR "TBZ2")
|
||||
set (CPACK_SOURCE_IGNORE_FILES "/Debug/;/Release/;/cpack/;/dev/;\\\\.swp$")
|
||||
set (CPACK_SOURCE_IGNORE_FILES "/Debug/;/Release/;/cpack/;\\\\.swp$;\\\\.gitignore")
|
||||
|
||||
include (CPack)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user