-
Notifications
You must be signed in to change notification settings - Fork 91
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
Creating an improved CMakeLists.txt file #44
Comments
Looks good to me so far. Will propaply take Some days because of some work related stress at the moment but it will be done. |
Hopefully stress isn't too bad. Sounds good that this will get done. No need to hurry with this, especially since I will be focusing on writing a paper for the next two weeks. When the paper is finished I will try to create a more comprehensive plan for updating uvgRTP based on what has been said thus far so there is common understanding where the project is headed. |
I'm sorry, I didn't communicate this earlier, but 3b5acb7 contains (mostly untested) implementation for the subfolder include move. I needed it for my example improvements. |
yeah, the merge was a bit of a mess ;-)... But I get why you cannot simply hold still until I finish this task. |
@db-tech Sorry about that, I should have asked first. I could have maybe focused on some other task first than the examples. This week I will be focusing only on the examples and fixing them. Apart from maybe a small change to lib.hh, there should be no modifications outside the examples. I also have some school work I should be doing. |
@polusto don't worry... it may have sounded worse that I meant it to be. Not that big a deal :-) I have another question. Those are the options as I see them at this moment:
Maybe you have some other Ideas ? it can also be a combination of things !? |
First of all, any improvement compared to current version are accepted. If some parts seem too much work, feel free to omit them. We had a short discussion on this matter and the consensus was that the best way to do this would be to a mix of 1 and 3. We would want users who use uvgRTP outside of Git to have some kind of version, but if they use git version, it would be nice to also see the commit hash they are using so fixing their issues becomes easier. Also it would be nice to have the date of the commit/version visible if possible. This would mean having the version in CMake, but also using some sort of method for getting the current hash and date from Git if it is available. We also utilize tags in git, which could be used to remove hash from those that match exactly the version tag. It would probably be nice to have an API call in lib.hh to ask for version and also print the version when using the library for the first time (or maybe somewhere like creating session). So something like Git (exact release version): Non-Git: There may still be some improvements that could be made, but this is my first suggestion. |
@db-tech thank you for the question by the way |
We are currently working on it and we have some discussions about the Non-Git part. Also, I am not sure how the releases should work here in general and with github. The CMake stuff should be pretty simple, I just need some more information. |
The first scenario that comes to mind for non-git uvgRTP is Linux distributions adopting uvgRTP, where they don't include the git tree in their distributions. but a version should exist.
With the release thingy (not that important feature, just adds extra clarity where available) I was talking about just using git tags if it exists for current commit. With GitHub we usually push a tag to repo and then create the release in GitHub connected to that tag. Github has no part in this versioning and this feature would not work if the repo does not have the tags.
That would be probably be useful. @fador has mostly handled these sorts of things for us so far. He setup CircleCi to automatically test at least the newest branch of master. We also have some plans to test uvgRTP more extensively using Github Actions using our own server, but with all these we have to take care that no mining can occur with outside branches.
Git tags? I probably wouldn't mix outside build systems like Github actions with setting release flag on or something although I guess it could be done.
Honestly, everything is currently done manually since we haven't had that many releases :D
Thank you for making uvgRTP better! |
Also, I totally forgot the Qt project from my considerations (which is somehow still a supported build system). There probably should be at least some version present there as well. Maybe we can handle that separately after the CMake solution works. Maybe as a first solution could be that if none of the presented methods works, uvgRTP would print |
Not sue what you mean by that. Delivered Packages would contain the binaries and includes, not the source. So this would of course be versioned anyway. But maybe we just talk past each other :-/ Nonetheless.. I will push what I have so far sometime this evening, so you can take a look. |
You are probably right, maybe it would be possible to just set the variable build time and use that in this case. Another case that came into mind is the download source button in GitHub release (or download ZIP in front page on GitHub) that does not contain the git version history, although I don't know how popular that way of building uvgRTP is. What I'm maybe trying to say that it is possible that uvgRTP source code exists without git and that should do something functional, even if it is not the typical usage scenario. This can be handled afterwards also and for now a version in CMake file would be enough. As for pushing code, whatever suits you best. I'll probably start my vacation in August, but we can have a call before that if needed. I'm not in a hurry with this branch, since I have plenty to do before my vacation already and I will most likely not complete everything in any case. For example, I should also probably take a look at RTCP since it is causing problems for users. |
Hi, I am back from my vacation and back to the CMake stuff. I've pushed a version on my fork (https://github.com/db-tech/uvgRTP/tree/newCmakeVersion) that is still work in progress, but should be enough to get a rough understanding where I meant to go with this. Now I will add some description about the CMake internals and the intend behind it. CMakeLists.txt1: 3.12 has some nice features I would like to have. But I would also suggest to not fall behind the newest versions to much, because CMake can simply be downloaded and built. 10: Creates an external file for project details, e.g. version, so if we change the version, we do not have changes in the CMakeLists.txt 17: I usually use an external cmake file for the dependency stuff (More details later) 18: This file is responsible for creating in source access to the versions (More details later) 22: Setting the versions of the library itself. This will use the version set in in the project and (if available) the git hash. As I said, this is not the final implementation and I would like to talk to you guys before going any further.
Or if the git repo is available:
68: Here I added the headers as requested. Of course that might change soon because of changes of header visibility and placement, but for now this should be fine. 93: Adding the dependencies. Here I added the version library, but more on that later 100: Defining included directories dependent on the type of usage 106-110: Some compiler features, I googled to find useful stuff for windows, for linux that should be fine. I would suggest to add the "-Werror" at some point, but that is not possible at this moment because there are to many issues in the source at the moment. 116: Should meet the same requirements as before but removed necessary lines 126: add test directory. For now, I just created an example test case testing the versioning library. That is of course just a showcase of how to simply create unit tests. Installation (132-189)132: Here the installation stuff begins. First, I added GNUInstallDirs for some useful variables 133: Set the Installation properties of the library. This should work in linux and Windows but is still missing mac-os specifics. I can add that later! 145: collect the header files that should be installed 152: This will create a cmake version file that can later be used to uses versions in find_package(...VERSION...) 158: This will create a target file directly to the build tree. This can be useful for example, if uvgrtp us used in a sub-build for another system 164: Create/Copy a Config.cmake file to the install directory to add the external dependencies (e.g. THREADS). Still work in progress but should work so far. 170: Added the MAcros file just for completeness, it's empty for now. 179: Now we create and export the "...Targets.cmake" file and Define the namespace uvgrtp:: that can than be used in add_link_libraries().. (example at the end) 185: install the ...Config.cmake, ...Macros.cmake and the ...ConfigVersion.cmake file that cmake will create for us FindDependencies.cmake4-6: Use Cmake to find the available threading library 11: finding git. We have to discuss if we want this to be a requirement or not and what the resulting actions should be. 16-30: Fetch GTest if this is not found. At the moment, the Gtest will be downloaded and the tests will be added in any case. It might be better to have a build option to disable/enable testing for users. Versioning.cmake1-15: creating the short-hash version part. atm, This only happens if git was found and git repo is available 17: Here we copy the replace file of rtp_version.cpp.in with rtp_version.cpp and replace all the version details at build time. Installation example (Linux only)So in order to install the library you can just do
If we then want to use THIS installation in our cmake project we could to something like this: CMakeLists.txt
main.cpp#include <uvgrtp/lib.hh>
int main()
{
uvgrtp::context ctx;
return 0;
} We just have to define the directory where the cmake uvgrtpTargets.cmake is installed in the cmake command line
Still missing/open points:
|
@db-tech Thank you for this branch. I sent you an email about a possible meeting. There are few minor changes that I would like to discuss. We can discuss them in the meeting or I can add them here if you prefer. In any case, great work. This is a great step in uvgRTP development. |
Hi there, i have an additional question about the versioning. Would you like to have the git hash as a default? then we could add a cmake parameter for releases e.g.: Or would you rather like to omit the hash by default and add this likewise with a cmake parameter, e.g.: Or any other ideas ? |
I would have the hash there by default, then have the release parameter add text "release" somewhere to make it feel special and distinguish it from not having git at all. So something like: Git with hash: Release: No Git: Not sure about the best way to format the lines. |
Primary changes are: - Versioning integrated in cmake build system with library for version usage in end user programs - New minimum CMAke required version is 3.14 - Created install capabilities. Allows uvgRTP to be used in different scenarios for win and lin (mac-os still missing) - Added testing environment with automatically fetched google test and some example test code. - Added packaging capabilities (and some placeholders that have to be changed)
So, at last I've added some packaging functionality. PR is open. I've could had added more features, but thought it would be better to keep it that way for know and add stuff later (like the static code analysis) I did left some files empty to be filled by you guys (like some packaging files Description.txt, Licence.txt....) |
Primary changes are: - Versioning integrated in cmake build system with library for version usage in end user programs - New minimum CMAke required version is 3.14 - Created install capabilities. Allows uvgRTP to be used in different scenarios for win and lin (mac-os still missing) - Added testing environment with automatically fetched google test and some example test code. - Added packaging capabilities (and some placeholders that have to be changed) - Create Shared library with -DBUILD_SHARED_LIBS=TRUE
build: Completely Redesigned CMake files (#44)
I get the following error when trying to generate using CMake on windows: CMake Error at CMakeLists.txt:21 (set_target_properties): |
This issue is a compilation of all improvements suggested for current CMakeLists.txt file. Having all the issues collected under one issue makes managing changes easier and issue list of uvgRTP clearer.
Existing unresolved issues:
Additional suggestions:
@db-tech has expressed interest in doing a first draft of the file. This would be greatly appreciated. I'm not currently working on any of there, but if there is anything I can do to help, feel free to ask me. I'm only starting to learn CMake.
Also if someone has further improvement ideas, mention them in the comments and I can add them this issue. These improvements can be made in small patches or in one big file change. Whatever suits best. Additional improvements in file are also welcome as long as they don't unnecessarily complicate the usage of uvgRTP or CMakeLists file.
The text was updated successfully, but these errors were encountered: