<div dir="ltr">Yup, it's already reverted.  I'll use something that works in 3.4.3<div><br></div><div>Steve</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 3, 2020 at 11:04 AM Craig Topper via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I think I'm getting errors that TRANSFORM isn't a valid list sub-command with cmake 3.4.3<br><br clear="all"><div><div dir="ltr">~Craig</div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 3, 2020 at 10:38 AM Stephen Neuendorffer via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Stephen Neuendorffer<br>
Date: 2020-04-03T10:38:25-07:00<br>
New Revision: ae044c5b0caa095602b6ef4cca40d57efc26a8f6<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/ae044c5b0caa095602b6ef4cca40d57efc26a8f6" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/ae044c5b0caa095602b6ef4cca40d57efc26a8f6</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/ae044c5b0caa095602b6ef4cca40d57efc26a8f6.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/ae044c5b0caa095602b6ef4cca40d57efc26a8f6.diff</a><br>
<br>
LOG: [CMAKE] Plumb include_directories() into tablegen()<br>
<br>
Previously, the tablegen() cmake command, which defines custom<br>
commands for running tablegen, included several hardcoded paths.  This<br>
becomes unwieldy as there are more users for which these paths are<br>
insufficient.  For most targets, cmake uses include_directories() and<br>
the INCLUDE_DIRECTORIES directory property to specify include paths.<br>
This change picks up the INCLUDE_DIRECTORIES property and adds it<br>
to the include path used when running tablegen.  As a side effect, this<br>
allows us to remove several hard coded paths to tablegen that are redundant<br>
with specified include_directories().<br>
<br>
I haven't removed the hardcoded path to CMAKE_CURRENT_SOURCE_DIR, which<br>
seems generically useful.  There are several users in clang which apparently<br>
don't have the current directory as an include_directories().  This could<br>
be considered separately.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D77156" rel="noreferrer" target="_blank">https://reviews.llvm.org/D77156</a><br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
    clang/cmake/modules/AddClang.cmake<br>
    llvm/cmake/modules/TableGen.cmake<br>
    mlir/cmake/modules/AddMLIR.cmake<br>
    mlir/examples/toy/Ch3/CMakeLists.txt<br>
    mlir/examples/toy/Ch4/CMakeLists.txt<br>
    mlir/examples/toy/Ch4/include/toy/CMakeLists.txt<br>
    mlir/examples/toy/Ch5/CMakeLists.txt<br>
    mlir/examples/toy/Ch5/include/toy/CMakeLists.txt<br>
    mlir/examples/toy/Ch6/CMakeLists.txt<br>
    mlir/examples/toy/Ch6/include/toy/CMakeLists.txt<br>
    mlir/examples/toy/Ch7/CMakeLists.txt<br>
    mlir/examples/toy/Ch7/include/toy/CMakeLists.txt<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake<br>
index 577cc11ab015..c1bb386de6f7 100644<br>
--- a/clang/cmake/modules/AddClang.cmake<br>
+++ b/clang/cmake/modules/AddClang.cmake<br>
@@ -17,7 +17,7 @@ function(clang_tablegen)<br>
     message(FATAL_ERROR "SOURCE source-file required by clang_tablegen")<br>
   endif()<br>
<br>
-  set( CLANG_TABLEGEN_ARGUMENTS -I ${CLANG_SOURCE_DIR}/include )<br>
+  set( CLANG_TABLEGEN_ARGUMENTS "" )<br>
   set( LLVM_TARGET_DEFINITIONS ${CTG_SOURCE} )<br>
   tablegen(CLANG ${CTG_UNPARSED_ARGUMENTS} ${CLANG_TABLEGEN_ARGUMENTS})<br>
<br>
<br>
diff  --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake<br>
index 632f69aa3386..8d0c5afabe96 100644<br>
--- a/llvm/cmake/modules/TableGen.cmake<br>
+++ b/llvm/cmake/modules/TableGen.cmake<br>
@@ -2,10 +2,6 @@<br>
 # Extra parameters for `tblgen' may come after `ofn' parameter.<br>
 # Adds the name of the generated file to TABLEGEN_OUTPUT.<br>
<br>
-if(LLVM_MAIN_INCLUDE_DIR)<br>
-  set(LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_INCLUDE_DIR})<br>
-endif()<br>
-<br>
 function(tablegen project ofn)<br>
   # Validate calling context.<br>
   if(NOT ${project}_TABLEGEN_EXE)<br>
@@ -75,6 +71,8 @@ function(tablegen project ofn)<br>
     set(tblgen_change_flag "--write-if-changed")<br>
   endif()<br>
<br>
+  get_directory_property(includes "INCLUDE_DIRECTORIES")<br>
+  list(TRANSFORM includes PREPEND -I)<br>
   # We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the  DEPENDS list<br>
   # (both the target and the file) to have .inc files rebuilt on<br>
   # a tablegen change, as cmake does not propagate file-level dependencies<br>
