forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmake] Serialize native builds for Make generator (llvm#121021)
The build system is fragile by allowing multiple invocation of subprocess builds in the native folder for Make generator. For example, during sub-invocation of the native llvm-config, llvm-min-tblgen is also built. If there is another sub-invocation of the native llvm-min-tblgen build running in parallel, they may overwrite each other's build results, and may lead to errors like "Text file busy". This patch adds a cmake script that uses file lock to serialize all native builds for Make generator.
- Loading branch information
1 parent
e49fe56
commit 4683fdd
Showing
3 changed files
with
30 additions
and
6 deletions.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# CMake script that synchronizes process execution on a given file lock. | ||
# | ||
# Input variables: | ||
# LOCK_FILE_PATH - The file to be locked for the scope of the process of this cmake script. | ||
# COMMAND - The command to be executed. | ||
|
||
file(LOCK ${LOCK_FILE_PATH}) | ||
string(REPLACE "@" ";" command_args ${COMMAND}) | ||
execute_process(COMMAND ${command_args} COMMAND_ERROR_IS_FATAL ANY) |
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