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: Update to Modern CMake usage #2230
Conversation
240ab07
to
9e6e905
Compare
| # if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list (all of them) | ||
| if(NOT GR_REQUIRED_COMPONENTS) | ||
| set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT) | ||
| 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.
Removing all of this was "just" a test, we shouldn't actually remove all of it for compatibility for at least 3.8.
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.
So will you be adding this back in for the actual PR once it's done?
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.
We need to discuss/think about how to handle "old" and "modern" CMake. Or if we just require for 3.8 that downstream libraries/packages have to use modern CMake.
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.
From what I've learned/read it's near impossible to support the old variable exporting approach with targets. Basically one would have to render all include paths embedded in exported targets during generation time of the GnuradioConfig.cmake. I can't seem to find a way of doing that.
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 would like to stick with the 3.5.1 CMake version we currently have on master.
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.
...unless this totally screws up this PR.
|
Well, looks like I need to point my things to the right volk commit (which is not yet in master)' |
|
OK, now builds and runs all tests. Due to rebasing the volk submodule on master with a hack commit on top it nows fails the |
|
This is definitely very much work-in-progress, so comments on everything / pointing out bugs and things to do is appreciated. It's basially compiling if the CMake version is new enough. |
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'll take changes I see even before testing. Mostly whitespace for now.
|
Oh, sure, if you can pass me the patch point out commits I can include/factor in, that would be great. The cmake I wrote is not very clean, whitespace-wise. |
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.
Lots of whitespace changes & guessing some I didn't catch; some changes I think should be in a different PR; nothing critical. All reads nicely & I love the code simplification & hierarchal nature of "modern CMake" and how you're using it here.
| INTERFACE_INCLUDE_DIRECTORIES "${MPLIB_INCLUDE_DIRS}" | ||
| INTERFACE_LINK_LIBRARIES "${MPLIB_LIBRARIES}" | ||
| ) | ||
| 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.
Do we have a style GREP for CMake? Some "endif()" statements are empty, while others replicate the "if()" section. I'd rather see consistency in commits, if we require it. If not then I prefer empty such as this one.
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 think we don't have a CMake style GREP or some other guide. Would be nice to nail it down to one definitve right solution.
| set_target_properties(Thrift::thrift PROPERTIES | ||
| INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIRS}" | ||
| INTERFACE_LINK_LIBRARIES "${THRIFT_LIBRARIES}" | ||
| ) |
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.
Do we have a style GREP for CMake? The trailing ")" here I think should be 2 spaces back to match the start character of "set_target_properties". Sometimes we do this and sometimes we don't, even in the code immediately preceding this addition.
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.
This has been bugging me as well, my editor is trying to align everything with two spaces.
| # if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list (all of them) | ||
| if(NOT GR_REQUIRED_COMPONENTS) | ||
| set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT) | ||
| 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.
So will you be adding this back in for the actual PR once it's done?
| if(NOT GR_REQUIRED_COMPONENTS) | ||
| set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT) | ||
| endif() | ||
| include(CMakeFindDependencyMacro) |
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 love how concise this file will be! Do we really need this "include" to get the new code working? All of the CMake commands like stock / normal, like they don't need any externally included special sauce. I won't know until I can test this whether it's actually required, but maybe you know?
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.
find_dependency apparently needs to include to work. For package config cmake files it's advised to use find_dependency instead of find_package since it's returns on failure and then stops processing.
|
Regarding the VOLK dependency: obviously, we'll have to update VOLK for 3.8, so, can you do a similar PR for your VOLK changes against gnuradio/volk? |
|
@marcusmueller yes, for volk Maitland already has send me & @n-west a path. I'll post it in a PR. |
953d02f
to
c5b76b7
Compare
|
The exported targets need to be created per component, with a generated whitelist during configuration. |
985f8e9
to
c6c2c85
Compare
0454bb1
to
2c8c117
Compare
|
Two key questions that came to my mind:
|
5747e3f
to
f6fee71
Compare
|
@skoslowski Now all component libraries (if I didn't forget any) are created with their "base" sources and additional sources are added with |
|
Awesome, great work |
|
@noc0lour in this mail you stated that modern cmake is not really a 3.8 feature because it did not get included as part of the feature freeze. Though, #2075 does essentially depend on your work here. As far as I can tell, updates to gr-modtool and by extension to fix #2075, depend on your work in order to make the OOT 3.8 transition as smooth as possible. |
|
@jdemel Ultimately it's not my call to make, also I couldn't promise it will be ready "on time". But after confering with @marcusmueller I'll add it to the 3.8 project for inclusion. |
|
Do we need CMake 3.8? @marcusmueller and I picked 3.5.1 because it's available in 16.04, which is still relevant. |
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.
Let's clean up history and merge. We probably have details to figure out which will become obvious after the merge, but that's OK.
|
Ignore my comment. I mixed up GR and CMake versions. |
|
@mbr0wn cmake 3.8 is still needed nonetheless. I had a offline chat with Marcus about that and he was OK with that iirc. |
|
Since Cmake 3.8 is required, maybe it should be set in the top level CMakeLists.txt? Otherwise, on Ubuntu 16.04 you get many "list does not recognize sub-command FILTER" errors that isn't as useful as just: |
2589932
to
c74a0f2
Compare
|
@mbr0wn there is not a lot to squash here, I think it would be best to use a explanatory merge commit.to have a single commit in the master branch but to preserve the logical structure of the changes. |
Previously lib/ was in the include path and thus the compiler was able to find `dvb/dvb_defines.h` in the path. Now it needs a relative path to be found as local include.
This updates the volk submodule to the point where volk switched to modern CMake with exported compile targets.
This includes using target based setting of includes and link libraries. This will transitively add the includes and linking flags to dependent targets. This is still a work in progress since only the dynamic libraries have been touched and not all of include_directories directives are gone yet. cmake: remove GR_INCLUDE_SUBDIRECTORY macro Previously this macro was used to inject subdirectories in the current CMake namespace. This is generally undesired and pollutes the current context. previously GNU Radio CMake had a non-default option ENABLE_STATIC_LIBS to build both, shared libraries and static libraries. This seems to be a construction taken over from autotools and serves no purpuose in CMake and complicates the library building. cmake: remove GR_LIBTOOL and la generation support This looks like it was primarily used to support projects using autotools, but comments state that the generated .la files aren't compatible with autotools anyway. cmake: Bump required CMake version to 3.8 UseSWIG cmake uses syntax which requires at least CMake 3.8 and is non-trivial to change
2b3d2af
to
6d7421a
Compare
This is still very much a work in progress. But the main parts are working (building libs & python bindings).
During the update some wrong includes (brackets instead of quotes) were found.
Static libs & swig building still needs some love.