@@ -86,6 +84,7 @@ function(tablegen project ofn)<br>
   # but lets us having smaller and cleaner code here.<br>
   add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}<br>
     COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}<br>
+    ${includes}<br>
     ${LLVM_TABLEGEN_FLAGS}<br>
     ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}<br>
     ${tblgen_change_flag}<br>
<br>
diff  --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake<br>
index 2adb8f2f2935..7449f54ea877 100644<br>
--- a/mlir/cmake/modules/AddMLIR.cmake<br>
+++ b/mlir/cmake/modules/AddMLIR.cmake<br>
@@ -1,5 +1,5 @@<br>
 function(mlir_tablegen ofn)<br>
-  tablegen(MLIR ${ARGV} "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")<br>
+  tablegen(MLIR ${ARGV})<br>
   set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn}<br>
       PARENT_SCOPE)<br>
 endfunction()<br>
<br>
diff  --git a/mlir/examples/toy/Ch3/CMakeLists.txt b/mlir/examples/toy/Ch3/CMakeLists.txt<br>
index 4dab5e4d0626..ef70dcbac309 100644<br>
--- a/mlir/examples/toy/Ch3/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch3/CMakeLists.txt<br>
@@ -1,3 +1,4 @@<br>
+include_directories(include)<br>
 add_subdirectory(include)<br>
<br>
 set(LLVM_LINK_COMPONENTS<br>
@@ -5,7 +6,7 @@ set(LLVM_LINK_COMPONENTS<br>
   )<br>
<br>
 set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)<br>
-mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")<br>
+mlir_tablegen(ToyCombine.inc -gen-rewriters)<br>
 add_public_tablegen_target(ToyCh3CombineIncGen)<br>
<br>
 add_toy_chapter(toyc-ch3<br>
@@ -20,7 +21,6 @@ add_toy_chapter(toyc-ch3<br>
   ToyCh3CombineIncGen<br>
   )<br>
<br>
-include_directories(include/)<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR})<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)<br>
 target_link_libraries(toyc-ch3<br>
<br>
diff  --git a/mlir/examples/toy/Ch4/CMakeLists.txt b/mlir/examples/toy/Ch4/CMakeLists.txt<br>
index 3589b10645a6..ae30a691894e 100644<br>
--- a/mlir/examples/toy/Ch4/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch4/CMakeLists.txt<br>
@@ -1,3 +1,4 @@<br>
+include_directories(include)<br>
 add_subdirectory(include)<br>
<br>
 set(LLVM_LINK_COMPONENTS<br>
@@ -5,7 +6,7 @@ set(LLVM_LINK_COMPONENTS<br>
   )<br>
<br>
 set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)<br>
-mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")<br>
+mlir_tablegen(ToyCombine.inc -gen-rewriters)<br>
 add_public_tablegen_target(ToyCh4CombineIncGen)<br>
<br>
 add_toy_chapter(toyc-ch4<br>
@@ -22,7 +23,6 @@ add_toy_chapter(toyc-ch4<br>
   ToyCh4CombineIncGen<br>
   )<br>
<br>
-include_directories(include/)<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR})<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)<br>
 target_link_libraries(toyc-ch4<br>
<br>
diff  --git a/mlir/examples/toy/Ch4/include/toy/CMakeLists.txt b/mlir/examples/toy/Ch4/include/toy/CMakeLists.txt<br>
index 798d0df1d8d6..7f60477fc272 100644<br>
--- a/mlir/examples/toy/Ch4/include/toy/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch4/include/toy/CMakeLists.txt<br>
@@ -1,6 +1,6 @@<br>
 set(LLVM_TARGET_DEFINITIONS Ops.td)<br>
-mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
-mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
+mlir_tablegen(Ops.h.inc -gen-op-decls)<br>
+mlir_tablegen(Ops.cpp.inc -gen-op-defs)<br>
 add_public_tablegen_target(ToyCh4OpsIncGen)<br>
<br>
 set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)<br>
<br>
diff  --git a/mlir/examples/toy/Ch5/CMakeLists.txt b/mlir/examples/toy/Ch5/CMakeLists.txt<br>
index c3627cf11cd7..ba3a88e03c0b 100644<br>
--- a/mlir/examples/toy/Ch5/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch5/CMakeLists.txt<br>
@@ -1,3 +1,4 @@<br>
+include_directories(include)<br>
 add_subdirectory(include)<br>
<br>
 set(LLVM_LINK_COMPONENTS<br>
@@ -5,7 +6,7 @@ set(LLVM_LINK_COMPONENTS<br>
   )<br>
<br>
 set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)<br>
-mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")<br>
+mlir_tablegen(ToyCombine.inc -gen-rewriters)<br>
 add_public_tablegen_target(ToyCh5CombineIncGen)<br>
