Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.15k stars 93 forks source link

New option in CMake to find_package for all third_party dependencies #79

Closed prince-chrismc closed 4 years ago

prince-chrismc commented 4 years ago

There are the following third party packages that are bundled with RESTino. https://github.com/Stiffstream/restinio/blob/6934bd5a8ad707eb6a04894ec3bb198a39f447d9/dev/restinio/CMakeLists.txt#L162-L165

It would be greatly appreciated if there could be an option to have these included via find_package and utilized similar to https://github.com/Stiffstream/restinio/blob/6934bd5a8ad707eb6a04894ec3bb198a39f447d9/dev/CMakeLists.txt#L84 https://github.com/Stiffstream/restinio/blob/6934bd5a8ad707eb6a04894ec3bb198a39f447d9/dev/restinio/CMakeLists.txt#L53

I suspect this may cause an issue with the #include since they are currently hardcoding the "third_party" path. Might need to add a define... Ex: restinio/expected.hpp

+ #ifndef USE_EXTERNAL_THIRD_PARTY
#include "third_party/expected-lite/expected.hpp"
+ #else
+ #include "nonstd/expected.hpp"
+ #endif 

I would like to trim the duplication of files from the same project included/packaged differently by two deps.

eao197 commented 4 years ago

It would be greatly appreciated if there could be an option to have these included via find_package

Could you explain, please, why that functionality is so important?

prince-chrismc commented 4 years ago

I have a very lengthy dependencies tree. I have three projects that explicitly require a "C++17 Lite", which include RESTinio.

The two other projects expose the external dependency and are able to share the same copy of optional-lite however RESTinio is not able to share the same copy. I currently have a duplication of optional.hpp.

If ever I need to update one of these projects for a bugfix that is negatively impacting my application. I need the flexibility to do so.

What I am trying to avoid is having to update one dep and patch RESTinio is order to obtain the same fix.

gocarlos commented 4 years ago

Yes, having find package is needed also for usage in environments like yocto... You do not want to have two versions of the same lib... also software clearing is more painful with two versions

I’ve done what @prince-chrismc is doing here also with other libs, and this is the way to go, e.g. nlohmann_json in cpp-jwt

eao197 commented 4 years ago

The updated version of new RESTINIO_USEEXTERNAL*_LITE options is in 0.6-dev-0.6.7 branch and is planned to be released as a part of v.0.6.7.

prince-chrismc commented 4 years ago

class running_server_instance_t looks super promising :+1: .

The CMake changes look spot on =)

prince-chrismc commented 4 years ago

fixed with 0.6.7 release