[Mlir-commits] [mlir] [cmake][mlir] Fix the build under the Xcode generator (PR #101057)

Jon Roelofs llvmlistbot at llvm.org
Mon Jul 29 12:59:33 PDT 2024


https://github.com/jroelofs updated https://github.com/llvm/llvm-project/pull/101057

>From 51641a93dc22251bed63f0841715ed69f1bc6606 Mon Sep 17 00:00:00 2001
From: Jon Roelofs <jonathan_roelofs at apple.com>
Date: Mon, 29 Jul 2024 11:34:00 -0700
Subject: [PATCH 1/2] [cmake][mlir] Fix the build under the Xcode generator

A couple extra dependencies are needed when using the Xcode generator, since
these targets all emit the same two files.
---
 mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt  |  7 +++++++
 mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt | 13 +++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt
index a2f24bdd94444..64f5cecf355ab 100644
--- a/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt
@@ -8,3 +8,10 @@ mlir_tablegen(ArithOpsAttributes.cpp.inc -gen-attrdef-defs
 add_mlir_dialect(ArithOps arith)
 add_mlir_doc(ArithOps ArithOps Dialects/ -gen-dialect-doc)
 add_mlir_interface(ArithOpsInterfaces)
+
+if(XCODE)
+  # The Xcode generator needs a dependency between these two, one way or
+  # another, since both targets generate the same file:
+  # tools/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc
+  add_dependencies(MLIRArithOpsInterfacesIncGen MLIRArithOpsIncGen)
+endif()
\ No newline at end of file
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt
index 289c0e4bbdaf6..f5d6ab0da20c7 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt
@@ -46,6 +46,19 @@ add_dependencies(mlir-headers LinalgOdsGen)
 
 add_mlir_dialect(LinalgOps linalg)
 
+if(XCODE)
+  # The Xcode generator needs a dependency between these two, one way or
+  # another, since all three targets generate the same file:
+  # tools/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td
+  add_dependencies(
+    MLIRLinalgOpsIncGen
+    MLIRLinalgNamedStructuredOpsYamlIncGen
+    MLIRLinalgOpsEnumsIncGen)
+  add_dependencies(
+    MLIRLinalgNamedStructuredOpsYamlIncGen
+    MLIRLinalgOpsEnumsIncGen)
+endif()
+
 set(LLVM_TARGET_DEFINITIONS LinalgEnums.td)
 mlir_tablegen(LinalgOpsEnums.h.inc -gen-enum-decls)
 mlir_tablegen(LinalgOpsEnums.cpp.inc -gen-enum-defs)

>From 68d653c94228411e4f202c428786d548bac265d9 Mon Sep 17 00:00:00 2001
From: Jon Roelofs <jonathan_roelofs at apple.com>
Date: Mon, 29 Jul 2024 12:59:02 -0700
Subject: [PATCH 2/2] add missing EOF newline

---
 mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt
index 64f5cecf355ab..adb80548355a6 100644
--- a/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt
@@ -14,4 +14,4 @@ if(XCODE)
   # another, since both targets generate the same file:
   # tools/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc
   add_dependencies(MLIRArithOpsInterfacesIncGen MLIRArithOpsIncGen)
-endif()
\ No newline at end of file
+endif()



More information about the Mlir-commits mailing list