rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.66k stars 308 forks source link

building: grpc_dependency builds googletest #495

Closed GitMensch closed 1 year ago

GitMensch commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce

Expected behavior

Environment:

GitMensch commented 1 year ago

It seems that for building the dependency those defines must be converted to -DgRPC_BUILD_TESTS=OFF

rizsotto commented 1 year ago

https://github.com/rizsotto/Bear/blob/master/third_party/grpc/CMakeLists.txt#L46 Bear pass this flag when it builds gRPC from source.

GitMensch commented 1 year ago

This is strange, because when I manually pass it to bear I get a warning that it isn't used, but googletest is not build in the sub; If I don't specify it for bear it is build in the sub?!?

I don't know much about cmake, but guess all arguments given to bear are passed? It would still be strange that this option is not used.... Is there something like "config.log" for autotools builds in cmake that shows the parameters passed?

rizsotto commented 1 year ago

Bear is using CMake subprojects. And not all arguments are passed down to the subprojects. (Each dependency has it's own CMakeList.txt file which controls what that subproject will see.)

When I set up the project years ago, I did verify that it does not run the unit tests of gRPC package. It might check out the sources (because git submodules), but it does not mean it builds too. How did you come to the conclusion that it builds and run the tests for gRPC?

GitMensch commented 1 year ago

How did you come to the conclusion that it builds and run the tests for gRPC?

It took quite some time and said googletest and was within the gRPC.

It might check out the sources (because git submodules), but it does not mean it builds too.

Hm, this may be the case then. Can those submodules be deactivated? Note: I did build from the 3.0.20 release, not from git checkout directly - but have seen several checkouts for the dependencies.

rizsotto commented 1 year ago

When you have Bear sources (from release or from git HEAD), it will checks for its dependencies. If it does not found on your machine it will build the dependency package from source. In case of gRPC, it gets the sources (of gRPC) from a git checkout. And because that git repository has git submodules, it will check out those repositories. (No control over that process, because it's at git level, not the build level.)

The only optimalization of this git checkout I've made, that it's a shallow clone (no complete history). Probably can this optimized further (PR is welcome), but the best thing if you have the dependency already installed on the machine.

I close this ticket now.