History

Add CMake build system and setup CI on Travis and AppVeyor

This commit adds a new CMake-based build system. The build time configuration should match the one by autoconf. Then this build system gets tested on Travis (Linux) and AppVeyor (Windows; MSVC and MinGW). Additionally on AppVeyor, a build artifact is produced for easier distribution to Windows. Some minor changes are introduced to fix compilation on Windows. This commit is based on previous attempts at a CMake-based build by Jean-Michaël Celerier (jcelerier) and Matthew Sitton (mdsitton).

Boris-Chengbiao Zhou committed 8 years ago

Commit 73cb39b1 parent 5e56ae815 files · +447 −207Browse files

Unified · Split

15 files
  1. .gitignore +3 −1
  2. .travis.yml +11 −3
  3. CMakeLists.txt +141 −0
  4. README +11 −0
  5. Win32/config.h +0 −197
  6. appveyor.yml +47 −0
  7. cmake/ClipMode.cmake +92 −0
  8. cmake/FindFFTW.cmake +48 −0
  9. cmake/FindSndfile.cmake +18 −0
  10. config.h.in +64 −0
  11. src/common.h +0 −1
  12. tests/streaming_test.c +3 −0
  13. tests/termination_test.c +4 −1
  14. tests/util.c +3 −4
  15. tests/util.h +2 −0
