Skip to content

Commit

Permalink
[mlir] Do not use an empty source file when building aggregate librar…
Browse files Browse the repository at this point in the history
…ies.

See discussion: https://discourse.llvm.org/t/check-mlir-times-examples-standalone-testing-time/6073/7

It turns out that it has been legal since CMake 3.11 to omit sources at library creation time if they are added later via target_sources, as is done here. This side-steps the issue of having a file that changes and invalidates the build of leaves.

Differential Revision: https://reviews.llvm.org/D119069
  • Loading branch information
stellaraccident committed Feb 6, 2022
1 parent 52d981a commit b4626f2
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions mlir/cmake/modules/AddMLIR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,11 @@ function(add_mlir_aggregate name)
" DEPS = ${_local_deps}\n\n")
endforeach()

# Unfortunately need to compile at least one source file, which is hard
# to guarantee, so just always generate one. We generate one vs using the
# LLVM common dummy.cpp because it works better out of tree.
set(_empty_src "${CMAKE_CURRENT_BINARY_DIR}/${name}__empty.cpp")
file(WRITE "${_empty_src}" "typedef int dummy;")

add_mlir_library(${name}
${_libtype}
${ARG_UNPARSED_ARGUMENTS}
PARTIAL_SOURCES_INTENDED
EXCLUDE_FROM_LIBMLIR
"${_empty_src}"
LINK_LIBS PRIVATE
${_deps}
${ARG_PUBLIC_LIBS}
Expand Down

0 comments on commit b4626f2

Please sign in to comment.