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

Add CMake buildfile. #3

Merged
merged 7 commits into from
Apr 11, 2014
Merged

Add CMake buildfile. #3

merged 7 commits into from
Apr 11, 2014

Conversation

berkus
Copy link
Contributor

@berkus berkus commented Feb 3, 2014

Very simple CMakeLists.txt to allow building librtaudio.a with cmake.

@garyscavone
Copy link
Contributor

Hi Berkus,

I don’t know that much about CMake … I’ve never used it. What does one need to use it? The file you submitted is pretty minimal. I guess that only compiles a library (not the test files) and it currently defaults to Linux: Pulse Audio; Windows: DirectSound; Apple: CoreAudio? How could it be made to easily allow a user to specify the OS / API they want to compile?

Regards,

—gary

On Feb 2, 2014, at 7:25 PM, Berkus Decker notifications@github.com wrote:

Very simple CMakeLists.txt to allow building librtaudio.a with cmake.

You can merge this Pull Request by running

git pull https://github.com/berkus/rtaudio master
Or view, comment on, or merge it at:

#3

Commit Summary

• Add CMake buildfile.
File Changes

• A CMakeLists.txt (17)
Patch Links:

https://github.com/thestk/rtaudio/pull/3.patch
https://github.com/thestk/rtaudio/pull/3.diff

Reply to this email directly or view it on GitHub.

@berkus
Copy link
Contributor Author

berkus commented Feb 4, 2014

Hi Gary,

the included file is indeed minimal, I'm using it to build inside my build of MettaNode, which uses RtAudio for sound i/o.
It should automatically pick the defaults you said for given platforms (which it also should detect automatically).
It is easy to extend the detection with more checks and enable things conditionally, I can extend it later with that too.
It will work in parallel with existing build methods (makefile and or VS projects), but you can later use it to generate them as well (it could create VS, Xcode, Makefile, ninja, CodeBlocks, Eclipse and some more esoteric build outputs from single CMake file).
To try it out:

mkdir _build_
cd _build_
cmake <path to CMakeLists.txt usually two dots> e.g. cmake ..

it will generate whatever type of build system is default on your platform (Makefile on Linux, VS project on Windows, Xcode or Makefiles on OSX). You can force particular type of output using -G option (e.g. -G "Ninja").

I can add some options to allow manual specification of APIs to build in the next patch, but CMake is powerful enough to detect most of the supported stuff automatically (except for perhaps ASIO drivers).
I will also add building test program.

I will submit next patch soon.

@berkus
Copy link
Contributor Author

berkus commented Feb 4, 2014

These commits add

  • proper cmake prologue for standalone project files
  • options for choosing an API (-DAUDIO_WINDOWS_ASIO=ON argument to cmake for example, you could also just click the checkboxes in cmake-gui and re-generate)
  • build programs under tests/, only if CTest enabled or if manually enabled by -DBUILD_TESTING=ON
  • Tries to closely mimic the configure.ac behavior

@berkus
Copy link
Contributor Author

berkus commented Feb 4, 2014

I haven't tested on some platforms I don't have (Windows and NetBSD), the rest should work ok.

If you have some sort of CI, would be nice to run it through a test.

@berkus
Copy link
Contributor Author

berkus commented Feb 7, 2014

Ping?

@garyscavone
Copy link
Contributor

Hi Berkus,

If you are wondering whether I plan to include the CMake buildfile, the answer is that it may take some time before I can consider it. As well, it isn’t complete because it doesn’t build the test programs. My OS-X system doesn’t have cmake installed, so I can’t do a quick test and it could be a month or more before I have time to do careful tests on other OSes.

In general, we already have a make system working and my goal with these software projects is to minimize my support time, so adding yet another component that needs support over time is not really helping.

—gary

On Feb 7, 2014, at 2:17 AM, Berkus Decker notifications@github.com wrote:

Ping?


Reply to this email directly or view it on GitHub.

@berkus
Copy link
Contributor Author

berkus commented Feb 7, 2014

  1. It does build test programs (-DBUILD_TESTING=ON or just build for debug)
  2. brew install cmake takes only a moment on OSX
  3. I can support that one as it's the only build system I'm using.

No pressure.

@garyscavone
Copy link
Contributor

I checked it on Windows and it works fine for VS. I didn't have luck with MinGW but that may be a problem in my setup.

garyscavone added a commit that referenced this pull request Apr 11, 2014
@garyscavone garyscavone merged commit 17613bf into thestk:master Apr 11, 2014
@radarsat1
Copy link
Contributor

@derkus can you check #77 please?

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

Successfully merging this pull request may close these issues.

None yet

3 participants