.gitignore+3−1
@@ -1,4 +1,4 @@
1*.cm*1# *.cm* # This line is broken it matches all files.
2*.dat2*.dat
3*.gz3*.gz
4*.la4*.la
@@ -29,6 +29,7 @@ autom4te.cache · 24 unmodified lines
29libsamplerate-*.tar.bz229libsamplerate-*.tar.bz2
30compile30compile
31config.*31config.*
32!/config.h.in
32configure33configure
33depcomp34depcomp
34doc/ChangeLog35doc/ChangeLog
@@ -53,3 +54,4 @@ tests/benchmark · 18 unmodified lines
53tests/src-evaluate54tests/src-evaluate
54*.log55*.log
55*.trs56*.trs
57build/
.travis.yml+11−3
@@ -9,7 +9,15 @@ before_install: · 8 unmodified lines
9 - sudo apt-get update9 - sudo apt-get update
10 - sudo apt-get install -y autoconf automake-1.15 pkg-config m4 libsndfile-dev libfftw3-dev libasound2-dev10 - sudo apt-get install -y autoconf automake-1.15 pkg-config m4 libsndfile-dev libfftw3-dev libasound2-dev
11 11
12env:
13 - AUTOGEN=true CMAKE_SHARED=OFF
14 - AUTOGEN=false CMAKE_SHARED=ON
15
12script:16script:
13 - ./autogen.sh17 - if $AUTOGEN; then ./autogen.sh && ./configure && make distcheck; fi
14 - ./configure18 - mkdir build
15 - make distcheck19 - cd build
20 - cmake -DBUILD_SHARED_LIBS=$CMAKE_SHARED ..
21 - cat config.h
22 - make
23 - make test
CMakeLists.txt+141−0
@@ -0,0 +1,141 @@
1cmake_minimum_required(VERSION 3.1)
2project(libsamplerate VERSION 0.1.9 LANGUAGES C)
3
4set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
5
6include(TestBigEndian)
7include(CheckFunctionExists)
8include(CheckIncludeFiles)
9include(CheckSymbolExists)
10include(CheckTypeSize)
11include(ClipMode)
12
13set(SAMPLERATE_SRC
14 ${PROJECT_SOURCE_DIR}/src/samplerate.c
15 ${PROJECT_SOURCE_DIR}/src/src_linear.c
16 ${PROJECT_SOURCE_DIR}/src/src_sinc.c
17 ${PROJECT_SOURCE_DIR}/src/src_zoh.c)
18
19if(WIN32)
20 set(OS_IS_WIN32 TRUE)
21 set(SAMPLERATE_SRC
22 ${SAMPLERATE_SRC}
23 ${PROJECT_SOURCE_DIR}/Win32/libsamplerate-0.def)
24 include_directories(Win32)
25endif()
26
27test_big_endian(CPU_IS_BIG_ENDIAN)
28if(CPU_IS_BIG_ENDIAN)
29 set(CPU_IS_LITTLE_ENDIAN 0)
30else()
31 set(CPU_IS_LITTLE_ENDIAN 1)
32endif()
33
34check_function_exists(pow RESULT)
35if(NOT RESULT)
36 list(APPEND CMAKE_REQUIRED_LIBRARIES m)
37 set(NEED_MATH)
38endif()
39check_function_exists(alarm HAVE_ALARM)
40check_function_exists(lrint HAVE_LRINT)
41check_function_exists(lrintf HAVE_LRINTF)
42check_function_exists(signal HAVE_SIGNAL)
43
44check_include_files(stdint.h HAVE_STDINT)
45check_include_files(sys/times.h HAVE_SYS_TIMES_H)
46
47check_symbol_exists(SIGALRM signal.h HAVE_SIGALRM)
48
49check_type_size(int SIZEOF_INT)
50check_type_size(long SIZEOF_LONG)
51
52# This will set CPU_CLIPS_NEGATIVE and CPU_CLIPS_POSITIVE
53clip_mode()
54
55find_package(ALSA)
56set(HAVE_ALSA ${ALSA_FOUND})
57if(ALSA_FOUND)
58 include_directories("${ALSA_INCLUDE_DIR}")
59endif()
60
61find_package(Sndfile)
62set(HAVE_SNDFILE ${SNDFILE_FOUND})
63if(SNDFILE_FOUND)
64 include_directories("${SNDFILE_INCLUDE_DIR}")
65endif()
66
67find_package(FFTW)
68set(HAVE_FFTW3 ${FFTW_FOUND})
69if(FFTW_FOUND)
70 include_directories("${FFTW_INCLUDE_DIR}")
71endif()
72
73configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
74
75add_library(samplerate ${SAMPLERATE_SRC})
76
77if(BUILD_SHARED_LIBS AND WIN32)
78 if (MSVC)
79 set_target_properties(samplerate PROPERTIES OUTPUT_NAME "libsamplerate-0")
80 else()
81 set_target_properties(samplerate PROPERTIES OUTPUT_NAME "samplerate-0")
82 endif()
83endif()
84
85target_include_directories(samplerate PUBLIC
86 ${PROJECT_SOURCE_DIR}/src
87 ${CMAKE_CURRENT_BINARY_DIR})
88
89enable_testing()
90
91file(GLOB TEST_SRCS ${PROJECT_SOURCE_DIR}/tests/*_test.c)
92
93foreach(testSrc ${TEST_SRCS})
94 get_filename_component(testName ${testSrc} NAME_WE)
95 add_executable(${testName}
96 ${testSrc}
97 ${PROJECT_SOURCE_DIR}/tests/util.c
98 ${PROJECT_SOURCE_DIR}/tests/calc_snr.c)
99 target_link_libraries(${testName} PUBLIC samplerate ${CMAKE_REQUIRED_LIBRARIES})
100 if(FFTW_FOUND)
101 target_link_libraries(${testName} PUBLIC ${FFTW_LIBRARY})
102 endif()
103 add_test(NAME ${testName} COMMAND ${testName})
104endforeach(testSrc)
105
106set(EXAMPLE_SRCS
107 ${PROJECT_SOURCE_DIR}/examples/sndfile-resample.c
108 ${PROJECT_SOURCE_DIR}/examples/timewarp-file.c
109 ${PROJECT_SOURCE_DIR}/examples/varispeed-play.c)
110
111foreach(exampleSrc ${EXAMPLE_SRCS})
112 get_filename_component(exampleName ${exampleSrc} NAME_WE)
113 add_executable(${exampleName}
114 ${exampleSrc}
115 ${PROJECT_SOURCE_DIR}/examples/audio_out.c)
116 target_link_libraries(${exampleName} PUBLIC samplerate ${CMAKE_REQUIRED_LIBRARIES})
117 if(ALSA_FOUND)
118 target_link_libraries(${exampleName} PUBLIC ${ALSA_LIBRARY})
119 endif()
120 if(SNDFILE_FOUND)
121 target_link_libraries(${exampleName} PUBLIC ${SNDFILE_LIBRARY})
122 endif()
123 if(WIN32)
124 target_link_libraries(${exampleName} PUBLIC winmm)
125 endif()
126endforeach(exampleSrc)
127
128set(prefix ${CMAKE_INSTALL_PREFIX})
129set(exec_prefix "\${prefix}")
130set(includedir "\${prefix}/include")
131set(libdir "\${exec_prefix}/lib")
132set(VERSION "${PROJECT_VERSION}")
133if(NEED_MATH)
134 set(LIBS "-lm")
135endif()
136configure_file(samplerate.pc.in samplerate.pc @ONLY)
137
138install(TARGETS samplerate DESTINATION lib)
139install(FILES src/samplerate.h DESTINATION include)
140install(DIRECTORY doc/ DESTINATION share/doc/libsamplerate)
141install(FILES ${CMAKE_BINARY_DIR}/samplerate.pc DESTINATION lib/pkgconfig)
README+11−0
@@ -40,6 +40,17 @@ the following three commands : · 39 unmodified lines
40 make40 make
41 make install41 make install
42 42
43CMake
44-----
45There is a new CMake-based build system available:
46 mkdir build
47 cd build
48 cmake ..
49 make
50
51Use `cmake -DCMAKE_BUILD_TYPE=Release ..` to make a release build.
52Use `cmake -DBUILD_SHARED_LIBS=ON ..` to build a shared library.
53
43CONTACTS54CONTACTS
44--------55--------
45 56
Win32/config.h+0−197
@@ -1,197 +0,0 @@
1/*
2** Copyright (c) 2002-2016, Erik de Castro Lopo <erikd@mega-nerd.com>
3** All rights reserved.
4**
5** This code is released under 2-clause BSD license. Please see the
6** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
7*/
8
9/*
10** This is the Win32 specific config.h header file.
11**
12** On Unix (including MacOSX), this header file is automatically generated
13** during the configure process while on Win32 this has to be hand edited
14** to keep it up to date.
15**
16** This is also a good file to add Win32 specific things.
17*/
18
19/*
20** MSVC++ assumes that all floating point constants without a trailing
21** letter 'f' are double precision.
22**
23** If this assumption is incorrect and one of these floating point constants
24** is assigned to a float variable MSVC++ generates a warning.
25**
26** Since there are currently about 25000 of these warnings generated in
27** src/src_sinc.c this slows down compile times considerably. The
28** following #pragma disables the warning.
29*/
30
31#pragma warning(disable: 4305)
32
33/*----------------------------------------------------------------------------
34** Normal #defines follow.
35*/
36
37/* Set to 1 if the compile is GNU GCC. */
38#define COMPILER_IS_GCC 0
39
40/* Target processor clips on negative float to int conversion. */
41#define CPU_CLIPS_NEGATIVE 0
42
43/* Target processor clips on positive float to int conversion. */
44#define CPU_CLIPS_POSITIVE 0
45
46/* Host processor is big endian. */
47#define CPU_IS_BIG_ENDIAN 0
48
49/* Host processor is little endian. */
50#define CPU_IS_LITTLE_ENDIAN 1
51
52/* Set to 1 to enable debugging. */
53#define ENABLE_DEBUG 0
54
55/* Major version of GCC or 3 otherwise. */
56/* #undef GCC_MAJOR_VERSION */
57
58/* Define to 1 if you have the `alarm' function. */
59/* #undef HAVE_ALARM */
60
61/* Define to 1 if you have the `calloc' function. */
62#define HAVE_CALLOC 1
63
64/* Define to 1 if you have the `ceil' function. */
65#define HAVE_CEIL 1
66
67/* Define to 1 if you have the <dlfcn.h> header file. */
68/* #undef HAVE_DLFCN_H */
69
70/* Set to 1 if you have libfftw3. */
71/* #undef HAVE_FFTW3 */
72
73/* Define to 1 if you have the `floor' function. */
74#define HAVE_FLOOR 1
75
76/* Define to 1 if you have the `fmod' function. */
77#define HAVE_FMOD 1
78
79/* Define to 1 if you have the `free' function. */
80#define HAVE_FREE 1
81
82/* Define to 1 if you have the <inttypes.h> header file. */
83/* #undef HAVE_INTTYPES_H */
84
85/* Define to 1 if you have the `m' library (-lm). */
86/* #undef HAVE_LIBM */
87
88/* Define if you have C99's lrint function. */
89/* #undef HAVE_LRINT */
90
91/* Define if you have C99's lrintf function. */
92/* #undef HAVE_LRINTF */
93
94/* Define to 1 if you have the `malloc' function. */
95#define HAVE_MALLOC 1
96
97/* Define to 1 if you have the `memcpy' function. */
98#define HAVE_MEMCPY 1
99
100/* Define to 1 if you have the `memmove' function. */
101#define HAVE_MEMMOVE 1
102
103/* Define to 1 if you have the <memory.h> header file. */
104#define HAVE_MEMORY_H 1
105
106/* Define if you have signal SIGALRM. */
107/* #undef HAVE_SIGALRM */
108
109/* Define to 1 if you have the `signal' function. */
110/* #undef HAVE_SIGNAL */
111
112/* Set to 1 if you have libsndfile. */
113#define HAVE_SNDFILE 1
114
115/* Define to 1 if you have the <stdint.h> header file. */
116/* #undef HAVE_STDINT_H */
117
118/* Define to 1 if you have the <stdlib.h> header file. */
119#define HAVE_STDLIB_H 1
120
121/* Define to 1 if you have the <strings.h> header file. */
122#define HAVE_STRINGS_H 1
123
124/* Define to 1 if you have the <string.h> header file. */
125#define HAVE_STRING_H 1
126
127/* Define to 1 if you have the <sys/stat.h> header file. */
128#define HAVE_SYS_STAT_H 1
129
130/* Define to 1 if you have the <sys/times.h> header file. */
131/* #undef HAVE_SYS_TIMES_H */
132
133/* Define to 1 if you have the <sys/types.h> header file. */
134#define HAVE_SYS_TYPES_H 1
135
136/* Define to 1 if you have the <unistd.h> header file. */
137#define HAVE_UNISTD_H 1
138
139/* Define to the sub-directory in which libtool stores uninstalled libraries.
140 */
141#define LT_OBJDIR ".libs/"
142
143/* Define to 1 if your C compiler doesn't accept -c and -o together. */
144/* #undef NO_MINUS_C_MINUS_O */
145
146/* Set to 1 if compiling for Win32 */
147#define OS_IS_WIN32 1
148
149/* Name of package */
150#define PACKAGE "libsamplerate"
151
152/* Define to the address where bug reports for this package should be sent. */
153#define PACKAGE_BUGREPORT "erikd@mega-nerd.com"
154
155/* Define to the full name of this package. */
156#define PACKAGE_NAME "libsamplerate"
157
158/* Define to the full name and version of this package. */
159#define PACKAGE_STRING "libsamplerate 0.1.8"
160
161/* Define to the one symbol short name of this package. */
162#define PACKAGE_TARNAME "libsamplerate"
163
164/* Define to the home page for this package. */
165#define PACKAGE_URL "http://www.mega-nerd.com/libsamplerate/"
166
167/* Define to the version of this package. */
168#define PACKAGE_VERSION "0.1.8"
169
170/* The size of `double', as computed by sizeof. */
171#define SIZEOF_DOUBLE 8
172
173/* The size of `float', as computed by sizeof. */
174#define SIZEOF_FLOAT 4
175
176/* The size of `int', as computed by sizeof. */
177#define SIZEOF_INT 4
178
179/* The size of `long', as computed by sizeof. */
180#define SIZEOF_LONG 4
181
182/* Define to 1 if you have the ANSI C header files. */
183#define STDC_HEADERS 1
184
185/* Version number of package */
186#define VERSION "0.1.8"
187
188
189
190/* Extra Win32 hacks. */
191
192/*
193** Microsoft's compiler still does not support the 1999 ISO C Standard
194** which includes 'inline'.
195*/
196
197#define inline __inline
appveyor.yml+47−0
@@ -0,0 +1,47 @@
1image:
2- Visual Studio 2017
3
4environment:
5 matrix:
6 - generator: "Visual Studio 15 2017"
7 artifact: "ON"
8 - generator: "MSYS Makefiles"
9 artifact: "ON"
10 - generator: "Visual Studio 15 2017"
11 shared: "OFF"
12 artifact: "OFF"
13 - generator: "Visual Studio 15 2017"
14 shared: "ON"
15 artifact: "OFF"
16 - generator: "MSYS Makefiles"
17 shared: "OFF"
18 artifact: "OFF"
19 - generator: "MSYS Makefiles"
20 shared: "ON"
21 artifact: "OFF"
22
23matrix:
24 fast_finish: true
25
26build_script:
27 - ps: |
28 $env:Path = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;" + $env:Path
29 bash -lc "pacman -S --needed --noconfirm mingw-w64-x86_64-fftw mingw-w64-x86_64-libsndfile"
30 mkdir build
31 cd build
32 if ($env:artifact -eq 'OFF')
33 {
34 cmake -G "$env:generator" -DBUILD_SHARED_LIBS=$env:shared ..
35 cat config.h
36 cmake --build .
37 ctest -C "Debug"
38 }
39 else
40 {
41 cmake .. -G "$env:generator" -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=artifact
42 cmake --build . --config Release --target install
43 cmake .. -G "$env:generator" -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=artifact
44 cmake --build . --config Release --target install
45 Compress-Archive -Path artifact\* -Destination artifact
46 Push-AppveyorArtifact artifact.zip
47 }
cmake/ClipMode.cmake+92−0
@@ -0,0 +1,92 @@
1include (CheckCSourceRuns)
2include (CMakePushCheckState)
3
4macro (CLIP_MODE)
5
6 set (CLIP_MODE_POSITIVE_MESSAGE "Target processor clips on positive float to int conversion")
7 set (CLIP_MODE_NEGATIVE_MESSAGE "Target processor clips on negative float to int conversion")
8
9 message (STATUS "Checking processor clipping capabilities...")
10
11 if (CMAKE_CROSSCOMPILING)
12
13 set (CLIP_MSG "disabled")
14 set (CPU_CLIPS_POSITIVE FALSE CACHE BOOL ${CLIP_MODE_POSITIVE_MESSAGE})
15 set (CPU_CLIPS_NEGATIVE FALSE CACHE BOOL ${CLIP_MODE_NEGATIVE_MESSAGE})
16
17 else (NOT CMAKE_CROSSCOMPILING)
18
19 cmake_push_check_state ()
20
21 set (CMAKE_REQUIRED_QUIET TRUE)
22 if (LIBM_REQUIRED)
23 set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${M_LIBRARY})
24 endif ()
25
26 check_c_source_runs (
27 "
28 #define _ISOC9X_SOURCE 1
29 #define _ISOC99_SOURCE 1
30 #define __USE_ISOC99 1
31 #define __USE_ISOC9X 1
32 #include <math.h>
33 int main (void)
34 { double fval ;
35 int k, ival ;
36
37 fval = 1.0 * 0x7FFFFFFF ;
38 for (k = 0 ; k < 100 ; k++)
39 { ival = (lrint (fval)) >> 24 ;
40 if (ival != 127)
41 return 1 ;
42
43 fval *= 1.2499999 ;
44 } ;
45
46 return 0 ;
47 }
48 "
49 CPU_CLIPS_POSITIVE)
50
51 check_c_source_runs (
52 "
53 #define _ISOC9X_SOURCE 1
54 #define _ISOC99_SOURCE 1
55 #define __USE_ISOC99 1
56 #define __USE_ISOC9X 1
57 #include <math.h>
58 int main (void)
59 { double fval ;
60 int k, ival ;
61
62 fval = -8.0 * 0x10000000 ;
63 for (k = 0 ; k < 100 ; k++)
64 { ival = (lrint (fval)) >> 24 ;
65 if (ival != -128)
66 return 1 ;
67
68 fval *= 1.2499999 ;
69 } ;
70
71 return 0 ;
72 }
73 "
74 CPU_CLIPS_NEGATIVE)
75
76 cmake_pop_check_state ()
77
78 if (CPU_CLIPS_POSITIVE AND (NOT CPU_CLIPS_NEGATIVE))
79 set (CLIP_MSG "positive")
80 elseif (CPU_CLIPS_NEGATIVE AND (NOT CPU_CLIPS_POSITIVE))
81 set (CLIP_MSG "negative")
82 elseif (CPU_CLIPS_POSITIVE AND CPU_CLIPS_NEGATIVE)
83 set (CLIP_MSG "both")
84 else ()
85 set (CLIP_MSG "none")
86 endif ()
87
88 endif (CMAKE_CROSSCOMPILING)
89
90 message (STATUS "Checking processor clipping capabilities... ${CLIP_MSG}")
91
92endmacro (CLIP_MODE)
cmake/FindFFTW.cmake+48−0
@@ -0,0 +1,48 @@
1# Adapted from: https://github.com/wjakob/layerlab/blob/master/cmake/FindFFTW.cmake
2
3# Copyright (c) 2015, Wenzel Jakob
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are met:
8#
9# * Redistributions of source code must retain the above copyright notice, this
10# list of conditions and the following disclaimer.
11#
12# * Redistributions in binary form must reproduce the above copyright notice,
13# this list of conditions and the following disclaimer in the documentation
14# and/or other materials provided with the distribution.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27# - Find FFTW
28# Find the native FFTW includes and library
29#
30# FFTW_INCLUDE_DIR - where to find fftw3.h
31# FFTW_LIBRARY - List of libraries when using FFTW.
32# FFTW_FOUND - True if FFTW found.
33
34if (FFTW_INCLUDE_DIR)
35 # Already in cache, be silent
36 set (FFTW_FIND_QUIETLY TRUE)
37endif (FFTW_INCLUDE_DIR)
38
39find_path (FFTW_INCLUDE_DIR fftw3.h)
40
41find_library (FFTW_LIBRARY NAMES fftw3)
42
43# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
44# all listed variables are TRUE
45include (FindPackageHandleStandardArgs)
46find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARY FFTW_INCLUDE_DIR)
47
48mark_as_advanced (FFTW_LIBRARY FFTW_INCLUDE_DIR)
cmake/FindSndfile.cmake+18−0
@@ -0,0 +1,18 @@
1# Variables defined:
2# SNDFILE_FOUND
3# SNDFILE_INCLUDE_DIR
4# SNDFILE_LIBRARY
5#
6# Environment variables used:
7# SNDFILE_ROOT
8
9find_path(SNDFILE_INCLUDE_DIR sndfile.h
10 HINTS $ENV{SNDFILE_ROOT}/include)
11
12find_library(SNDFILE_LIBRARY NAMES sndfile
13 HINTS $ENV{SNDFILE_ROOT}/lib)
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(SNDFILE DEFAULT_MSG SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
17
18mark_as_advanced(SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
config.h.in+64−0
@@ -0,0 +1,64 @@
1/*
2** Copyright (c) 2002-2016, Erik de Castro Lopo <erikd@mega-nerd.com>
3** All rights reserved.
4**
5** This code is released under 2-clause BSD license. Please see the
6** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
7*/
8
9/* Name of package */
10#define PACKAGE "${PROJECT_NAME}"
11
12/* Version number of package */
13#define VERSION "${PROJECT_VERSION}"
14
15/* Target processor clips on negative float to int conversion. */
16#cmakedefine01 CPU_CLIPS_NEGATIVE
17
18/* Target processor clips on positive float to int conversion. */
19#cmakedefine01 CPU_CLIPS_POSITIVE
20
21/* Target processor is big endian. */
22#cmakedefine01 CPU_IS_BIG_ENDIAN
23
24/* Target processor is little endian. */
25#cmakedefine01 CPU_IS_LITTLE_ENDIAN
26
27/* Define to 1 if you have the `alarm' function. */
28#cmakedefine01 HAVE_ALARM
29
30/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
31#cmakedefine01 HAVE_ALSA
32
33/* Set to 1 if you have libfftw3. */
34#cmakedefine01 HAVE_FFTW3
35
36/* Define if you have C99's lrint function. */
37#cmakedefine01 HAVE_LRINT
38
39/* Define if you have C99's lrintf function. */
40#cmakedefine01 HAVE_LRINTF
41
42/* Define if you have signal SIGALRM. */
43#cmakedefine01 HAVE_SIGALRM
44
45/* Define to 1 if you have the `signal' function. */
46#cmakedefine01 HAVE_SIGNAL
47
48/* Set to 1 if you have libsndfile. */
49#cmakedefine01 HAVE_SNDFILE
50
51/* Define to 1 if you have the <stdint.h> header file. */
52#cmakedefine01 HAVE_STDINT_H
53
54/* Define to 1 if you have the <sys/times.h> header file. */
55#cmakedefine01 HAVE_SYS_TIMES_H
56
57/* Set to 1 if compiling for Win32 */
58#cmakedefine01 OS_IS_WIN32
59
60/* The size of `int', as computed by sizeof. */
61#define SIZEOF_INT ${SIZEOF_INT}
62
63/* The size of `long', as computed by sizeof. */
64#define SIZEOF_LONG ${SIZEOF_LONG}
src/common.h+0−1
@@ -48,7 +48,6 @@ typedef long int32_t ; · 47 unmodified lines
48# define WARN_UNUSED48# define WARN_UNUSED
49#endif49#endif
50 50
51
52#include "samplerate.h"51#include "samplerate.h"
53 52
54enum53enum
tests/streaming_test.c+3−0
@@ -6,11 +6,14 @@ · 5 unmodified lines
6** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING6** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
7*/7*/
8 8
9#include <stdlib.h>
9#include <stdio.h>10#include <stdio.h>
10#include <math.h>11#include <math.h>
11 12
12#include <samplerate.h>13#include <samplerate.h>
13 14
15#include "util.h"
16
14#define BUFFER_LEN (1<<15)17#define BUFFER_LEN (1<<15)
15 18
16#define BLOCK_LEN 10019#define BLOCK_LEN 100
tests/termination_test.c+4−1
@@ -66,7 +66,10 @@ main (void) · 65 unmodified lines
66static void66static void
67simple_test (int converter)67simple_test (int converter)
68{68{
69 int ilen = 199030, olen = 1000, error ;69 // MSVC doesn't support variable-length arrays
70 #define ilen 199030
71 #define olen 1000
72 int error ;
70 73
71 {74 {
72 float in [ilen] ;75 float in [ilen] ;
tests/util.c+3−4
@@ -176,12 +176,10 @@ get_cpu_name (void) · 175 unmodified lines
176 search = "hw.model" ;176 search = "hw.model" ;
177 is_pipe = 1 ;177 is_pipe = 1 ;
178#else178#else
179 file = NULL ;179 return name;
180#endif180#endif
181 181
182 if (file == NULL)182#if defined (__linux__) || defined (__APPLE__) || defined (__FreeBSD__)
183 return name ;
184
185 if (search == NULL)183 if (search == NULL)
186 { printf ("Error : search is NULL in function %s.\n", __func__) ;184 { printf ("Error : search is NULL in function %s.\n", __func__) ;
187 return name ;185 return name ;
@@ -216,5 +214,6 @@ get_cpu_name (void) · 28 unmodified lines
216 fclose (file) ;214 fclose (file) ;
217 215
218 return name ;216 return name ;
217#endif
219} /* get_cpu_name */218} /* get_cpu_name */
220 219
tests/util.h+2−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
6** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING6** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
7*/7*/
8 8
9#include "config.h"
10
9#define ABS(a) (((a) < 0) ? - (a) : (a))11#define ABS(a) (((a) < 0) ? - (a) : (a))
10#define MIN(a,b) (((a) < (b)) ? (a) : (b))12#define MIN(a,b) (((a) < (b)) ? (a) : (b))
11#define MAX(a,b) (((a) >= (b)) ? (a) : (b))13#define MAX(a,b) (((a) >= (b)) ? (a) : (b))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t