googleapis / google-cloud-cpp

C++ Client Libraries for Google Cloud Services
https://cloud.google.com/
Apache License 2.0
554 stars 375 forks source link

Proto libraries in `external/googleapis/` are always compiled #8022

Closed coryan closed 1 year ago

coryan commented 2 years ago

The proto libraries in external/googleapis/ are always compiled (unless gRPC is completely disabled, but that is Okay).

Most of them are small libraries with only one proto file in them, and many of them (things like "api.proto") are used by almost all libraries. Not particularly onerous, but there are a few (e.g. google_cloud_cpp_cloud_texttospeech, google_cloud_cpp_monitoring) that are larger. We could move them to google/cloud/${service} and compile them only when needed.

We need to have a plan on how to deal with these larger libraries.

We should also consider merging all the smaller libraries into a single .a file. "One library per proto" makes no sense for the CMake build + install model, creates friction for customers, and (if we solve the many other problems) is very inconvenient for DLLs exports. We can be backwards compatible with a series of interface-only targets.

coryan commented 2 years ago

We still want to clean this up, maybe now that we have CMake >= 3.10 we can fix this.

dbolduc commented 2 years ago

A customer is asking for this. See the discussion in: #10174

coryan commented 1 year ago

Realistically we will not have time to work on this. Closing for now.

dbolduc commented 1 year ago

We discussed this, and decided that building extra protos is in fact a bug. It is an unnecessary burden on customers who build with cmake and do not want to compile these extra protos.

dbolduc commented 1 year ago

Here is what the changes for dialogflow will look like:

https://github.com/dbolduc/google-cloud-cpp/commit/e2b7b0d1727aa5ec688bbcbd3e07a82c407a4505

Googlers can see this before/after of a full install:

BEFORE: https://paste.googleplex.com/6469566354948096 AFTER: https://paste.googleplex.com/4781980355919872

Also, I verified that if I install other libraries, the dialogflow protos are not installed. yay.


I need to think about how we want to test this... Maybe we...

  1. check that the legacy proto libraries' pkgconfig files are installed
  2. build some executable that we link against all of the legacy proto libraries.