-
Notifications
You must be signed in to change notification settings - Fork 47
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
[WIP] Move OpenQL to modern CMake practices #460
base: develop
Are you sure you want to change the base?
Conversation
Make targets more granular with well defined dependencies.
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 see several possibly parallel changes in this PR:
- CMakeList restructuring
- architecture+pass registration done statically
When those are independent or sequential, turn this into two PRs!
And furthermore:
- renames of files such as to ...l/ir/compat/include/ql/ir/compat/compat.h which I don't like because of the recurring 'ir/compat'.
- namespace updates for some reason
Is there a model behind this, is this documented?
I hope that Jeroen can review this in due time.
Regarding the move of the |
Good morning, Thanks for your messages. I think OpenQL has grown large enough that having a single CMake library target for the whole lib is no longer viable in my opinion.
I was using this kind of modern CMake files organization with my previous employer, a large codebase with around 20 developers. Later on we moved to use Bazel, another build system that goes even further in modularization and this kind of build system philosophy for large projects and helped with build times and organization and productivity immensely. One step towards this was modularization of the CMake build like in this PR. Some reference: To respond to some of your concerns:
Indeed that is a bit surprising at first, luckily IDEs fold the nested folders so navigation is not hindered. That's something CMake doesn't do too well (compared to e.g. Bazel which does symlinks at build time), but is the price to pay to have qualified header include paths (e.g. "ql/utils/map.h" instead of "map.h").
I intentionally moved them to the normal include folder because I didn't want those libraries to include their own folder (since some submodules are in subfolders of some other submodules). Personally I prefer qualified include paths also for private headers (e.g.
I certainly agree with splitting this in a separate PR. In fact, all the changes to C++ source files and headers can be reviewed separately and that will work with the previous CMakeLists.txt. I will do that.
That is also independent. I did that to avoid some unnecessary and unclear dependencies between CMake modules. |
The separate PR to move to self-registering passes and architectures: #461 |
I don't think I should still have much of a say in OpenQL stuff (if any); the way I see it, you're the maintainer now and therefore you should get to choose direction for maintenance :) But since I was asked;
I'm inclined to disagree with you on that. Since backends can be so different and OpenQL users are likely to be experimenting with compiler stuff, the idea was always that users should be able to register their own passes dynamically without having to fork and rebuild OpenQL. I haven't looked in detail at how you're suggesting to change pass registration, but I would hope that dynamic registration is still possible in addition. That being said; again, I don't think my opinion should matter much. Just be aware that it was a feature rather than an oversight, and thus that you might have to do some documentation updates to keep everything synchronized if you guys decide that maintaining that is not worth the effort.
I can confirm that this is just life with CMake, at least if you want to keep the CMake files even remotely comprehensible for mere mortals. For example, Apache Arrow manages to avoid it, but then there's these eleven thousand lines of code just for custom CMake support functions, not to mention that the compilation modules themselves are generally nontrivial. I don't really have much to add beyond that. I'd generally be in favor of more strict separation, as long as you actually manage to get CMake to comply. Just make sure that it actually works right on all supported platforms, and that CMake doesn't casually try to install things as generically named as |
Hi Jeroen and thanks a lot for your input!
(Maybe this has changed since you last worked on OpenQL, I'll see what Hans thinks) Otherwise I think we're on the same page concerning "tolerating" CMake haha |
Increase drastically the granularity of CMake targets