PortAudio CMake instructions testing 5 September 2025.
Windows 10, MSVC 2022 Community Edition
Working from latest rev of: https://github.com/PortAudio/portaudio/pull/1044/files
C:\PortAudio_20250905\build>cmake --version
cmake version 4.0.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
This file is a log of testing the current proposed new CMake PortAudio build tutorial on Windows (see above specs).
On Windows, these things worked:
- I was able to follow the instructions to successfully build the portaudio library in Release and Debug mode both from the command line and from within Visual Studio.
- I was able to build and run examples and tests, both from the command line and from within Visual Studio using the default (static lib) mode.
- I was able to set breakpoints in Visual Studio and trace into PortAudio library code with the debugger
- The instructions for enabling ASIO worked. CMake automatically downloaded the ASIO SDK and pa_devs.exe listed my ASIO devices.
- I was able to follow the instructions to successfully build a portaudio.dll and examples which worked with the dll once the system could find the .dll
On Windows, what happened and what the tutorial told me differed in the following ways:
- The tutorial told me that test executables would be found in
/testbut they were in/test/Debugandtest/Releasesimilar forexamples. This means that the instructions for running tests and examples are incorrect on Windows. (This might be handled with a simple note like: "With Visual Studio the executables are placed in the Debug, Release directories depending on which build configuration is selected." I don't actually know how this works. I know that the Visual Studio generator is a multi-configuration generator and that some other generators are not, so maybe more generic language is needed like "With Visual Studio (and some other generators) the executables are placed in subdirectories reflecting the selected build configuration, for example debug builds can be found in test/Debug and release builds can be found in test/Release")
Other comments:
-
I don't think the tutorial told me where to find the built portaudio library. I found it in
DebugandReleaseI guess on Unix it is just in the build directory? I think this missing piece of information should be added to the tutorial at the end of the first build step, like "you can see the portaudio library has been created in ...". -
I did not test every last documented option. If some of these don't work we can fix them later. But it is important to know how to build debug/release and static/dynamic and these options worked for me.
-
It would be nice if the VisualStudio project somehow referenced the dll path so that the examples could be tested in the debugger in dynamic builds, but this is a bug with the CMakeLists.txt not with these instructions.
Followed the initial instructions to the letter:
git clone https://github.com/portaudio/portaudio
mkdir build
cd build
cmake ../portaudio
cmake --build .
This looks like it performed a static debug build:
ls Debug
portaudio.lib portaudio.pdb
-
instructions got me to build
portaudio.libwhich was the expected outcome. -
instructions did not tell me where to find the output files. The instructions were not incorrect. Maybe a sentence like "For Makefile builds you will find the compiled portaudio library in the
builddirectory. The Visual Studio project places release builds inbuild\Releaseand debug builds inbuild\Debug.
Then tried enabling building tests and examples:
cmake -DPA_BUILD_TESTS=ON -DPA_BUILD_EXAMPLES=ON ../portaudio
cmake --build .
This seems to work.
Looking at the examples/ directory, each example has its own visual studio project, there are subdirectories for each example, e.g. `examples/pa_devs.dir/
C:\PortAudio_20250905\build>ls examples\pa_devs.dir\Debug
pa_devs.exe.recipe pa_devs.obj vc143.pdb
pa_devs.ilk pa_devs.tlog
However the executables themselves are in examples\Debug:
C:\PortAudio_20250905\build>ls examples\Debug
pa_devs.exe paex_saw.exe
pa_devs.pdb paex_saw.pdb
pa_fuzz.exe paex_sine.exe
pa_fuzz.pdb paex_sine.pdb
paex_ocean_shore.exe paex_sine_c++.exe
paex_ocean_shore.pdb paex_sine_c++.pdb
paex_pink.exe paex_wmme_ac3.exe
paex_pink.pdb paex_wmme_ac3.pdb
paex_read_write_wire.exe paex_wmme_surround.exe
paex_read_write_wire.pdb paex_wmme_surround.pdb
paex_record.exe paex_write_sine.exe
paex_record.pdb paex_write_sine.pdb
paex_record_file.exe paex_write_sine_nonint.exe
paex_record_file.pdb paex_write_sine_nonint.pd
Running examples\Debug\pa_devs.exe works.
Running examples\Debug\paex_sine.exe works.
Same file system layout for test.
Running test\Debug\patest_maxsines.exe works.
Opened the solution in msvc: start PortAudio.sln
The solution contains all of the examples and tests, and has Configurations for Debug, Release, MinSizeRel, RelWithDebInfo. Selecting the release configuration and running Build > Build Solution F7, which appears to have compiled release versions of everything:
C:\PortAudio_20250905\build>ls Release
portaudio.lib
C:\PortAudio_20250905\build>ls examples\Release
pa_devs.exe paex_saw.exe
pa_fuzz.exe paex_sine.exe
paex_ocean_shore.exe paex_sine_c++.exe
paex_pink.exe paex_wmme_ac3.exe
paex_read_write_wire.exe paex_wmme_surround.exe
paex_record.exe paex_write_sine.exe
paex_record_file.exe paex_write_sine_nonint.exe
C:\PortAudio_20250905\build>ls test\Release
pa_minlat.exe
patest1.exe
patest_buffer.exe
patest_callbackstop.exe
patest_clip.exe
patest_converters.exe
patest_dither.exe
(and so on)
Back in Visual Studio I was able to right-click paex_sine and select "Set as Startup Project" then run paex_sine with the debugger, set breakpoints, and step into PortAudio library code.
-
everything worked as expected. perhaps even better than expected.
-
the instructions were not accurate. for example they said that I could run a test using
test/sometesthowever I actually had to runtest/Debug/patest_sometestortest/Release/patest_sometest,examples/Debug/paex_sineand so on.
Worked as expected, but I've added some comments to the review around clarifying that the Visual Studio generator is a multi-configuration generator that generates all of Debug, Release, ... into the same project.
The following "just worked" for me. It downloaded the ASIO SDK, and the resulting pa_devs.exe listed my ASIO devices.
cmake -DPA_BUILD_TESTS=ON -DPA_BUILD_EXAMPLES=ON -DPA_USE_ASIO=ON ../portaudio
cmake --build . --config Release
examples\Release\pa_devs
All good
**test building shared libraries: -DPA_BUILD_SHARED_LIBS=ON`
cmake -DPA_BUILD_TESTS=ON -DPA_BUILD_EXAMPLES=ON -DPA_USE_ASIO=ON -DPA_BUILD_SHARED_LIBS=ON ../portaudio
cmake --build . --config Release
C:\PortAudio_20250905\build>ls Release
portaudio.dll portaudio.exp portaudio.lib
test\Release\patest_maxsines.exe
Failed to run. DLL not found.
cp Release\portaudio.dll test\Release
Release\patest_maxsines.exe
So it works from the command line. Now how about Visual Studio:
start portaudio.sln
Tried to build and run paex_sine. Build worked but dll was not found. I wonder if there is a way to fix this?
All good except shared library build doesn't put portaudio.dll on the path for running examples and tests from within visual studio. This is not a problem with the instructions. I will create an issue.