diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..0e7f8318 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,20 @@ +version: 1.2-{build} +image: Visual Studio 2017 +configuration: Debug +platform: + - Win32 + - x64 +install: + - if %platform%==Win32 set VCPKG_TRIPLET=x86-windows + - if %platform%==x64 set VCPKG_TRIPLET=x64-windows + - vcpkg install libogg:%VCPKG_TRIPLET% fftw3:%VCPKG_TRIPLET% +before_build: + - mkdir CMakeBuild + - cd CMakeBuild + - if %platform%==Win32 set CMAKE_GENERATOR=Visual Studio 15 2017 + - if %platform%==x64 set CMAKE_GENERATOR=Visual Studio 15 2017 Win64 + - cmake .. -G"%CMAKE_GENERATOR%" -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake +build_script: + - cmake --build . --config %configuration% +cache: + C:\Tools\vcpkg\Installed -> appveyor.yml diff --git a/.gitignore b/.gitignore index 7c309990..99a35e59 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,13 @@ src/speexdec src/speexenc stamp-* patches + +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake diff --git a/.travis.yml b/.travis.yml index ff85bc35..2bc028b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,25 @@ language: c +sudo: false +dist: trusty +addons: + apt: + packages: + - libogg-dev + - libspeexdsp-dev + - libfftw3-dev env: - - CONFIG="" - - CONFIG="--enable-fixed-point" - - CONFIG="--enable-fixed-point --disable-float-api" - - CONFIG="--enable-vorbis-psy" - - CONFIG="--disable-binaries" + matrix: + - CMAKE=1 CONFIG="" + - CMAKE=1 CONFIG="-DENABLE_FIXED_POINT:BOOL=TRUE -DENABLE_FLOATING_POINT:BOOL=FALSE" + - CMAKE=1 CONFIG="-DENABLE_FIXED_POINT:BOOL=TRUE -DENABLE_FLOATING_POINT:BOOL=FALSE -DDISABLE_FLOAT_API:BOOL=TRUE" + - CMAKE=1 CONFIG="-DENABLE_VORBIS_PSY:BOOL=TRUE" + - CMAKE=1 CONFIG="-DDISABLE_BINARIES:BOOL=TRUE" + - AUTOTOOLS=1 CONFIG="" + - AUTOTOOLS=1 CONFIG="--enable-fixed-point" + - AUTOTOOLS=1 CONFIG="--enable-fixed-point --disable-float-api" + - AUTOTOOLS=1 CONFIG="--enable-vorbis-psy" + - AUTOTOOLS=1 CONFIG="--disable-binaries" os: - linux @@ -15,7 +29,11 @@ compiler: - gcc - clang +before_install: + - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + brew install libogg speexdsp fftw; + fi + script: - - ./autogen.sh - - ./configure $CONFIG - - make distcheck + - if [ "$CMAKE" == "1" ]; then mkdir cmake-build; cd cmake-build; cmake .. $CONFIG -DBUILD_SHARED_LIBS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=$HOME/cmake-check; make install; fi + - if [ "$AUTOTOOLS" == "1" ]; then ./autogen.sh; ./configure $CONFIG; make distcheck; fi diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..22a95614 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,435 @@ +cmake_minimum_required(VERSION 3.1) + +project(speex VERSION 1.2.0 LANGUAGES C) + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") + +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CheckLibraryExists) +include(CMakeDependentOption) +include(FeatureSummary) +include(TestVarArrays) +include(CheckCCompilerFlag) +include(GNUInstallDirs) +include(TestBigEndian) + +test_big_endian(WORDS_BIGENDIAN) + +check_include_file(inttypes.h HAVE_INTTYPES_H) +if(HAVE_INTTYPES_H) + set(INCLUDE_STDINT "#include ") +else() + check_include_file(stdint.h HAVE_STDINT_H) + if(HAVE_STDINT_H) + set(INCLUDE_STDINT "#include ") + else() + check_include_file(sys/types.h INCLUDE_SYS_TYPES_H) + if(HAVE_SYS_TYPES_H) + set(INCLUDE_STDINT "#include ") + endif() + endif() +endif() +set(SIZE16 int16_t) +set(USIZE16 uint16_t) +set(SIZE32 int32_t) +set(USIZE32 uint32_t) +set(SIZE64 int64_t) +configure_file(include/speex/speex_config_types.h.in include/speex/speex_config_types.h @ONLY) + +test_vararrays(VAR_ARRAYS) +if(NOT VAR_ARRAYS) + check_include_file(alloca.h HAVE_ALLOCA_H) + if(WIN32) + set(USE_ALLOCA 1) + else() + check_symbol_exists(alloca "stdlib.h;alloca.h" USE_ALLOCA) + endif() +endif() + +option(ENABLE_FLOATING_POINT "Compile as floating-point" ON) +option(ENABLE_FIXED_POINT "Compile as fixed-point" OFF) + + +if(ENABLE_FLOATING_POINT AND ENABLE_FIXED_POINT) + message(FATAL_ERROR "Select one of ENABLE_FLOATING_POINT of ENABLE_FIXED_POINT.") +endif() +if((NOT ENABLE_FLOATING_POINT) AND (NOT ENABLE_FIXED_POINT)) + message(FATAL_ERROR "Select one of ENABLE_FLOATING_POINT of ENABLE_FIXED_POINT.") +endif() + +find_package(FFTW3) + +cmake_dependent_option(USE_GPL_FFTW3 "Use FFTW3 for FFT" OFF "FFTW3_FOUND; ENABLE_FLOATING_POINT" OFF) + +if(ENABLE_FLOATING_POINT) + set(FLOATING_POINT 1) + set(FIXED_POINT 0) + set(USE_KISS_FFT 0) + if(NOT USE_GPL_FFTW3) + set(USE_SMALLFT 1) + endif() +else() + set(FLOATING_POINT 0) + set(FIXED_POINT 1) + set(USE_KISS_FFT 1) + set(USE_SMALLFT 0) + set(USE_GPL_FFTW3 0) +endif() + +cmake_dependent_option(ENABLE_FIXED_POINT_DEBUG "Debug fixed-point implementation" OFF "ENABLE_FIXED_POINT" OFF) +set(FIXED_POINT_DEBUG ${ENABLE_FIXED_POINT_DEBUG}) + +option(DISABLE_FLOAT_API "Disable all parts of the API that are using floats" OFF) +option(DISABLE_VBR "Disable VBR and VAD from the codec" OFF) +cmake_dependent_option(ENABLE_VORBIS_PSY "Enable the Vorbis psy model" OFF "NOT ENABLE_FIXED_POINT;VAR_ARRAYS" OFF) +set(VORBIS_PSYCHO ${ENABLE_VORBIS_PSY}) + +if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)") + set(CPU_IS_X86 TRUE) +else() + set(CPU_IS_X86 FALSE) +endif() +if(CPU_IS_X86) + check_include_file(xmmintrin.h HAVE_XMMINTRIN_H) +endif() +cmake_dependent_option(ENABLE_SSE "Enable SSE support" ON "CPU_IS_X86;HAVE_XMMINTRIN_H;ENABLE_FLOATING_POINT" OFF) +if(ENABLE_SSE) + set(_USE_SSE 1) + check_c_compiler_flag("/arch:SSE" ARCH_SSE_FLAG) + if(ARCH_SSE_FLAG) + set(SSE_FLAGS "/arch:SSE") + else() + check_c_compiler_flag("-msse" MSSE_FLAG) + if(MSSE_FLAG) + set(SSE_FLAGS "-msse") + endif() + endif() +endif() + +if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + set(CPU_IS_ARM 1) +endif () +cmake_dependent_option(ENABLE_ARM4_ASM "Make use of ARM4 assembly optimizations" OFF "CPU_IS_ARM;ENABLE_FIXED_POINT" OFF) +set(ARM4_ASM ${ENABLE_ARM4_ASM}) +cmake_dependent_option(ENABLE_ARM5E_ASM "Make use of ARM5E assembly optimizations" OFF "CPU_IS_ARM;ENABLE_FIXED_POINT" OFF) +set(ARM5E_ASM ${ENABLE_ARM5E_ASM}) +cmake_dependent_option(ENABLE_BLACKFIN_ASM "Make use of Blackfin assembly optimizations" OFF "NOT CPU_IS_X86;ENABLE_FIXED_POINT" OFF) +set(BFIN_ASM ${ENABLE_BLACKFIN_ASM}) +cmake_dependent_option(ENABLE_TI_C55X "Enable support for TI C55X DSP" OFF "NOT CPU_IS_X86" OFF) +set(TI_C55X ${ENABLE_TI_C55X}) + +if(NOT WIN32) + check_library_exists(m cos "" HAVE_LIBM) + if(HAVE_LIBM) + find_library(LIBM m) + endif() +endif() + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) +endif(MSVC) + +find_package(Ogg) +find_package(SpeexDsp) + +cmake_dependent_option(USE_SPEEXDSP "Enable SpeexDSP library" ON "SpeexDsp_FOUND" OFF) +cmake_dependent_option(BUILD_PROGRAMS "Build the encoder and decoder programs, not only the library" ON "Ogg_FOUND" ON) + +check_c_compiler_flag("-fvisibility=hidden" HAS_VISIBILITY) +if(HAS_VISIBILITY) + SET(EXPORT "__attribute__((visibility(\"default\")))") +endif() + +check_include_file(getopt.h HAVE_GETOPT_H) +if(HAVE_GETOPT_H) + check_symbol_exists(getopt_long getopt.h HAVE_GETOPT_LONG) +endif() + +option (ENABLE_PACKAGE_CONFIG "Generate and install package config file" ON) + +set_package_properties(Ogg PROPERTIES TYPE RECOMMENDED + URL "www.xiph.org/ogg/" + DESCRIPTION "library for manipulating ogg bitstreams" + PURPOSE "Required to build speexenc and speexdec tools") +set_package_properties(SpeexDsp PROPERTIES TYPE RECOMMENDED + URL "https://speex.org/" + DESCRIPTION "speech processing library that goes along with the Speex codec" + PURPOSE "Enables speexenc tool preprocessing options") +set_package_properties(FFTW3 PROPERTIES TYPE OPTIONAL + URL "http://www.fftw.org/" + DESCRIPTION "fast Fourier transform library" + PURPOSE "Enables use of FFTW3 for fast Fourier transforms") +add_feature_info(ENABLE_ALLOCA USE_ALLOCA "Make use of alloca function.") +add_feature_info(ENABLE_VAR_ARRAYS VAR_ARRAYS "Make use of variable-length arrays.") +add_feature_info(ENABLE_FLOATING_POINT ENABLE_FLOATING_POINT "compile as floating-point.") +add_feature_info(ENABLE_FIXED_POINT ENABLE_FIXED_POINT "compile as fixed-point.") +add_feature_info(ENABLE_FIXED_POINT_DEBUG ENABLE_FIXED_POINT_DEBUG "debug fixed-point implementation.") +add_feature_info(ENABLE_SSE ENABLE_SSE "enable SSE support.") +add_feature_info(ENABLE_ARM4_ASM ENABLE_ARM4_ASM "make use of ARM4 assembly optimizations.") +add_feature_info(ENABLE_ARM5E_ASM ENABLE_ARM5E_ASM "make use of ARM5E assembly optimizations.") +add_feature_info(ENABLE_BLACKFIN_ASM ENABLE_BLACKFIN_ASM "make use of Blackfin assembly optimizations.") +add_feature_info(ENABLE_TI_C55X ENABLE_TI_C55X "enable support for TI C55X DSP.") +add_feature_info(DISABLE_FLOAT_API DISABLE_FLOAT_API "disable all parts of the API that are using floats.") +add_feature_info(DISABLE_VBR DISABLE_VBR "disable VBR and VAD from the codec.") +add_feature_info(ENABLE_VORBIS_PSY ENABLE_VORBIS_PSY "enable the Vorbis psy model.") +add_feature_info(ENABLE_SPEEXDSP USE_SPEEXDSP "enable speexenc preprocessing options.") +add_feature_info(BUILD_BINARIES BUILD_BINARIES "build the encoder and decoder programs, not only the library.") +add_feature_info(ENABLE_PACKAGE_CONFIG ENABLE_PACKAGE_CONFIG "generate and install package config file") +add_feature_info(USE_GPL_FFTW3 USE_GPL_FFTW3 "Use FFTW3 library for fast Fourier transforms") +feature_summary(WHAT ALL) + +configure_file(config.h.cmake config.h) + +set(speex_PUBLIC_HEADERS + include/speex/speex.h + include/speex/speex_bits.h + include/speex/speex_callbacks.h + include/speex/speex_header.h + include/speex/speex_stereo.h + include/speex/speex_types.h + ${CMAKE_CURRENT_BINARY_DIR}/include/speex/speex_config_types.h) + +set(speex_SOURCES + libspeex/cb_search.c + libspeex/exc_10_32_table.c + libspeex/exc_8_128_table.c + libspeex/filters.c + libspeex/gain_table.c + libspeex/hexc_table.c + libspeex/high_lsp_tables.c + libspeex/lsp.c + libspeex/ltp.c + libspeex/speex.c + libspeex/stereo.c + libspeex/vbr.c + libspeex/vq.c + libspeex/bits.c + libspeex/exc_10_16_table.c + libspeex/exc_20_32_table.c + libspeex/exc_5_256_table.c + libspeex/exc_5_64_table.c + libspeex/gain_table_lbr.c + libspeex/hexc_10_32_table.c + libspeex/lpc.c + libspeex/lsp_tables_nb.c + libspeex/modes.c + libspeex/modes_wb.c + libspeex/nb_celp.c + libspeex/quant_lsp.c + libspeex/sb_celp.c + libspeex/speex_callbacks.c + libspeex/speex_header.c + libspeex/window.c + libspeex/arch.h + libspeex/bfin.h + libspeex/cb_search_arm4.h + libspeex/cb_search_bfin.h + libspeex/cb_search_sse.h + libspeex/filters.h + libspeex/filters_arm4.h + libspeex/filters_bfin.h + libspeex/filters_sse.h + libspeex/fixed_arm4.h + libspeex/fixed_arm5e.h + libspeex/fixed_bfin.h + libspeex/fixed_debug.h + libspeex/lpc.h + libspeex/lpc_bfin.h + libspeex/ltp.h + libspeex/ltp_arm4.h + libspeex/ltp_sse.h + libspeex/math_approx.h + libspeex/misc_bfin.h + libspeex/nb_celp.h + libspeex/quant_lsp.h + libspeex/sb_celp.h + libspeex/stack_alloc.h + libspeex/vbr.h + libspeex/vq.h + libspeex/vq_arm4.h + libspeex/vq_bfin.h + libspeex/vq_sse.h + libspeex/cb_search.h + libspeex/fftwrap.h + libspeex/fftwrap.c + libspeex/fixed_generic.h + libspeex/lsp.h + libspeex/lsp_bfin.h + libspeex/ltp_bfin.h + libspeex/modes.h + libspeex/os_support.h + libspeex/quant_lsp_bfin.h + libspeex/smallft.h) + +add_library(speex ${speex_PUBLIC_HEADERS} ${speex_SOURCES}) +target_compile_definitions(speex + PRIVATE -DHAVE_CONFIG_H) +target_include_directories(speex + PRIVATE $ + PUBLIC $ + PUBLIC $ + PUBLIC $) +if(USE_GPL_FFTW3) + target_include_directories(speex + PRIVATE $) + if(BUILD_SHARED_LIBS) + target_link_libraries(speex PRIVATE ${FFTW3_LIBRARIES}) + else() + target_link_libraries(speex PUBLIC ${FFTW3_LIBRARIES}) + endif() +endif() +if(HAVE_LIBM) + if(BUILD_SHARED_LIBS) + target_link_libraries(speex PRIVATE ${LIBM}) + else() + target_link_libraries(speex PUBLIC ${LIBM}) + endif() +endif() +target_compile_options(speex PRIVATE ${SSE_FLAGS}) +if(WIN32 AND BUILD_SHARED_LIBS) + target_sources(speex PRIVATE win32/libspeex.def) + set_target_properties (speex PROPERTIES OUTPUT_NAME "libspeex") +endif() +set_target_properties (speex PROPERTIES + PUBLIC_HEADER "${speex_PUBLIC_HEADERS}" + SOVERSION 1.5.1 + VERSION 1) +if(EXPORT AND BUILD_SHARED_LIBS) + set_target_properties (speex PROPERTIES + C_VISIBILITY_PRESET hidden) +endif() +if(USE_SMALLFT) + target_sources(speex PRIVATE + libspeex/smallft.c) +elseif(USE_KISS_FFT) + target_sources(speex PRIVATE + libspeex/kiss_fft.c + libspeex/_kiss_fft_guts.h + libspeex/kiss_fft.h + libspeex/kiss_fftr.c + libspeex/kiss_fftr.h) +endif() +if(VORBIS_PSYCHO) + target_sources(speex PRIVATE + libspeex/vorbis_psy.h + libspeex/vorbis_psy.c) +endif() + +# Programs + +if(BUILD_BINARIES) + +SET(speexenc_SOURCES + src/speexenc.c + src/wav_io.c + src/skeleton.c) +add_executable(speexenc ${speexenc_SOURCES}) +target_include_directories(speexenc + PRIVATE + $ + $) +target_link_libraries(speexenc + PUBLIC speex Ogg::ogg ${SPEEXDSP_LIBRARIES}) +if(WIN32) + target_link_libraries(speexenc PRIVATE winmm.lib) +endif() +target_compile_definitions(speexenc + PRIVATE -DHAVE_CONFIG_H) +if(NOT HAVE_GETOPT_LONG) + target_sources(speexenc PRIVATE + src/getopt.c + src/getopt1.c + src/wave_out.c) +endif() + +SET(speexdec_SOURCES + src/speexdec.c + src/wav_io.c) +add_executable(speexdec ${speexdec_SOURCES}) +target_include_directories(speexdec + PRIVATE + $ + $) +target_link_libraries(speexdec PUBLIC speex ${OGG_LIBRARIES}) +if(WIN32) + target_link_libraries(speexdec PRIVATE winmm.lib) +endif() +target_compile_definitions(speexdec + PRIVATE -DHAVE_CONFIG_H) +if(NOT HAVE_GETOPT_LONG) + target_sources(speexdec PRIVATE + src/getopt.c + src/getopt1.c + src/wave_out.c) +endif() + +# Tests (no automatic checking supported) + +add_executable(testenc libspeex/testenc.c) +target_include_directories(testenc + PRIVATE $) +target_link_libraries(testenc + PRIVATE ${LIBM} + PUBLIC speex) +target_compile_definitions(testenc + PRIVATE -DHAVE_CONFIG_H) +add_executable(testenc_wb libspeex/testenc_wb.c) +target_include_directories(testenc_wb + PRIVATE $) +target_link_libraries(testenc_wb + PRIVATE ${LIBM} + PUBLIC speex) +target_compile_definitions(testenc_wb + PRIVATE -DHAVE_CONFIG_H) +add_executable(testenc_uwb libspeex/testenc_uwb.c) +target_include_directories(testenc_uwb + PRIVATE $) +target_link_libraries(testenc_uwb + PRIVATE ${LIBM} + PUBLIC speex) +target_compile_definitions(testenc_uwb + PRIVATE -DHAVE_CONFIG_H) + +endif() + +# Installation + +install(TARGETS speex + EXPORT speex-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/speex) + +if(BUILD_BINARIES) + install(TARGETS speexdec speexenc RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() + +install(FILES doc/manual.pdf DESTINATION ${CMAKE_INSTALL_DOCDIR}) +install(FILES src/speexenc.1 src/speexdec.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +install(FILES speex.m4 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/aclocal) + +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix $\{prefix\}) +set(libdir $\{exec_prefix\}/${CMAKE_INSTALL_LIBDIR}) +set(includedir $\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}) +set(SPEEX_VERSION ${PROJECT_VERSION}) +if(HAVE_LIBM) + set(LIBM -lm) +endif() +configure_file(speex.pc.in speex.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/speex.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +set(PACKAGE ${PROJECT_NAME}) +set(VERSION ${PROJECT_VERSION}) +configure_file(Speex.spec.in Speex.spec @ONLY) + +if (ENABLE_PACKAGE_CONFIG) + include (CMakePackageConfigHelpers) + write_basic_package_version_file (speex-config-version.cmake COMPATIBILITY SameMajorVersion) + set(CMAKE_INSTALL_PACKAGEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) + install(EXPORT speex-targets NAMESPACE Speex:: DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/speex-config-version.cmake DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}) + install(FILES cmake/speex-config.cmake DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}) +endif() diff --git a/Makefile.am b/Makefile.am index dc904152..2b4bedee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,12 @@ m4data_DATA = speex.m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = speex.pc -EXTRA_DIST = Speex.spec Speex.spec.in Speex.kdevelop speex.m4 speex.pc.in README.blackfin README.symbian README.TI-DSP +EXTRA_DIST = Speex.spec Speex.spec.in Speex.kdevelop speex.m4 speex.pc.in \ + README.blackfin README.symbian README.TI-DSP CMakeLists.txt config.h.cmake \ + $(cmake_files) .appveyor.yml + +cmake_files = cmake/FindOgg.cmake cmake/FindSpeexDsp.cmake \ + cmake/FindSpeexDsp.cmake cmake/speex-config.cmake cmake/TestVarArrays.cmake #Fools KDevelop into including all files SUBDIRS = libspeex include doc win32 symbian ti diff --git a/cmake/FindFFTW3.cmake b/cmake/FindFFTW3.cmake new file mode 100644 index 00000000..ff1961c5 --- /dev/null +++ b/cmake/FindFFTW3.cmake @@ -0,0 +1,28 @@ +# - Find fftw3 +# Find the native fftw3 includes and libraries +# +# FFTW3_INCLUDE_DIRS - where to find fftw3.h, etc. +# FFTW3_LIBRARIES - List of libraries when using fftw3. +# FFTW3_FOUND - True if fftw3 found. + +if(FFTW3_INCLUDE_DIR) + # Already in cache, be silent + set(FFTW3_FIND_QUIETLY TRUE) +endif(FFTW3_INCLUDE_DIR) + +find_package (PkgConfig QUIET) +pkg_check_modules(PC_FFTW QUIET fftw3f) + +find_path(FFTW3_INCLUDE_DIR fftw3.h HINTS ${PC_FFTW3_INCLUDEDIR} ${PC_FFTW3_INCLUDE_DIRS} ${FFTW3_ROOT} PATH_SUFFIXES include) +find_library(FFTW3_LIBRARY NAMES fftw3f HINTS ${PC_FFTW3_LIBDIR} ${PC_FFTW3_LIBRARY_DIRS} ${FFTW3_ROOT} PATH_SUFFIXES lib) +# Handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND +# to TRUE if all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FFTW3 REQUIRED_VARS FFTW3_INCLUDE_DIR FFTW3_LIBRARY) + +if (FFTW3_FOUND) + set (FFTW3_LIBRARIES ${FFTW3_LIBRARY}) + set (FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) +endif (FFTW3_FOUND) + +mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARY) diff --git a/cmake/FindOgg.cmake b/cmake/FindOgg.cmake new file mode 100644 index 00000000..793c0869 --- /dev/null +++ b/cmake/FindOgg.cmake @@ -0,0 +1,38 @@ +# - Find ogg +# Find the native ogg includes and libraries +# +# OGG_INCLUDE_DIRS - where to find ogg.h, etc. +# OGG_LIBRARIES - List of libraries when using ogg. +# Ogg_FOUND - True if ogg found. + +if(OGG_INCLUDE_DIR) + # Already in cache, be silent + set(OGG_FIND_QUIETLY TRUE) +endif(OGG_INCLUDE_DIR) + +find_package (PkgConfig QUIET) +pkg_check_modules(PC_OGG QUIET ogg) + +find_path(OGG_INCLUDE_DIR ogg/ogg.h HINTS ${PC_OGG_INCLUDEDIR} ${PC_OGG_INCLUDE_DIRS} ${OGG_ROOT} PATH_SUFFIXES include) +# MSVC built ogg may be named ogg_static. +# The provided project files name the library with the lib prefix. +find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static HINTS ${PC_OGG_LIBDIR} ${PC_OGG_LIBRARY_DIRS} ${OGG_ROOT} PATH_SUFFIXES lib) +# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND +# to TRUE if all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_INCLUDE_DIR OGG_LIBRARY) + +if (OGG_FOUND) + set (OGG_LIBRARIES ${OGG_LIBRARY}) + set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR}) + + if (NOT TARGET Ogg::ogg) + add_library(Ogg::ogg UNKNOWN IMPORTED) + set_target_properties(Ogg::ogg PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}" + IMPORTED_LOCATION "${OGG_LIBRARIES}" + ) + endif () +endif (OGG_FOUND) + +mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY) diff --git a/cmake/FindSpeexDsp.cmake b/cmake/FindSpeexDsp.cmake new file mode 100644 index 00000000..d4a332f5 --- /dev/null +++ b/cmake/FindSpeexDsp.cmake @@ -0,0 +1,28 @@ +# - Find speexdsp +# Find the native speexdsp includes and libraries +# +# SPEEXDSP_INCLUDE_DIRS - where to find speex_preprocess.h, etc. +# SPEEXDSP_LIBRARIES - List of libraries when using speexdsp. +# SpeexDsp_FOUND - True if speexdsp found. + +if(SPEEXDSP_INCLUDE_DIR) + # Already in cache, be silent + set(SPEEXDSP_FIND_QUIETLY TRUE) +endif(SPEEXDSP_INCLUDE_DIR) + +find_package (PkgConfig QUIET) +pkg_check_modules(PC_SPEEXDSP QUIET speexdsp) + +find_path(SPEEXDSP_INCLUDE_DIR speex/speex_preprocess.h HINTS ${PC_SPEEXDSP_INCLUDEDIR} ${PC_SPEEXDSP_INCLUDE_DIRS} ${SPEEXDSP_ROOT} PATH_SUFFIXES include) +find_library(SPEEXDSP_LIBRARY NAMES speexdsp HINTS ${PC_SPEEXDSP_LIBDIR} ${PC_SPEEXDSP_LIBRARY_DIRS} ${SPEEXDSP_ROOT} PATH_SUFFIXES lib) +# Handle the QUIETLY and REQUIRED arguments and set SPEEXDSP_FOUND +# to TRUE if all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SpeexDsp DEFAULT_MSG SPEEXDSP_INCLUDE_DIR SPEEXDSP_LIBRARY) + +if (SPEEXDSP_FOUND) + set (SPEEXDSP_LIBRARIES ${SPEEXDSP_LIBRARY}) + set (SPEEXDSP_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR}) +endif (SPEEXDSP_FOUND) + +mark_as_advanced(SPEEXDSP_INCLUDE_DIR SPEEXDSP_LIBRARY) diff --git a/cmake/TestVarArrays.cmake b/cmake/TestVarArrays.cmake new file mode 100644 index 00000000..11f413fd --- /dev/null +++ b/cmake/TestVarArrays.cmake @@ -0,0 +1,22 @@ +include(CheckCSourceCompiles) + +macro(TEST_VARARRAYS VARIABLE) + if(NOT DEFINED ${VARIABLE}) + check_c_source_compiles( + " + void main(void) + { + int foo; + foo = 10; + int array[foo]; + }; + " + VARARRAYS_SUPPORT) + set(${VARIABLE} ${VARARRAYS_SUPPORT} CACHE INTERNAL "C99 variable-size arrays support" FORCE) + if(${VARIABLE}) + set(RESULT_TEXT "success") + else() + set(RESULT_TEXT "failed") + endif() + endif() +endmacro(TEST_VARARRAYS VARIABLE) diff --git a/cmake/speex-config.cmake b/cmake/speex-config.cmake new file mode 100644 index 00000000..8b7e4043 --- /dev/null +++ b/cmake/speex-config.cmake @@ -0,0 +1 @@ +include (${CMAKE_CURRENT_LIST_DIR}/speex-targets.cmake) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 00000000..cbf88b15 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,23 @@ +#cmakedefine WORDS_BIGENDIAN +#cmakedefine FLOATING_POINT +#cmakedefine FIXED_POINT +#cmakedefine FIXED_POINT_DEBUG +#cmakedefine DISABLE_FLOAT_API +#cmakedefine _USE_SSE +#cmakedefine ARM4_ASM +#cmakedefine ARM5E_ASM +#cmakedefine BFIN_ASM +#cmakedefine TI_C55X +#cmakedefine DISABLE_VBR +#cmakedefine USE_SPEEXDSP +#cmakedefine VORBIS_PSYCHO +#cmakedefine HAVE_GETOPT_H +#cmakedefine HAVE_GETOPT_LONG +#cmakedefine VAR_ARRAYS +#cmakedefine USE_ALLOCA +#cmakedefine HAVE_ALLOCA_H +#cmakedefine USE_SMALLFT +#cmakedefine USE_KISS_FFT +#cmakedefine USE_GPL_FFTW3 + +#define EXPORT @EXPORT@