-
Notifications
You must be signed in to change notification settings - Fork 64
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
adding Cmake functionality #255
Conversation
the examples build is currently OSX only. I need to add some parts of RTAudio buildsystem to configure this correctly. the lib itself should build without problems. |
Awesome! On Thu, Jan 29, 2015 at 2:23 AM, andik notifications@github.com wrote:
Morgan Packard |
@andik I have no doubt that this is a great enhancement to the workflow. However, relying on cmake rather than XCode or Visual Studio for compilation is a pretty major change in workflow for me and everyone else using Tonic. If this is intended to be a replacement for compiling with XCode/Visual studio, we'll need to consider this PR very carefully. |
Huh? Doesn't CMake generate Visual Studio projects on Windows by default? |
In order for CMake to succeed I had to change this line: string(REGEX REPLACE ".*\\" "" testname "${filename}" ) To this: string(REGEX REPLACE ".*\\\\" "" testname "${filename}" ) After that,
So there's still some issues with the I opened
So, at least it builds. |
@LB-- Thanks for taking a look. |
added a commit @LB-- Windows should theoretically work now. I also removed that "main" target... |
@morganpackard ah and for XCode Projects do
|
ok, looks like the warnings will stay until -wmost is manually removed from the xcode build settings... this is awkward, but built in cmake XCode Generator... |
Something is still a little off with the CMake scripts:
It still generated though, so I tried building again. ...interesting. Probably because of the weird errors during the CMake generator. Something's definitely worse, though, because this time the build failed. When I have more time later I might try to resolve some issues myself but as I am new to the project I don't know what state everything is in. |
It doesn't find the topic lib, But Xcode does. @LB-- Could you please do a |
Tested in my lunchbreak at work... my installed old Visual Studio doesn't compile Tonic at all... so I cannot verify anything. But I did not have these Write errors you had. May be some IO Issue not related to CMake? Maybe you should remove you whole build folder and try again? please use a Subfolder... What I did change was using the built Tonic Lib instead of Object files in the example... sorry to say, that I will not be available over the weekend. My girfriend visits me (mostly every weekend) and I'd rather look at her pretty face than my screen ^^ |
Maybe a six-minute video of what I am doing would help? |
Thank yo so much for pointing this out. Interesting way to share what you're dong. Could you please change that to SampleTable loadAudioFile(string path, int numChannels){
Tonic::error("loadAudioFile is currently only implemented for Apple platforms.", true);
return NULL;
} and try to build again? |
Sorry for misleading you. I just didn't think enough before writing ... Could you please look in the solition if
is defined? It defines the driver which rtaudio us using. Your log shows that rtaudio is used but somehow it's not. |
I mean if it is defined for the standalone project |
okay, while this is at it should be, it's not getting easier ^^.
thanks you for helping me out.... In the meantime I have updated the cmakelists a little and most important, found a way to diable the xcode warning mess. (some useless warnings still remaining, but i'll fix that later...) |
I didn't try https://github.com/andik/Tonic/commit/fb703e7f380f22900233eb9fb059a1934710317b because it didn't look like it would change anything of importance (I can if you want me to, I just have to re-patch that Using the |
yep, I did forgot to used the RTAudio Liblist, sorry. If you're still willing to test this out, you should download the complete package. the patch you did is included. It did compile under mingw, but without the standalone demo as I have no directX installed. other methods are currently not working. (the RTAudio libs in tonic are older than the cmake file I used and do not support WSAPI, thats why the example was not working...) |
I'd like to give this a try which directory do I run the cmake command On Mon, Feb 2, 2015 at 2:41 PM, andik notifications@github.com wrote:
Morgan Packard |
In the root directory create a folder with any name and just run |
I"m seeing references to LazySampleTable.cpp in the xcode project. I think Also, please be patient with me. I'd like to look over all of these changes On Mon, Feb 2, 2015 at 3:43 PM, Morgan Packard morgan@morganpackard.com
Morgan Packard |
@@ -14,9 +14,9 @@ | |||
namespace Tonic { | |||
namespace Tonic_ { | |||
|
|||
PinkNoise_::PinkNoise_() : pinkCount_(1), pinkAccum_(0) { | |||
PinkNoise_::PinkNoise_() :pinkAccum_(0), pinkCount_(1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andik Would you mind explaining the purpose of this change and the other similar changes, where the initilizer lists are reordered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some compilers issue warnings when the initalizer lists are not in the same order as the class members' declarations. This is because in C++ members are always initialized in the order they are declared, regardless of the order they appear in initializer lists.
really, 100bpm is quite fast, how should your heart handle such speeds... Well, I'm really sorry, I wrote a sampletable which can be loaded from a file before switching to the cmake case. I didn't use a clean branch. the issues in standalone main, xcode proj and the sampletable are from that. I'll try to use old versions for them. |
@@ -91,7 +91,7 @@ namespace Tonic { | |||
|
|||
SampleTable loadAudioFile(string path, int numChannels){ | |||
Tonic::error("loadAudioFile is currently only implemented for Apple platforms."); | |||
return NULL; | |||
return SampleTable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NULL is defined ((void*) 0) in Windows. This is of course a compiler error. If we return an empty buffer instead, we also avoid the crashing of the app which calls loadAudioFile().
@morganpackard |
@andik Thank you SO much for putting this together. I don't ever work in Windows so it's difficult for me to verify anything that affects Windows builds, but I trust your and @morganpackard's judgement on the validity of everything in here. FWIW code changes made to reduce warnings are always welcome in my book. |
@@ -0,0 +1,9 @@ | |||
#include directories helps to include header files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not crazy about adding a non-source file to a directory called "src". Is there any way this file can be moved, so that we can keep the src
directory pristine?
Hey @andik. Thanks for answering my questions about your edits, and resolving that xcode project issue. Now, on to my next annoying question: How do you propose we as library developers, and everyone who is an end user of Tonic actually use this cmake setup? The value I see in using CMake is that we wouldn't have to manually maintain three separate IDE projects evey time we add a file. The system you've set up doesn't seem to be designed to actually replace the existing xcode and visual studio project. If your main motivation for getting cmake running is so that you can create cross-platform, that's great, and I fully support that direction Basically, I support anything you choose for setting up cross-platform tests. I'll just be really grateful to have them in any form. If the idea with cmake is that every time someone adds a new file to the project, it gets easily incorporated into the projects for all the other platforms, I'm not sure we have a useable system in place yet. Another thing -- is there a way we can avoid adding the cmake file to the |
I know I'm not the target of your questions, but I'd like to throw in my thoughts too. What I see with most projects is that the repo only has the CMake files and no IDE-specific project files. People who work on the library keep their own customized IDE projects local to their hard drives. This way everyone gets their way and anyone can build the project. As for the location and number of For easily adding and removing files, you can have CMake just grab all files that match a pattern, but this is generally discouraged by the CMake community because CMake will not detect that you have added or removed files until you clear the cache and run CMake again. The way CMake knows to run itself again is by checking for changes on the This is an example project where addition and removal of source files does not require editing https://github.com/cpluspluscom/ChessPlusPlus/blob/master/CMakeLists.txt#L25-L27 Note however that, addition and removal of files requires re-running the CMake command. For small projects this is fine but it can be annoying if it takes a long time to run and you are frequently adding/removing files. |
Thanks @LB--. It looks to me like @andik set the cmake stuff up so that it automatically adds files, which I like. Tonic is pretty small. I don't see running cmake when adding a file as a big deal. I don't want to require end users to use cmake. I definitely want to keep the individual IDE projects in the repository, so people can just fire up xcode or visual studio and be up and running quickly. I'd definitely be interested in trying an approach which requires Tonic developers to use cmake (when adding or removing or moving files), but which doesn't require Tonic users to use it. |
Adding my two cents: CMake can be great for the end-user, especially when a library is large and complicated (e.g. Boost.) I think there's less value for end-users for a small library like Tonic that's intended to be incorporated as source library. I think focusing the CMake implementation initially around the developer workflow, and replacing the existing platform-specific solution files, would be great. I know I've been holding back on merging the polysynth example into master because of fuzziness around how we want to organize the cross-platform project files for example projects. Using the CMake shift as an opportunity to get a consistent plan together would be awesome. |
I primarily saw cmake as an easy way to start with Tonic. One runs cmake and immediately is able to test the example out. Then he can copy the library into his project. I thought about it a little like openframeworks because that was the way I started to learn Tonic. That's the way I designed the cmake system. @Dewb @morganpackard I'm completely open to all wishes, changes and improvements you have for the cmake system. Maybe we can find a solution which makes an easy start and easy development. Until then we can stall this PR. I'm not in a hurry anymore. |
I was able to run the cmake stuff successfully on windows. I just tried building using cmake on my mac and got the following errors:
I'm on the branch andik/development. Any idea what the issue is? |
I'd be very wary of adding any additional complications/steps for a new user to use Tonic (see my error above). But if we can get a cmake workflow that works smoothly for Tonic developers, I'd be in favor of adopting that, and not editing individual platform project files by hand any more. Thanks for the two cents @Dewb. I completely agree. |
@morganpackard I completely agree with you. But in fact I guess that a lot of people are quite familar with cmake, but providing them additional Makefiles/Xcode Projects etc. is a good Idea, I think. would you try again, I gues I know the Issue, but I'm not sure, see the diff to see what may be wrong... |
@morganpackard looks like something is weird with how the "-framework XXX" statements are being concatenated and escaped. Using this approach for OSX framework includes might be a better strategy: http://www.cmake.org/Wiki/CMake:HowToUseExistingOSXFrameworks |
@Dewb Looks like @andik resolved the issue I was having I suspect he meant "superfluous", rather than "superfluid", but I really like the idea of "superfluid quotes"!. |
Oops, I didn't see the change. Yeah, that fix makes total sense. I also love the idea of superfluidity in punctuation! |
I close this because of #264 will bring this too, and I need my development branch .... |
added CMakelists based on https://github.com/arunoda/cmake-boilerplate.
mkdir _build cd _build cmake .. make
will compile the lib and the standalone example, no iOS yet