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

cmake: Introduce LibmultiprocessMacros module #95

Merged
merged 3 commits into from
Mar 29, 2024

Conversation

hebasto
Copy link
Contributor

@hebasto hebasto commented Mar 15, 2024

This PR introduces the LibmultiprocessMacros module that is used internally and might be exported as a part of the (future) LibmultiprocessGen package (it is a subject of the follow-up PR).

Also see a discussion in hebasto/bitcoin#118.

@hebasto hebasto marked this pull request as ready for review March 16, 2024 16:12
@hebasto
Copy link
Contributor Author

hebasto commented Mar 16, 2024

Undrafted and aligned with #96.

@hebasto hebasto mentioned this pull request Mar 16, 2024
@hebasto hebasto changed the title cmake: Introduce MpgenMacros module cmake: Introduce LibmultiprocessMacros module Mar 16, 2024
@hebasto
Copy link
Contributor Author

hebasto commented Mar 16, 2024

The PR title and description have been updated.

@ryanofsky ryanofsky self-assigned this Mar 19, 2024
Copy link
Collaborator

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 45341dc

This looks great! Thanks for writing this. I suggested a documentation comment and a minor simplification above, but would also be happy to merge this as it is. You can let me know what you prefer.

@hebasto
Copy link
Contributor Author

hebasto commented Mar 29, 2024

@ryanofsky

I suggested a documentation comment and a minor simplification above, but would also be happy to merge this as it is. You can let me know what you prefer.

Thank you!

Your suggestions have been implemented.

Copy link
Collaborator

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 66643d8

Thanks for the update. I think I do want to rename LibmultiprocessMacros.cmake to TargetCapnpSources.cmake so it is named after the function it contains like other cmake modules, but I will do this in a followup

@ryanofsky ryanofsky merged commit 19dea85 into chaincodelabs:master Mar 29, 2024
ryanofsky added a commit that referenced this pull request Mar 30, 2024
4e70ad4 cmake, refactor: Rename target export files (Hennadii Stepanov)
694b6b1 cmake: Configure `LibmultiprocessGen` package (Hennadii Stepanov)
3b20e35 cmake: Configure `Libmultiprocess` package (Hennadii Stepanov)

