Skip to content
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

build: Completely Redesigned CMake files (#44) #68

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

db-tech
Copy link

@db-tech db-tech commented Aug 8, 2021

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)

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
@db-tech
Copy link
Author

db-tech commented Aug 8, 2021

Force pushed a small change so the default library created will be static.
So I guess it is recommended to add -DBUILD_SHARED_LIBS=YES when creating any packages.

We could talk about creating both or changing de default, but for now I would just keep it that way

@jrsnen jrsnen linked an issue Aug 9, 2021 that may be closed by this pull request
7 tasks
@jrsnen jrsnen added this to the Release 2.1 milestone Aug 9, 2021
@db-tech
Copy link
Author

db-tech commented Aug 15, 2021

What is the state of this, are there any problems I should address ?

@jrsnen
Copy link
Member

jrsnen commented Aug 16, 2021

It seems no one else has time to address this and if so, I will take look at this next week when I get back from holiday. I will read the code and try running most of the use cases on Windows and Linux. Expect results somewhere between Tuesday and Thursday next week. I can fix minor issues if any are present after accepting this PR.

Thank you again for this PR!

@jrsnen jrsnen self-requested a review August 24, 2021 09:30
@jrsnen
Copy link
Member

jrsnen commented Aug 24, 2021

Tested compilation on windows and did not encounter any problems. I will do more testing tomorrow and merge this if I don't encounter any major problems.

@jrsnen jrsnen added the safe to test Run tests on CI label Aug 25, 2021
@jrsnen
Copy link
Member

jrsnen commented Aug 25, 2021

Couple of points that I would like to ask/mention, but there is no need to change anything:

What are those packaging placeholders? I'm assuming they are for creating packages. Should we copy the existing license and readme there?

Can uvgRTP_version.hh be just version.hh? I might also change the function names since the namespace already defines uvgrtp. To me it seems a bit excessive to have uvgrtp be twice in file or function path. I can do this after merging.

I noticed that there used to be possibility for specifying the Crypto++ library location. I have never tested it (also I don't think uvgRTP needs the static library, just the includes). It would be useful on windows to be able to specify the location of crypto++ since now it has to be done manually in msvc configuration. However, this would be complicated by the fact that uvgRTP uses includes in format crypto/header this requires that the specified folder is parent of crypto.

I tested building the shared library of uvgRTP on windows. The building went well, but if I remember correctly, some kind of dll declarations need to be added to uvgRTP for windows in order for the linker to find the functions with DLL. Kvazaar uses __declspec. This can be addressed in future commits since it isn't related to build system.

I couldn't figure out how to link Crypto++ to shared uvgrtp on Windows. I know that it is not recommended to use shared version of Crypto++, but I suspect it may be required when using shared version of uvgRTP. I didn't want to spend too much time on this.

Overall, a very nice commit. I will merge this tomorrow as is since it is a clear improvement on existing uvgRTP without losing any features.

jrsnen
jrsnen previously requested changes Aug 26, 2021
Copy link
Member

@jrsnen jrsnen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Thanks again for this great PR. This is my full review and there is only one issue that needs fixing.

Could you fix the versioning in this? Currently, the correct version is 2.0.1. I tried packaging uvgRTP but the name of the package ended up being Project-0.1.1 when it should be something like uvgRTP-2.0.1. This is a bit too large of an issue for me to merge this. Alternatively, this feature can be left out and implemented later.

The problem seems to be that there are many different variables used for versions and some of them are set and some of them are not. There are variables like PROJECT_VERSION_MAJOR and uvgrtp_VERSION_MAJOR, neither of which are set anywhere. I don't fully understand how this works in CMake, but currently the result is not correct.

Could you also change the names of files uvgrtp_version.cc/hh to just version.cc/hh? Also could you change functions get_uvgrtp_version()(major,minor,patch) to just get_version() since the uvgrtp is already present in namespace?

Minor issues that don't need fixing:

  • There were several issues with shared lib on Windows, but those can be fixed later if needed. The static lib works as well as before.
  • The pedantic parameter causes lots of warnings from Crypto++ headers

Building the tests worked fine.

If you'll fix the base of versioning to work, I will merge this. I can then start tuning details to my liking, document the features and make a release.

Thanks again.

@db-tech
Copy link
Author

db-tech commented Aug 27, 2021

What are those packaging placeholders? I'm assuming they are for creating packages. Should we copy the existing license and readme there?

Those will be put into the packages (e.g. the dpkg package).
Yes, the existing stuff might be fine here.

Can uvgRTP_version.hh be just version.hh?
sure thing, or version.h ;-)

I might also change the function names since the namespace already defines uvgrtp. To me it seems a bit excessive to have uvgrtp be twice in file or function path. I can do this after merging.

yeah, I agree

