Skip to content

[cmake][mlir] Fix the build under the Xcode generator #101057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jroelofs
Copy link
Contributor

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

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

llvmbot commented Jul 29, 2024

@llvm/pr-subscribers-mlir-linalg
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-arith

Author: Jon Roelofs (jroelofs)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/101057.diff

2 Files Affected:

  • (modified) mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt (+7)
  • (modified) mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt (+13)
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)

@jroelofs jroelofs requested a review from anemet July 30, 2024 16:07
@jroelofs
Copy link
Contributor Author

ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants