aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/TableGen.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/TableGen.cmake')
-rw-r--r--cmake/modules/TableGen.cmake26
1 files changed, 10 insertions, 16 deletions
diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake
index d1afcb42f9de..3c84ae78a349 100644
--- a/cmake/modules/TableGen.cmake
+++ b/cmake/modules/TableGen.cmake
@@ -25,7 +25,7 @@ function(tablegen project ofn)
file(RELATIVE_PATH ofn_rel
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
set(additional_cmdline
- -o ${ofn_rel}.tmp
+ -o ${ofn_rel}
-d ${ofn_rel}.d
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
@@ -36,7 +36,7 @@ function(tablegen project ofn)
file(GLOB local_tds "*.td")
file(GLOB_RECURSE global_tds "${LLVM_MAIN_INCLUDE_DIR}/llvm/*.td")
set(additional_cmdline
- -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
+ -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
)
endif()
@@ -69,8 +69,7 @@ function(tablegen project ofn)
# dependency twice in the result file when
# ("${${project}_TABLEGEN_TARGET}" STREQUAL "${${project}_TABLEGEN_EXE}")
# but lets us having smaller and cleaner code here.
- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
- # Generate tablegen output in a temporary file.
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
${LLVM_TABLEGEN_FLAGS}
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
@@ -83,20 +82,9 @@ function(tablegen project ofn)
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
COMMENT "Building ${ofn}..."
)
- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
- # Only update the real output file if there are any differences.
- # This prevents recompilation of all the files depending on it if there
- # aren't any.
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
- ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
- COMMENT "Updating ${ofn}..."
- )
# `make clean' must remove all those generated files:
- set_property(DIRECTORY APPEND
- PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${ofn}.tmp ${ofn})
+ set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${ofn})
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn} PARENT_SCOPE)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn} PROPERTIES
@@ -158,6 +146,12 @@ macro(add_tablegen target project)
llvm_ExternalProject_BuildCmd(tblgen_build_cmd ${target}
${LLVM_NATIVE_BUILD}
CONFIGURATION Release)
+ # 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)
+ add_dependencies(${project}-tablegen-host LLVM-tablegen-host)
+ endif()
add_custom_command(OUTPUT ${${project}_TABLEGEN_EXE}
COMMAND ${tblgen_build_cmd}
DEPENDS CONFIGURE_LLVM_NATIVE ${target}