I noticed that there used to be possibility for specifying the Crypto++ library location. I have never tested it (also I don't think uvgRTP needs the static library, just the includes). It would be useful on windows to be able to specify the location of crypto++ since now it has to be done manually in msvc configuration. However, this would be complicated by the fact that uvgRTP uses includes in format crypto/header this requires that the specified folder is parent of crypto.

There was a variable LIBRARY_PATHS but in the master branch I was working on, this variable was never used, so I assumed that this is not necessary anymore. I could create a CMake find file so we could use find_package for that, but I would rather do that after the merge

I couldn't figure out how to link Crypto++ to shared uvgrtp on Windows. I know that it is not recommended to use shared version of Crypto++, but I suspect it may be required when using shared version of uvgRTP. I didn't want to spend too much time on this.

Again, that could simply be done by a "Cmake find" file for Crypto++. I can help you with that. That can even be done so it works on Linux,Windows and Mac-OS

Could you fix the versioning in this? Currently, the correct version is 2.0.1. I tried packaging uvgRTP but the name of the package ended up being Project-0.1.1 when it should be something like uvgRTP-2.0.1. This is a bit too large of an issue for me to merge this. Alternatively, this feature can be left out and implemented later.

That is strange. I've testet this on windows and linux. The version I've used in that PR is 2.0.0. Are you sure you testet the correct branch ? (unfortunately I have a lot of similar sounding branch names :-/ )

What package under what OS did you test here ? I've testet debian and some kind of windows installer, but there are a lot more that "should" work.

The problem seems to be that there are many different variables used for versions and some of them are set and some of them are not. There are variables like PROJECT_VERSION_MAJOR and uvgrtp_VERSION_MAJOR, neither of which are set anywhere. I don't fully understand how this works in CMake, but currently the result is not correct.

PROJECT_VERSION_MAJOR: Defined HERE

uvgrtp_VERSION_MAJOR: Those are also set by cmake HERE

@jrsnen
Copy link
Member

jrsnen commented Aug 27, 2021

What are those packaging placeholders? I'm assuming they are for creating packages. Should we copy the existing license and readme there?

Those will be put into the packages (e.g. the dpkg package).
Yes, the existing stuff might be fine here.

Ok, I can do that after merging.

Can uvgRTP_version.hh be just version.hh?
sure thing, or version.h ;-)

I might also change the function names since the namespace already defines uvgrtp. To me it seems a bit excessive to have uvgrtp be twice in file or function path. I can do this after merging.

yeah, I agree

I noticed that there used to be possibility for specifying the Crypto++ library location. I have never tested it (also I don't think uvgRTP needs the static library, just the includes). It would be useful on windows to be able to specify the location of crypto++ since now it has to be done manually in msvc configuration. However, this would be complicated by the fact that uvgRTP uses includes in format crypto/header this requires that the specified folder is parent of crypto.

There was a variable LIBRARY_PATHS but in the master branch I was working on, this variable was never used, so I assumed that this is not necessary anymore. I could create a CMake find file so we could use find_package for that, but I would rather do that after the merge

Currently, I add Crypto++ manually to Visual Studio (as shown in the instructions :p). Not sure what is the best way to do this.

I couldn't figure out how to link Crypto++ to shared uvgrtp on Windows. I know that it is not recommended to use shared version of Crypto++, but I suspect it may be required when using shared version of uvgRTP. I didn't want to spend too much time on this.

Again, that could simply be done by a "Cmake find" file for Crypto++. I can help you with that. That can even be done so it works on Linux,Windows and Mac-OS

I simply meant that there were linking errors when I tried to add it. Not specifically related to CMake, but something that relates to conversation on whether shared should be default. It is possible I was linking to a wrong version of Crypto++ or something.

Could you fix the versioning in this? Currently, the correct version is 2.0.1. I tried packaging uvgRTP but the name of the package ended up being Project-0.1.1 when it should be something like uvgRTP-2.0.1. This is a bit too large of an issue for me to merge this. Alternatively, this feature can be left out and implemented later.

That is strange. I've testet this on windows and linux. The version I've used in that PR is 2.0.0. Are you sure you testet the correct branch ? (unfortunately I have a lot of similar sounding branch names :-/ )

I retested this again, and now it seems to produce the correct result. Maybe this was just an error on my part. I will do a bit more testing next week, but it seems the current situation is acceptable.

What package under what OS did you test here ? I've testet debian and some kind of windows installer, but there are a lot more that "should" work.

I just run cpack on Linux after cmake and see what comes out. Now it produces something with correct names. I have no idea what was the problem last time.

The problem seems to be that there are many different variables used for versions and some of them are set and some of them are not. There are variables like PROJECT_VERSION_MAJOR and uvgrtp_VERSION_MAJOR, neither of which are set anywhere. I don't fully understand how this works in CMake, but currently the result is not correct.

PROJECT_VERSION_MAJOR: Defined HERE

uvgrtp_VERSION_MAJOR: Those are also set by cmake HERE

Ok, I was mistaken.

It seems the biggest mistake was on my part. I will do a small amount of testing next week if I can figure out what went wrong. There are no changes necessary, but you could change the version number and version file/function names if you would be so kind?

@jrsnen jrsnen self-requested a review August 27, 2021 13:52
@jrsnen jrsnen dismissed their stale review August 27, 2021 13:53

It seems it works now that I did the same thing a second time.

@jrsnen jrsnen merged commit c265fdb into ultravideo:master Aug 30, 2021
@jrsnen
Copy link
Member

jrsnen commented Aug 30, 2021

I merged this. Thanks a lot! I couldn't figure out what I did wrong. If it surfaces, we can address that later. I will now start prepping everything for a release.

@db-tech
Copy link
Author

db-tech commented Aug 30, 2021

Ah ok, thanks... I could have addresses those points of yours.. sorry, was pretty busy the last couple of days :-(

@jrsnen
Copy link
Member

jrsnen commented Aug 31, 2021

No problem, :) I didn't mean to steal your thunder! The version stuff was so small that I didn't feel it mattered who did it, I just suggested it if you had time. Other small issues can be fixed later if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test Run tests on CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating an improved CMakeLists.txt file
2 participants