[Mlir-commits] [mlir] b4626f2 - [mlir] Do not use an empty source file when building aggregate libraries.

Stella Laurenzo llvmlistbot at llvm.org
Sat Feb 5 23:06:40 PST 2022


Author: Stella Laurenzo
Date: 2022-02-05T23:06:28-08:00
New Revision: b4626f22defa4046991caa146cbbf0e792b43e92

URL: https://github.com/llvm/llvm-project/commit/b4626f22defa4046991caa146cbbf0e792b43e92
DIFF: https://github.com/llvm/llvm-project/commit/b4626f22defa4046991caa146cbbf0e792b43e92.diff

LOG: [mlir] Do not use an empty source file when building aggregate libraries.

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

Added: 
    

Modified: 
    mlir/cmake/modules/AddMLIR.cmake

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index b45c44e0276b9..3c1ba3d8211fe 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -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}


        


More information about the Mlir-commits mailing list