[PATCH] D149072: [CMake] Serialize `build_native_tool`
NAKAMURA Takumi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 08:57:15 PDT 2023
chapuni created this revision.
Herald added a subscriber: ekilmer.
Herald added a project: All.
chapuni requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
To prevent race in `NATIVE`, let each action depend on preceding action.
For example,
- `llvm-tblgen-host` depends on the target's `llvm-tblgen`.
- `clang-tblgen-host` depends on the target's `clang-tblgen` and `llvm-tblgen-host`.
This is rework for D54153 <https://reviews.llvm.org/D54153>.
`build_native_tool` has been introduced since D60024 <https://reviews.llvm.org/D60024>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149072
Files:
llvm/cmake/modules/CrossCompile.cmake
llvm/cmake/modules/TableGen.cmake
Index: llvm/cmake/modules/TableGen.cmake
===================================================================
--- llvm/cmake/modules/TableGen.cmake
+++ llvm/cmake/modules/TableGen.cmake
@@ -171,14 +171,6 @@
add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE})
set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE)
- # Create an artificial dependency between tablegen projects, because they
- # compile the same dependencies, thus using the same build folders.
- # FIXME: A proper fix requires sequentially chaining tablegens.
- if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND
- TARGET LLVM-tablegen-host)
- add_dependencies(${project}-tablegen-host LLVM-tablegen-host)
- endif()
-
# If we're using the host tablegen, and utils were not requested, we have no
# need to build this tablegen.
if ( NOT LLVM_BUILD_UTILS )
Index: llvm/cmake/modules/CrossCompile.cmake
===================================================================
--- llvm/cmake/modules/CrossCompile.cmake
+++ llvm/cmake/modules/CrossCompile.cmake
@@ -112,11 +112,14 @@
endif()
set(output_path ${output_path}${LLVM_HOST_EXECUTABLE_SUFFIX})
+ get_property(host_targets GLOBAL PROPERTY ${PROJECT_NAME}_HOST_TARGETS)
+ set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_HOST_TARGETS ${output_path})
+
llvm_ExternalProject_BuildCmd(build_cmd ${target} ${${PROJECT_NAME}_NATIVE_BUILD}
CONFIGURATION Release)
add_custom_command(OUTPUT "${output_path}"
COMMAND ${build_cmd}
- DEPENDS CONFIGURE_${PROJECT_NAME}_NATIVE ${ARG_DEPENDS}
+ DEPENDS CONFIGURE_${PROJECT_NAME}_NATIVE ${ARG_DEPENDS} ${host_targets}
WORKING_DIRECTORY "${${PROJECT_NAME}_NATIVE_BUILD}"
COMMENT "Building native ${target}..."
USES_TERMINAL)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149072.516428.patch
Type: text/x-patch
Size: 1993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230424/bf309b3c/attachment.bin>
More information about the llvm-commits
mailing list