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

Jon Roelofs llvmlistbot at llvm.org
Mon Jul 29 11:36:48 PDT 2024


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

A couple extra dependencies are needed when using the Xcode generator, since these targets all emit the same two files.

>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] [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)



More information about the Mlir-commits mailing list