Pull request description:

  This PR adds configurations for the `Libmultiprocess` and `LibmultiprocessGen` packages.

  The Bitcoin Core branch, with uses this PR branch, is available [here](https://github.com/hebasto/bitcoin/tree/240329-cmake-CI-mpgen).

  As a suggestion for a follow-up, it seems worth disabling `mpgen` target for cross-compiling (see bitcoin/bitcoin#29665 (comment) and CMake [docs](https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html#running-executables-built-in-the-project)).

  Based on #95.

ACKs for top commit:
  ryanofsky:
    Code review ACK 4e70ad4. This should make it easier to depend on libmultprocess in cmake projects, using a find_package call and not having to include files directly.

Tree-SHA512: 231d00fd3b03bff40d010d39636a4c6b26e071a1d2c220f204ef536d6f3f7b3c81d2d05a16e3bb23f405a45e2b763cd88344cabd9eb407f1967b766b328815a4
ryanofsky added a commit to ryanofsky/libmultiprocess that referenced this pull request Mar 30, 2024
…and chaincodelabs#96

Rename "LibmultiprocessMacros.cmake" module to "TargetCapnpSources.cmake" to
match the name of the target_capnp_sources function it contains. Also install it

  <prefix>/lib/cmake/Libmultiprocess/TargetCapnpSources.cmake

instead of:

  <prefix>/lib/cmake/LibmultiprocessGen/LibmultiprocessMacros.cmake

Rename the "LibmultiprocessGen" package to "LibmultiprocessBin" and rename the
"Libmultiprocess" package to "LibmultiprocessLib", so package names are
consistent with component names "bin" and "lib", and one package name is not a
prefix of the other. Also rename intermediate files to match component names.

|----------------+----------------------------------+----------------------------------------------|
|                | New                              | Current                                      |
|----------------+----------------------------------+----------------------------------------------|
| Component name | lib                              | lib                                          |
| Package name   | LibmultiprocessLib               | Libmultiprocess                              |
| Config file    | LibmultiprocessLibConfig.cmake   | Libmultiprocess/LibmultiprocessConfig.cmake  |
| Targets file   | Libmultiprocess/LibTargets.cmake | Libmultiprocess/LibmultiprocessTargets.cmake |
|----------------+----------------------------------+----------------------------------------------|

|----------------+----------------------------------+----------------------------------------------------|
|                | New                              | Current                                            |
|----------------+----------------------------------+----------------------------------------------------|
| Component name | bin                              | bin                                                |
| Package name   | LibmultiprocessBin               | LibmultiprocessGen                                 |
| Config file    | LibmultiprocessBinConfig.cmake   | LibmultiprocessGen/LibmultiprocessGenConfig.cmake  |
| Targets file   | Libmultiprocess/BinTargets.cmake | LibmultiprocessGen/LibmultiprocessGenTargets.cmake |
|----------------+----------------------------------+----------------------------------------------------|
ryanofsky added a commit that referenced this pull request Mar 30, 2024
…#96

c6a1d7f cmake: rename new packages and module introduced in #95 and #96 (Ryan Ofsky)

Pull request description:

  Rename "LibmultiprocessMacros.cmake" module introduced in #95 to "TargetCapnpSources.cmake" to match the name of the `target_capnp_sources` function it contains. Also install it to:

  ```sh
    <prefix>/lib/cmake/Libmultiprocess/TargetCapnpSources.cmake
  ```

  instead of:

  ```sh
    <prefix>/lib/cmake/LibmultiprocessGen/LibmultiprocessMacros.cmake
  ```

  Rename the "Libmultiprocess" and "LibmultiprocessGen" packages introduced in #96 to "LibmultiprocessLib" and "LibmultiprocessBin", so package names are consistent with component names "lib" and "bin", and one package name is not a prefix of the other. Also rename intermediate files to match component names.

  |                | New                              | Current                                      |
  |----------------|----------------------------------|----------------------------------------------|
  | Component name | lib                              | lib                                          |
  | Package name   | LibmultiprocessLib               | Libmultiprocess                              |
  | Config file    | LibmultiprocessLibConfig.cmake   | Libmultiprocess/LibmultiprocessConfig.cmake  |
  | Targets file   | Libmultiprocess/LibTargets.cmake | Libmultiprocess/LibmultiprocessTargets.cmake |

  |                | New                              | Current                                            |
  |----------------|----------------------------------|----------------------------------------------------|
  | Component name | bin                              | bin                                                |
  | Package name   | LibmultiprocessBin               | LibmultiprocessGen                                 |
  | Config file    | LibmultiprocessBinConfig.cmake   | LibmultiprocessGen/LibmultiprocessGenConfig.cmake  |
  | Targets file   | Libmultiprocess/BinTargets.cmake | LibmultiprocessGen/LibmultiprocessGenTargets.cmake |

Top commit has no ACKs.

Tree-SHA512: db099f34e14f5433c644190359bef0f3b836401b31c8eea3c4f7d732ec06402eb01063360d8b7ebbed9522be9c6758e157e46e15cafd80ac2bebc5c915ad2160
@hebasto
Copy link
Contributor Author

hebasto commented Mar 30, 2024

I think I do want to rename LibmultiprocessMacros.cmake to TargetCapnpSources.cmake so it is named after the function it contains like other cmake modules, but I will do this in a followup

FWIW, when I chose the name, I followed the wide accepted practice for naming a CMake file, which provides the package-specific functions. For example, https://packages.ubuntu.com/jammy/amd64/qtbase5-dev/filelist

@hebasto hebasto deleted the 240314-macro branch March 30, 2024 05:24
@ryanofsky
Copy link
Collaborator

ryanofsky commented Mar 30, 2024

(EDIT: This comment was actually posted in response to #97 (comment) in the other issue)

Oops, sorry, I saw the <prefix>/(cmake|CMake)/ entry in that table and thought just putting the files in the cmake/ directory would work. I didn't realize that entry does not include the "lib" component though. I guess the only way to fix this is to repeat the package name twice in installed paths, which seems ugly to me but does seem to be the cmake convention as you pointed out #95 (comment)

I do want package names to be consistent with component names, though. Will post a followup adding directory prefixes.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 13, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 11, 2024
depends: Update libmultiprocess library

Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 12, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 16, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 16, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 17, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 17, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 19, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 24, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 26, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 26, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
chaincodelabs/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

chaincodelabs/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
chaincodelabs/libmultiprocess#96: cmake: Introduce packages
chaincodelabs/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
chaincodelabs/libmultiprocess#98: cmake: Combine installed packages
chaincodelabs/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
chaincodelabs/libmultiprocess#100: doc: Add various code comments and documentation
chaincodelabs/libmultiprocess#102: doc: Document shutdown sequences better
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