-
Notifications
You must be signed in to change notification settings - Fork 24
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
Make snowhouse a CMake library #38
Conversation
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.
Thank you for your contribution.
If I get your point right, your changes make it easier for users to use Snowhouse as a library: although it is already easy because it's header only; user's shouldn't even care if it's header-only or not, they should just use target_link_libraries
and all the magic is done... Is that the point?
[Monologue start] I think the CMake configuration was basically intended for the tests (thus the defaults) and not for potential Snowhouse users. I have never considered before to change this... But if it simplifies things for users that way, let's do it, and I'd also be okay with that default changes. On the other hand, I know that CMake offers installation magic to use with find_library()... wouldn't that even be easier for the user? I am not sure. One is for having a system-wide installation and the other is for shipping snowhouse with your code... Probably your change is a start and the installation stuff is a nice-to-have feature. Both ways could be used by users complementarily... [Monologue end]
Besides my review commits in the diff, your pull request is missing documentation changes. If it is now easy to use snowhouse as a library, the users should get to know it.
Edit: I am very sorry, I was only looking at the diff of the first commit, not at the diff of the whole pull request. I am very tired at the moment and should have deferred the comments.
@@ -6,7 +6,7 @@ | |||
#ifndef SNOWHOUSE_COLLECTIONOPERATOR_H | |||
#define SNOWHOUSE_COLLECTIONOPERATOR_H | |||
|
|||
#include "../constraintoperator.h" | |||
#include "../../operators/constraintoperator.h" |
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.
Hu? What has happened here?
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.
Looks like the refactoring tool had a slight hiccup there. Both of those paths are equivalent. Sorry.
CMakeLists.txt
Outdated
@@ -55,3 +62,4 @@ if (SNOWHOUSE_BUILD_TESTS AND SNOWHOUSE_RUN_TESTS) | |||
elseif (SNOWHOUSE_RUN_TESTS) | |||
message(WARNING "Unable to run snowhouse tests - set:\n option(SNOWHOUSE_BUILD_TESTS, \"Build the Snowhouse tests\" ON)\nand clear your CMakeCache.txt") | |||
endif() | |||
|
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.
Please don't.
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 am not completely sure what am I supposed not to do.
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.
Adding an empty line :-)
By the way I'm wondering if the move of the files is a breaking change (because existing build configurations (i.e., include paths) must be changed)... That would mean Snowhouse has to advance to version 4.0.0. This is funny because it rather feels like a minor change leading to |
Sorry for the late replay, you've caught me on the way home from work... It depends on the way people actually include the library... I think that there is a way how to avoid bumping the version: since all paths in the #includes are relative to the snowhouse folder (now include/snowhouse) we could simply add a symlink pointing to that directory. |
To answer the first set of questions. Yep, making it easier to use the library in CMake projects was exactly my goal. I had to do these changes manually to make the library work with my current build setup seamlessly and so I thought that others might benefit from it as well. Find_library seems a little bit too complex because you have to deal with the paths to the library and since there is no make install or similar step, it might be quite difficult to write one that would be universal. Investing time into writing proper exported targets and CMake install steps would be more useful (but I am not sure whether it's actually worth it). |
cab1ce9
to
8f23480
Compare
The way I had thought about it before is that you do not add it to the CMake setup at all, you simply use the However, I can imagine that this is not the best choice for everyone. So it's nice to have this alternative. You wrote on the breaking change issue:
That's a solution I have also considered, however, a symlink is not portable (please remove it again). I'd rather bump the version. (Btw you don't have to make any changes regarding version or anything; that's my task. I just wanted an opinion.) You wrote on exported targets and
Yes, I also doubt that. I once did that for another project, a more complex library, and it seems there is a lot that you can miss and do wrong... so let's keep it simple. |
While at it, it would be nice if you do a |
Well, the difference here is that I acrtually want CMake to manage the paths for me so that I don't have to care where I had put the library: in your case I would have to include the snowhouse which is located in ../../third_party_libs_dir/snowhouse or something like that while in this case I can just say that I want snowhouse and if the actual path changes because I move it elsewhere, CMake fixes that itself.
Really? I use them in git projects regularly. I have actually created the link in Windows and pushed the repo from Linux (WSL) and it worked well in both but hey, you're the maintainer. Will remove it. |
README.md
Outdated
target_link_libraries(app snowhouse) | ||
``` | ||
|
||
|
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.
Again, I have very strong relational issues with empty lines. ;-) Please remove one of them.
This moves headers into a new include/ directory and turns off default running/building of tests. Document the CMake-based installation. Support for CMake < 3.0.0 is retained.
Adds CMake library target for snowhouse enabling importing the library to user CMake targets. Example follows.
Notes: