-
Notifications
You must be signed in to change notification settings - Fork 26
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
build: add option for external mpgen binary #142
Merged
+13
−3
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build: add option for external mpgen binary
This is useful for cross builds. Note that the internal binary is still built, but it can be skipped by building the multiprocess target directly.
commit 75cf04a6ed4870d2023f005a9f0a9ef3c81e9996
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -60,15 +60,23 @@ function(target_capnp_sources target include_prefix) | |||||
"IMPORT_PATHS" # multi_value_keywords | ||||||
) | ||||||
|
||||||
if(NOT TARGET Libmultiprocess::mpgen) | ||||||
message(FATAL_ERROR "Target 'Libmultiprocess::mpgen' does not exist.") | ||||||
set(MPGEN_BINARY "") | ||||||
if(EXTERNAL_MPGEN) | ||||||
set(MPGEN_BINARY "${EXTERNAL_MPGEN}") | ||||||
if(NOT EXISTS "${MPGEN_BINARY}") | ||||||
message(FATAL_ERROR "EXTERNAL_MPGEN: \"${MPGEN_BINARY}\" does not exist.") | ||||||
endif() | ||||||
elseif(TARGET Libmultiprocess::multiprocess) | ||||||
set(MPGEN_BINARY $<TARGET_FILE:Libmultiprocess::mpgen>) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fairly certain that a generation expression isn't necessary here:
Suggested change
|
||||||
else() | ||||||
message(FATAL_ERROR "No usable mpgen. Set EXTERNAL_MPGEN or enable the internal target.") | ||||||
endif() | ||||||
|
||||||
set(generated_headers "") | ||||||
foreach(capnp_file IN LISTS TCS_UNPARSED_ARGUMENTS) | ||||||
add_custom_command( | ||||||
OUTPUT ${capnp_file}.c++ ${capnp_file}.h ${capnp_file}.proxy-client.c++ ${capnp_file}.proxy-types.h ${capnp_file}.proxy-server.c++ ${capnp_file}.proxy-types.c++ ${capnp_file}.proxy.h | ||||||
COMMAND Libmultiprocess::mpgen ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR}/${capnp_file} ${TCS_IMPORT_PATHS} ${MP_INCLUDE_DIR} | ||||||
COMMAND ${MPGEN_BINARY} ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR}/${capnp_file} ${TCS_IMPORT_PATHS} ${MP_INCLUDE_DIR} | ||||||
DEPENDS ${capnp_file} | ||||||
VERBATIM | ||||||
) | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of
EXTERNAL_MPGEN
must be a full path to satisfy theif(EXIST...)
condition. Why not make this more explicit by using theFILEPATH
type and mentioning in the help string?As a user-facing cache variable, it should have a library-specific prefix, like this one:https://github.com/chaincodelabs/libmultiprocess/blob/1e06ff07cdeadc78b2c022750f7b5cbc88d56b1d/CMakeLists.txt#L18
style nit: A full stop at the end of the help string?