<br>
 add_toy_chapter(toyc-ch5<br>
@@ -23,7 +24,6 @@ add_toy_chapter(toyc-ch5<br>
   ToyCh5CombineIncGen<br>
   )<br>
<br>
-include_directories(include/)<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR})<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)<br>
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)<br>
<br>
diff  --git a/mlir/examples/toy/Ch5/include/toy/CMakeLists.txt b/mlir/examples/toy/Ch5/include/toy/CMakeLists.txt<br>
index aaa932896d0f..e8bd1fc0bc2e 100644<br>
--- a/mlir/examples/toy/Ch5/include/toy/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch5/include/toy/CMakeLists.txt<br>
@@ -1,6 +1,6 @@<br>
 set(LLVM_TARGET_DEFINITIONS Ops.td)<br>
-mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
-mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
+mlir_tablegen(Ops.h.inc -gen-op-decls)<br>
+mlir_tablegen(Ops.cpp.inc -gen-op-defs)<br>
 add_public_tablegen_target(ToyCh5OpsIncGen)<br>
<br>
 set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)<br>
<br>
diff  --git a/mlir/examples/toy/Ch6/CMakeLists.txt b/mlir/examples/toy/Ch6/CMakeLists.txt<br>
index 5d39a9ab5fc1..be797c6c1e96 100644<br>
--- a/mlir/examples/toy/Ch6/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch6/CMakeLists.txt<br>
@@ -1,3 +1,4 @@<br>
+include_directories(include)<br>
 add_subdirectory(include)<br>
<br>
 set(LLVM_LINK_COMPONENTS<br>
@@ -6,7 +7,7 @@ set(LLVM_LINK_COMPONENTS<br>
   )<br>
<br>
 set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)<br>
-mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")<br>
+mlir_tablegen(ToyCombine.inc -gen-rewriters)<br>
 add_public_tablegen_target(ToyCh6CombineIncGen)<br>
<br>
 add_toy_chapter(toyc-ch6<br>
@@ -25,7 +26,6 @@ add_toy_chapter(toyc-ch6<br>
   ToyCh6CombineIncGen<br>
   )<br>
<br>
-include_directories(include/)<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR})<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)<br>
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)<br>
<br>
diff  --git a/mlir/examples/toy/Ch6/include/toy/CMakeLists.txt b/mlir/examples/toy/Ch6/include/toy/CMakeLists.txt<br>
index aecf11fab6c9..c6adf5a15a73 100644<br>
--- a/mlir/examples/toy/Ch6/include/toy/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch6/include/toy/CMakeLists.txt<br>
@@ -1,6 +1,6 @@<br>
 set(LLVM_TARGET_DEFINITIONS Ops.td)<br>
-mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
-mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
+mlir_tablegen(Ops.h.inc -gen-op-decls)<br>
+mlir_tablegen(Ops.cpp.inc -gen-op-defs)<br>
 add_public_tablegen_target(ToyCh6OpsIncGen)<br>
<br>
 set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)<br>
<br>
diff  --git a/mlir/examples/toy/Ch7/CMakeLists.txt b/mlir/examples/toy/Ch7/CMakeLists.txt<br>
index 760052ee840f..9a9f335d3a92 100644<br>
--- a/mlir/examples/toy/Ch7/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch7/CMakeLists.txt<br>
@@ -1,3 +1,4 @@<br>
+include_directories(include)<br>
 add_subdirectory(include)<br>
<br>
 set(LLVM_LINK_COMPONENTS<br>
@@ -6,7 +7,7 @@ set(LLVM_LINK_COMPONENTS<br>
   )<br>
<br>
 set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)<br>
-mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")<br>
+mlir_tablegen(ToyCombine.inc -gen-rewriters)<br>
 add_public_tablegen_target(ToyCh7CombineIncGen)<br>
<br>
 add_toy_chapter(toyc-ch7<br>
@@ -25,7 +26,6 @@ add_toy_chapter(toyc-ch7<br>
   ToyCh7CombineIncGen<br>
   )<br>
<br>
-include_directories(include/)<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR})<br>
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)<br>
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)<br>
<br>
diff  --git a/mlir/examples/toy/Ch7/include/toy/CMakeLists.txt b/mlir/examples/toy/Ch7/include/toy/CMakeLists.txt<br>
index fa30bd2e8e03..43eb23bf93b8 100644<br>
--- a/mlir/examples/toy/Ch7/include/toy/CMakeLists.txt<br>
+++ b/mlir/examples/toy/Ch7/include/toy/CMakeLists.txt<br>
@@ -1,6 +1,6 @@<br>
 set(LLVM_TARGET_DEFINITIONS Ops.td)<br>
-mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
-mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")<br>
+mlir_tablegen(Ops.h.inc -gen-op-decls)<br>
+mlir_tablegen(Ops.cpp.inc -gen-op-defs)<br>
 add_public_tablegen_target(ToyCh7OpsIncGen)<br>
<br>
 set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>