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

refactor(cmake): use template for config.cmake.in #12487

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Aug 29, 2023

Part of the work for #12483. Also related to #12428 and #12467.

Add explicit support to the client library helper to handle cross library deps. This also cleans up the passing of GOOGLE_CLOUD_CPP_DOXYGEN_EXTRA_INCLUDES from the ${library}/CMakeLists.txt as a global. (Of course we later pass it as a global to our doxygen helper functions, but 🤫 )

This also introduces a config.cmake.in template and lets us remove 100+ identical ${library}/config.cmake.in files.

I plan to update the scaffolding in a follow up. And I might update handwritten libraries like bigtable, pubsub, spanner which have identical config.cmake.in's to the template.


This change is Reviewable

@dbolduc dbolduc temporarily deployed to internal August 29, 2023 05:08 — with GitHub Actions Inactive
@dbolduc dbolduc changed the title Refactor config cmake in refactor(cmake): use template for config.cmake.in Aug 29, 2023
@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (4d0271b) 93.62% compared to head (f99cf47) 93.62%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12487   +/-   ##
=======================================
  Coverage   93.62%   93.62%           
=======================================
  Files        2039     2039           
  Lines      180677   180677           
=======================================
+ Hits       169150   169151    +1     
+ Misses      11527    11526    -1     

see 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbolduc dbolduc marked this pull request as ready for review August 29, 2023 05:40
@dbolduc dbolduc requested a review from a team as a code owner August 29, 2023 05:40
@@ -57,6 +59,11 @@ function (google_cloud_cpp_add_ga_grpc_library library display_name)
endif ()
set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/quickstart")
unset(GOOGLE_CLOUD_CPP_DOXYGEN_EXTRA_INCLUDES)
Copy link
Contributor

Choose a reason for hiding this comment

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

Starting with CMake 3.12 we can use list(TRANSFORM ...):

https://cmake.org/cmake/help/latest/command/list.html#transform

set(GOOGLE_CLOUD_CPP_DOXYGEN_EXTRA_INCLUDES "${opt_CROSS_LIB_DEPS}")
list(TRANSFORM
      GOOGLE_CLOUD_CPP_DOXYGEN_EXTRA_INCLUDES
      PREPEND "${PROJECT_BINARY_DIR}/google/cloud/")

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooh, nice. Done.

@@ -201,7 +208,16 @@ function (google_cloud_cpp_add_ga_grpc_library library display_name)

# Create and install the CMake configuration files.
include(CMakePackageConfigHelpers)
configure_file("config.cmake.in" "${library_target}-config.cmake" @ONLY)
set(GOOGLE_CLOUD_CPP_CONFIG_LIBRARY "${library_target}")
unset(find_dependencies)
Copy link
Contributor

Choose a reason for hiding this comment

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

as above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, but I am skeptical as to whether this one was an improvement. I briefly explored list(TRANSFORM ... REPLACE ...), but gave up.

@dbolduc dbolduc temporarily deployed to internal August 29, 2023 14:41 — with GitHub Actions Inactive
@dbolduc dbolduc enabled auto-merge (squash) August 29, 2023 14:44
@dbolduc dbolduc merged commit 6a0289c into googleapis:main Aug 29, 2023
53 checks passed
@dbolduc dbolduc deleted the refactor-config-cmake-in branch November 16, 2023 12:50
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.

2 participants