* It turns out that modern CMake (version > 3) is able to generate OS X frameworks for shared libraries. I’ve provided an option in the CMakeLists to support this if the host CMake version is capable of doing so. I still would like to do more testing on this.
* "make install" support turned out to be trivial to enable - so this is now included and I can install a portaudio shared library and header files into a Ubuntu or OS X system (or an arbitrary location using the CMAKE_INSTALL_PREFIX definition which is equivalent to “--prefix” with a configure script). I just need to get some pkg-config action happening in there, but I don’t expect that to be difficult at all.
I’ve been trying to use the PortAudio configure.in as a reference for what the CMakeLists.txt should do and I’ve got a small question: the configure script does an endianness check and adds a “-DPA_LITTLE_ENDIAN” or “-DPA_BIG_ENDIAN” to the CFLAGS. This has never existed in the CMakeLists.txt file - so I wondered how pa_converters was working with CMake builds on Windows. I then found pa_endianness.h which also sets these definitions. Is the purpose of passing the PA_XXX_ENDIAN arguments in CFLAGS purely to provide the endianness for the cases where pa_endianness.h cannot figure it out? I’ve added an endianness check to the CMakeLists.txt to replicate the behaviour of the configure.in script, but am not entirely convinced it’s a good thing.
Post by Nick AppletonHi,
I mentioned a week or so ago that I've been doing some reworks of the PortAudio CMake support to get it working on OS X and Linux. I've had good success, but have not been able to set up a merge request through the Assembla hosting. I was also unable to push changes I made in a branch to the repository as described in the UsingTheGitRepository wiki page (I guess I need permissions). I setup an account (my username is "nicholas.l.appleton") - but do I have to pay to use Assembla? Their website seems to strongly suggest that I do.
I have been working in a separate repository in my personal github space as I needed a location to push-to and pull-from on a few platforms while I am prototyping and testing. The repo is here: https://github.com/nickappleton/portaudio-cmake-updates and the only file I have modified is the top-level CMakeLists.txt and I've added "cmake_support/FindJack.cmake" to find Jack on Linux. The changes I have made can be viewed in this repository.
The work is incomplete (in the sense of not every Linux hostapi is supported), but I don't expect the structure of the CMakeLists.txt file will change much anymore so hopefully patches after this will be easier to understand. The additions and restructure has reduced the size of the existing CMakeLists.txt.
* I've added support for building PortAudio on OS X (CoreAudio hostapi) and Linux (ALSA and Jack hostapis) and have tested this on OS X 10.11 and Ubuntu 16.04. These can be built the usual way (cmake {portaudio directory} && make), and can also be included by larger CMake projects (a project can "add_subdirectory(portaudio directory)" to have access to the static or dynamic libraries).
* I've restructured the CMakeLists.txt to not pollute global CMake variables (like CFLAGS or include directories) when it is not necessary; this really only has an impact when PortAudio is included in a larger CMake project and prevents libraries which depend on it getting all of the PA-specific compiler definitions etc...
* I've tried as much as possible to keep the existing Windows behavior identical to what it was previously and to not change the look and feel of the Visual Studio solutions. I've also preserved the existing generation of the "options_cmake.h" file - but have not adopted this pattern for the Linux and OS X builds. I have ensured that I can still build PortAudio with Visual Studio 2015 community edition with the ASIO SDK.
* I'd really like to see if I can get CMake to generate an OS X framework for PortAudio. I think this would be pretty cool.
* I want to be able to support "make install" on Linux and possibly OS X if I cannot get the above working.
* I probably should try and get the other Linux hostapis setup - I'm just not entirely sure how I will test them..
---
I hope the new structure is easy to follow and understand. Please let me know about the Assembla business. I am not willing to pay for an account (if that is required) - but if it is not, could someone can reach-out to me off the mailing list to let me know what I am doing wrong.
Cheers,
Nick
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio