-
Notifications
You must be signed in to change notification settings - Fork 694
Force pcapplusplus prefix in include #1586
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
base: dev
Are you sure you want to change the base?
Conversation
25220b5
to
4fb8f84
Compare
Nvm, the change of base branch was not updated for me. |
9c37d64
to
03b0a7c
Compare
3540009
to
4f38461
Compare
0c541e0
to
246cb1b
Compare
10f7065
to
5585678
Compare
b836558
to
3589f65
Compare
f1bc5a9
to
67fdf63
Compare
I'm not sure our users care whether it's Common++, Packet++ or Pcap++, for them it's just PcapPlusPlus headers... I think the bigger problem here is if/how we maintain backward compatibility? |
Either way is fine. I saw both in other libraries.
The old design doesn't follow common sense in the C++ world. So I guess a breaking change should be fine. |
They might, if they want to compile only parsing support, and suddenly they have to dig in the project files to see which headers are part of the parsing module and which are part of the capture module. |
@Dimi1010 if they only compile parsing support they will only have the header files they need, so that shouldn't be a problem
@tigercosmos my concern is that if someone uses PcapPlusPlus heavily, it'll be a pretty serious breaking change for them which will make it harder for the to bump the version |
We can have transition headers that are basically an |
Interesting idea! How is it going to work? |
@seladb Essentially you have the following structure (packet subfolder is just to show it can work through subfolders): header/pcapplusplus/packat/AAXXX.hpp
header/AAXXX.hpp
That way if someone has Ideally we would want to have Also if we do this, the idea is that any new headers won't have a transition header added, to encourage ppl to move to the new headers. Pros and cons overview is thus:
|
@Dimi1010 I think your solution could work! Maybe we can even generate these "symbolic link" files automatically during build time so they're not part of the project. I think it's pretty easy to write a python script to generate them, however I'm not sure how to run this script from CMake 🤔 |
@seladb It should be able to generate them at build time. Shouldn't be that hard to do it with pure CMake even. Although that way, it would probably be easier to generate a transition header for all public headers, not just the current ones. Or we need to keep a snapshot of which headers to create a transition header for. |
Yes, I think generating them automatically for all public headers is the better option |
@seladb Added automatic generation of the transition headers. I think that will be good enough? Only the install interface considers these files as in the "include" directory. The build interface does not use them at all, so we don't use them in new code. PS: Android CI works because of the backwards compatibility change, not because its actually fixed. |
…TERFACE> include that directly links <pcapplusplus> folder. The generated headers had issue with polluting the main include directory. The new install interface should allow both usages of the new `#include <pcapplusplus/xxx.h>` and the old `#include <xxx.h>` for projects that import installed the package. The build interface is left unchanged to require usages of #include <pcapplusplus/xxx.h> in internal code.
@seladb Scrapped the transition headers idea due to having the critical issue of polluting the global include on install. I think just keeping the |
- Added old include behavior to build interface and include interface. - Added option 'PCAPPP_USE_DEPRECATED_INCLUDE' to control if pcapplusplus folder is added as an include folder root. (Default: ON) - Added CMake deprecation warning about `PCAPPP_USE_DEPRECATED_INCLUDE` behavior.
@seladb Got a bit of a question for desired implementation of backwards compat. It should be possible to have both the old and new install #include format if we essentially keep both for target_include_directories. Currently I think I can make it essentially be controlled by a flag, via a CMake generator expression. If the flag is set, the old style interfaces will also be added. The flag will need to be added to the config file, if we want to default it to The question I have is, should the old way be available for users to turn it off, or have it always on? This is the include directories expression with the optional flag:
|
@Dimi1010 just to make sure I understand, mostly because I'm not a CMake expert: do we want to have a CMake flag to control whether to have both the new and old include format? And the default will be If we have this flag and it's turned off I think it can leave only the new format. Let me know if this answers your question |
The question is more: "Do we want the flag to be there to allow people to disable the old includes, or do we want them to be always on until we remove them?" |
@clementperon But it will make PcapPlusPlus not backward compatible which will make it hard for users to upgrade...
@Dimi1010 I think having the flag is a good idea. We can leave this flag turned on by default in the next version, then in later version change the default to |
- Renamed pcap variable to `PCAPPP_ENABLE_OLD_STYLE_INCLUDE`. - Fixed generating extra code for install targets script.
@seladb @clementperon Added the flag Also can someone look at the android CI and see what is going wrong there. :/ |
… targets to fix Config variable lifetime scope issue with generator evaluation.
At the moment building a simple example like
CMakeLists.txt
test.cpp
Trig an error on MacOS when PcapPlusplus is installed with brew
This is because the include folder is " -I/opt/homebrew/include/pcapplusplus"
and file is located in /opt/homebrew/include/pcapplusplus/PcapLiveDeviceList.h
Remove the pcapplusplus folder