summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGalina Kistanova <gkistanova@gmail.com>2017-06-10 07:48:49 +0000
committerGalina Kistanova <gkistanova@gmail.com>2017-06-10 07:48:49 +0000
commitaeae905f71173e47e8068ecbc657032ec01e6ca6 (patch)
treed4b48d492d53134e84e467a7384fe1ca834e4303
parent900012b39d1f8b6c1e0d6f798746002e20681f1b (diff)
downloadbcm5719-llvm-aeae905f71173e47e8068ecbc657032ec01e6ca6.tar.gz
bcm5719-llvm-aeae905f71173e47e8068ecbc657032ec01e6ca6.zip
Added dependency on the TableGen executable file.
For the case when LLVM_OPTIMIZED_TABLEGEN is ON (enables LLVM_USE_HOST_TOOLS), we need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the DEPENDS list to have .inc files rebuilt on a tablegen change, as cmake does not propagate file-level dependencies of custom targets. We could always have just one dependency on both the target and the file, but the 2 cases would produce cleaner cmake files. llvm-svn: 305142
-rw-r--r--llvm/cmake/modules/TableGen.cmake50
1 files changed, 37 insertions, 13 deletions
diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index da0858e54d4..17ae1c9e771 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -30,19 +30,43 @@ function(tablegen project ofn)
endif()
endif()
- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
- # Generate tablegen output in a temporary file.
- COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
- ${LLVM_TABLEGEN_FLAGS}
- ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
- -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
- # The file in LLVM_TARGET_DEFINITIONS may be not in the current
- # directory and local_tds may not contain it, so we must
- # explicitly list it here:
- DEPENDS ${${project}_TABLEGEN_TARGET} ${local_tds} ${global_tds}
- ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
- COMMENT "Building ${ofn}..."
- )
+ # We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the DEPENDS list
+ # (both the target and the file) to have .inc files rebuilt on
+ # a tablegen change, as cmake does not propagate file-level dependencies
+ # of custom targets. See the following ticket for more information:
+ # https://cmake.org/Bug/view.php?id=15858
+ # We could always have just one dependency on both the target and
+ # the file, but these 2 cases would produce cleaner cmake files.
+ if (${${project}_TABLEGEN_TARGET} STREQUAL ${${project}_TABLEGEN_EXE})
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
+ # Generate tablegen output in a temporary file.
+ COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
+ ${LLVM_TABLEGEN_FLAGS}
+ ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
+ -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
+ # The file in LLVM_TARGET_DEFINITIONS may be not in the current
+ # directory and local_tds may not contain it, so we must
+ # explicitly list it here:
+ DEPENDS ${${project}_TABLEGEN_TARGET} ${local_tds} ${global_tds}
+ ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
+ COMMENT "Building ${ofn}..."
+ )
+ else()
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
+ # Generate tablegen output in a temporary file.
+ COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
+ ${LLVM_TABLEGEN_FLAGS}
+ ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
+ -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
+ # The file in LLVM_TARGET_DEFINITIONS may be not in the current
+ # directory and local_tds may not contain it, so we must
+ # explicitly list it here:
+ DEPENDS ${${project}_TABLEGEN_TARGET} ${${project}_TABLEGEN_EXE}
+ ${local_tds} ${global_tds}
+ ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
+ COMMENT "Building ${ofn}..."
+ )
+ endif()
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
OpenPOWER on IntegriCloud