Building on linux is fairly straightforward and consists of the following 3 steps:
- Build and install fftw library
- Build and install libsndfile library
- Build and install ReSampler
sudo apt-get install build-essential
#sudo apt-get install libfftw3-dev libfftw3-doc
extract it to projects folder, and cd to it
./configure
make
sudo make install
extract it to projects folder, and cd to it
sudo apt install autoconf autogen automake build-essential libasound2-dev \
libflac-dev libogg-dev libtool libvorbis-dev pkg-config python
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/libsndfile-1.0.28 &&
make
make check
sudo make install
clone this repository to a local directory, and use one of the following command lines to compile:
standard 64-bit build:
g++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler -O3
Note: in practice, you might do something like this:
sudo g++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o /usr/local/bin/ReSampler -O3
AVX Build:
g++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler -O3 -DUSE_AVX -mavx
AVX + FMA (>= Haswell, PileDriver):
g++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler -O3 -DUSE_AVX -DUSE_FMA -mavx -mfma
Quad Precision (experimental)
g++ -pthread -std=gnu++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler -O3 -lquadmath -DUSE_QUADMATH
clang++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler-clang -O3
cd path-to-where-you-want-the-binary
cmake -DCMAKE_BUILD_TYPE=Release path-to-ReSampler
make
for IDEs that support CMake, it is usually very easy to simply open the CMakeLists file and start building
ensure that the vscode c++ tools are installed.
the g++ commands can be put into the tasks.json file. For example.:
{
"version": "0.1.0",
"command": "g++",
"isShellCommand": true,
"showOutput": "always",
"args": [
"-pthread",
"-std=c++11",
"main.cpp",
"ReSampler.cpp",
"conversioninfo.cpp",
"-l",
"fftw3",
"-l",
"sndfile",
"-o",
"ReSampler",
"-O3",
"-v"
]
}
`gcc -print-prog-name=cc1plus` -v
`gcc -print-prog-name=cc1` -v
gcc -print-search-dirs
file ReSampler
sample output:
ReSampler: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=2873279a9b0040a268f7c485de9027660ab3617c, not stripped