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

Improve cmake build system #90

Merged
merged 6 commits into from
Oct 31, 2018
Merged

Improve cmake build system #90

merged 6 commits into from
Oct 31, 2018

Conversation

Bjoe
Copy link
Contributor

@Bjoe Bjoe commented Oct 24, 2018

  • Cleanup cmake build system to best practices cmake practices #83 .
  • Easily import neopg project into any IDE/development environment
  • Add proper install target build or install broken on Ubuntu 18.04 #81 . Install headers and libs in a selected directory (via CMAKE_INSTALL_PREFIX)
  • Create a cmake config modul to easily import neopg to other cmake project via find_package(neopg)

I have following question:

  • It is correct that the "legacy" part should not exported/installed? See difference between 0f953d9 and 816152a
  • At the moment, libneopg-tool.a with the include headers from neopg-tool are exported/installed? Should I also remove this from the install/export target?

* Refactor/cleanup cmake build system
* Improve cmake install target
* Export targets for to include to other cmake build system
Add some additional information about cmake
Copy link
Contributor

@sphinxc0re sphinxc0re left a comment

Choose a reason for hiding this comment

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

First of all: Thank you for contributing to this project. We very much appreciate new members of the community. Secondly, this PR seems way too big. Could you possibly split this up into multiple PRs?

The code looks pretty good to me, but I still have some regards.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@das-labor das-labor deleted a comment from mmlb Oct 26, 2018
@Bjoe
Copy link
Contributor Author

Bjoe commented Oct 26, 2018

Secondly, this PR seems way too big. Could you possibly split this up into multiple PRs?

Unfortunately, yes the PR is big. The effort will be increase if I must split this PR. Maybe I found a solution of that. Let me think about that.....

@Bjoe
Copy link
Contributor Author

Bjoe commented Oct 26, 2018

Please wait with the merge. I need to fix my review findings. Give me a day :-)

@lambdafu lambdafu mentioned this pull request Oct 26, 2018
@lambdafu
Copy link
Collaborator

Thanks for working on this! To answer your questions: Nothing in legacy should every see the light of day, so not exporting it is correct. And libneopg-tool exists only to allow for creating a separate testing binary that does unit testing with code from the main program. So that should be linked statically and not exported either. There was a ticket for revisiting cmake (#83). The goal is to be as "normal" as possible. I think the main painpoint is the step that collects all header files, but having the header files next to the source files and tests is important to me for navigating in the text editor, but maybe c++ developers deal with this differently? Let me know if I am missing something!

@Bjoe Bjoe force-pushed the improve-cmake branch 3 times, most recently from f689ed0 to bc3343c Compare October 28, 2018 01:43
@Bjoe
Copy link
Contributor Author

Bjoe commented Oct 28, 2018

And libneopg-tool exists only to allow for creating a separate testing binary that does unit testing with code from the main program.

Ok, this means it should also not "exported". I will remove this from the cmake install target.

having the header files next to the source files and tests is important to me for navigating in the text editor, but maybe c++ developers deal with this differently?

No, that's ok in my opinion. It's like code formatting I think. Some would say, it is better to have source and headers separated and some are not. I am not very religious about that :-).
But it should be "consistent", for example if the header file signature_expiration_time_subpacket.h is in the directory neopg/openpgp/signature/subpacket/ the include path should be then

#include <neopg/openpgp/signature/subpacket/signature_expiration_time_subpacket.h>

Otherwise it is not possible to "import" the project into the "development environment" after git clone. Also it is a bit confusing when a compile error occures in a header file and the header file is not in the same folder as the error indicates.
In my opinion, it should be "easy to use" or?
Now, it is maybe a good idea to rename the header file to a "shorter" name, for example

#include <neopg/openpgp/signature/subpacket/expiration_time.h>

@Bjoe
Copy link
Contributor Author

Bjoe commented Oct 28, 2018

Unfortunately to get travis running again takes more time that I expected. I see also some compile warnings and errors.
Give me some more days, I will fix this before we merge this PR.

@codecov
Copy link

codecov bot commented Oct 30, 2018

Codecov Report

Merging #90 into master will increase coverage by 0.55%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master      #90      +/-   ##
==========================================
+ Coverage   20.53%   21.09%   +0.55%     
==========================================
  Files         294      368      +74     
  Lines       32779    33033     +254     
==========================================
+ Hits         6732     6967     +235     
- Misses      26047    26066      +19

README.md Show resolved Hide resolved
@lambdafu
Copy link
Collaborator

Again, thanks for working on this. Everything seems fine, but I am not sure I'm 100% convinced that it is better to use subdirectories for the header files. Before this patch we're basically doing the same as Botan is doing, and it seems to work for them. The benefit of dropping the directory component: You can reorganize the files without changing the API. And the user has a bit less to copy/keep in their head. Of course, the downside is you won't notice if you use the same name twice, and the whole header copying during the build. I'm not super happy with either. OTOH, if we expect users to include only neopg/neopg.h anyway, most of this doesn't matter. Another point: If C++ modules ever arrive we might as well do now what will work best then?

@lambdafu
Copy link
Collaborator

With regards to the name: See, the pressure to shorten the name conflicts with a desire to be consistent with the naming of the header files matching the class name matching the OpenPGP packet name. "A foolish consistency is the hobgoblin of little minds" 🔥

@lambdafu
Copy link
Collaborator

I guess we can redo the header file location stuff at a later time. Don't want to drag you through another round of editing and testing!

@lambdafu lambdafu merged commit 3494a06 into das-labor:master Oct 31, 2018
@Bjoe
Copy link
Contributor Author

Bjoe commented Nov 1, 2018

Hi. "Oh" you merge already my PR :-), thanks but there was some missing open task that I fixed now: Don't export neopg-tool libs and headers.
Should I create a new pull request for these fix?
Also with your concern about the "header" location. I was not expecting that botan also use this "header approach". I would like to investigate/find some solution ... but it will take some weeks because I have something to do for the upcoming MeetingC++ conference in Berlin. (Is anyone of you there?)
Maybe we discuss about the "header location" on an issue in Github?

@lambdafu
Copy link
Collaborator

lambdafu commented Nov 1, 2018

Sure, just make a new pull request. As @sphinxc0re said, it would have been preferable to separate it a bit anyway :). And wrt to the header naming, we can discuss in a ticket, sure. No pressure. Thanks again for the great work so far!

@Bjoe
Copy link
Contributor Author

Bjoe commented Nov 9, 2018

Ok I create quickly the PRs see #92 and #93

As @sphinxc0re said, it would have been preferable to separate it a bit anyway :). And wrt to the header naming, we can discuss in a ticket, sure.

When the conference in Berlin is over, I will be back here.

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

Successfully merging this pull request may close these issues.

None yet

3 participants