Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake rewrite + feature completion using modern CMake best practices #461

Merged
merged 4 commits into from
Aug 12, 2021

Conversation

Be-ing
Copy link
Collaborator

@Be-ing Be-ing commented Jan 23, 2021

This branch is on top of #459.

Rewrite CMakeLists.txt using CMake targets and modules instead
of building up source files in variables.

Refactor to use standard CMake variables, notably
BUILD_SHARED_LIBS instead of always building both dynamic and
static libraries. Also use CMAKE_FRAMEWORK for building as a
macOS framework.

Remove superfluous PA_ prefixes from option names.

Automatically download ASIO SDK from Steinberg if it is not found.
The path to the SDK can be manually specified with
ASIO_SDK_ZIP_PATH to facilitate caching on CI.

Add support for OSS (off by default).

@Be-ing
Copy link
Collaborator Author

Be-ing commented Jan 26, 2021

I have confirmed this works on Windows building Mixxx: mixxxdj/mixxx#3594
I have also tested linking Mixxx to this on Linux.

qa/paqa_devs.c Outdated Show resolved Hide resolved
test/patest_unplug.c Outdated Show resolved Hide resolved
@Be-ing
Copy link
Collaborator Author

Be-ing commented Feb 9, 2021

This annoying build directory in the repository is making it inconvenient to maintain this branch. This should be removed to allow users to follow the normal CMake convention of using build for their CMake build directory, but currently the repo has files for other build systems there...

@Be-ing
Copy link
Collaborator Author

Be-ing commented Feb 10, 2021

The new autodownloading of the ASIO SDK allows for adding an asio option to the vcpkg port: https://github.com/mixxxdj/vcpkg/tree/2.3/overlay/ports/portaudio

@bagong
Copy link

bagong commented Feb 10, 2021

The new autodownloading of the ASIO SDK allows for adding an asio option to the vcpkg port: https://github.com/mixxxdj/vcpkg/tree/2.3/overlay/ports/portaudio

Autodownloading was discussed in the old portaudio vcpkg-package, and rejected, because of Steinbergs license conditions. Back then the compromise was to require the user to place the SDK in a certain folder, and ASIO would be included automatically.

@Be-ing
Copy link
Collaborator Author

Be-ing commented Feb 10, 2021

Here is that old vcpkg pull request. That was before vcpkg had the ability for packages to have optional features. In the port I linked above which we are using for Mixxx on Windows, the user must explicitly specify to build portaudio[asio] instead of portaudio, so the vcpkg maintainers may change their mind. If they don't allow that upstream, it is still easy for users to use the port I wrote with the overlay feature.

@Be-ing Be-ing force-pushed the cmake_rewrite branch 10 times, most recently from 0f7ee8c to 0e3b934 Compare August 4, 2021 16:18
@Be-ing
Copy link
Collaborator Author

Be-ing commented Aug 4, 2021

Woo! I got the JACK host API building on Windows with both MSVC and MinGW. 🎉 I don't think this was possible with any of the build systems before. This requires using the TRE library for POSIX regular expressions because neither Windows nor MinGW have a regex.h header. For MSVC, it also requires pthread4w for pthread.h. Both of these libraries are available in vcpkg which I have setup on GitHub Actions. The JACK library also comes from vcpkg. The jack2 vcpkg port does not build the real JACK library nor JACK server. It builds JackWeakAPI which is a shim that dynamically loads the real JACK library and forwards API calls to it. When this is released, I will update the portaudio vcpkg port upstream and make it easy to build with JACK for Windows and MinGW.

Unfortunately I could not get the JACK host API to link on MinGW on Ubuntu. I tried every combination of static/dynamic JACK/PortAudio but ran into different linker errors each time. This might be some peculiarity of vcpkg or MinGW, or an interaction between them. Considering that building the JACK host API works with MinGW on Windows, I think the CMake modules should be able to build with MinGW on Linux.

The JACK host API is also built on macOS using the jack package in Homebrew.

A few tiny changes to pa_jack.c were required. I could split those off to another PR if that is desired. Let's get this merged.

@Be-ing Be-ing force-pushed the cmake_rewrite branch 2 times, most recently from 931af4b to ba369c8 Compare August 4, 2021 17:01
@RossBencina
Copy link
Collaborator

RossBencina commented Aug 5, 2021

@Be-ing wrote:

A few tiny changes to pa_jack.c were required. I could split those off to another PR if that is desired.

Yes, please remove all of your changes to the src/ subtree (e.g. src/hostapi/jack/pa_jack.c and others). This PR is a cmake rewrite and should not include any changes to src or other non-related files. Such changes should be in a separate (later) PR.

Last week I asked you to not make any more (unrequested) changes to the PR. Now you have made further changes. In order for us to converge we need the code to be stabilised, not to have continual unrequested revisions. Phil and I have spent the majority of our limited time for the past several months dealing with your revisions to this PR. This has gone far enough. Please do not make unrequested changes again.

@philburk
Copy link
Collaborator

philburk commented Aug 5, 2021

+1 to what Ross said. It is very important that PRs have a minimal set of changes and that the changes slow down and then stop when we get close to merging. Having an overly large PR that keeps changing makes it impossible to converge. It is much easier to merge multiple small PRs than one large one.

@Be-ing
Copy link
Collaborator Author

Be-ing commented Aug 5, 2021

Yes, please remove all of your changes to the src/ subtree (e.g. src/hostapi/jack/pa_jack.c and others).

Done.

Last week I asked you to not make any more (unrequested) changes to the PR.

You did indeed and I apologize for not listening to that. I should have started the recent work on a new branch. The recent changes are in the cmake/Find****.cmake modules; the main CMakeLists.txt has not substantially changed.

@philburk
Copy link
Collaborator

@Be-ing - it is merged! Yay! Thanks for this great contribution and for persevering through the lengthy review process.

@Be-ing Be-ing deleted the cmake_rewrite branch August 12, 2021 03:16
@Be-ing Be-ing restored the cmake_rewrite branch August 12, 2021 03:16
@Be-ing
Copy link
Collaborator Author

Be-ing commented Aug 12, 2021

Yay! Could you make the separate Git repository for the C++ bindings so I can get CMake working with those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-cmake CMake build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.