Skip to content

Commit f288c21

Browse files
Revert "[CMAKE] Plumb include_directories() into tablegen()"
This reverts commit ae044c5. This breaks the buildbots, which use an older version of cmake.
1 parent ae044c5 commit f288c21

File tree

12 files changed

+24
-23
lines changed

12 files changed

+24
-23
lines changed

clang/cmake/modules/AddClang.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function(clang_tablegen)
1717
message(FATAL_ERROR "SOURCE source-file required by clang_tablegen")
1818
endif()
1919

20-
set( CLANG_TABLEGEN_ARGUMENTS "" )
20+
set( CLANG_TABLEGEN_ARGUMENTS -I ${CLANG_SOURCE_DIR}/include )
2121
set( LLVM_TARGET_DEFINITIONS ${CTG_SOURCE} )
2222
tablegen(CLANG ${CTG_UNPARSED_ARGUMENTS} ${CLANG_TABLEGEN_ARGUMENTS})
2323

llvm/cmake/modules/TableGen.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Extra parameters for `tblgen' may come after `ofn' parameter.
33
# Adds the name of the generated file to TABLEGEN_OUTPUT.
44

5+
if(LLVM_MAIN_INCLUDE_DIR)
6+
set(LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_INCLUDE_DIR})
7+
endif()
8+
59
function(tablegen project ofn)
610
# Validate calling context.
711
if(NOT ${project}_TABLEGEN_EXE)
@@ -71,8 +75,6 @@ function(tablegen project ofn)
7175
set(tblgen_change_flag "--write-if-changed")
7276
endif()
7377

74-
get_directory_property(includes "INCLUDE_DIRECTORIES")
75-
list(TRANSFORM includes PREPEND -I)
7678
# We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the DEPENDS list
7779
# (both the target and the file) to have .inc files rebuilt on
7880
# a tablegen change, as cmake does not propagate file-level dependencies
@@ -84,7 +86,6 @@ function(tablegen project ofn)
8486
# but lets us having smaller and cleaner code here.
8587
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
8688
COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
87-
${includes}
8889
${LLVM_TABLEGEN_FLAGS}
8990
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
9091
${tblgen_change_flag}

mlir/cmake/modules/AddMLIR.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function(mlir_tablegen ofn)
2-
tablegen(MLIR ${ARGV})
2+
tablegen(MLIR ${ARGV} "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
33
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
44
PARENT_SCOPE)
55
endfunction()

mlir/examples/toy/Ch3/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
include_directories(include)
21
add_subdirectory(include)
32

43
set(LLVM_LINK_COMPONENTS
54
Support
65
)
76

87
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
9-
mlir_tablegen(ToyCombine.inc -gen-rewriters)
8+
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
109
add_public_tablegen_target(ToyCh3CombineIncGen)
1110

1211
add_toy_chapter(toyc-ch3
@@ -21,6 +20,7 @@ add_toy_chapter(toyc-ch3
2120
ToyCh3CombineIncGen
2221
)
2322

23+
include_directories(include/)
2424
include_directories(${CMAKE_CURRENT_BINARY_DIR})
2525
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
2626
target_link_libraries(toyc-ch3

mlir/examples/toy/Ch4/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
include_directories(include)
21
add_subdirectory(include)
32

43
set(LLVM_LINK_COMPONENTS
54
Support
65
)
76

87
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
9-
mlir_tablegen(ToyCombine.inc -gen-rewriters)
8+
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
109
add_public_tablegen_target(ToyCh4CombineIncGen)
1110

1211
add_toy_chapter(toyc-ch4
@@ -23,6 +22,7 @@ add_toy_chapter(toyc-ch4
2322
ToyCh4CombineIncGen
2423
)
2524

25+
include_directories(include/)
2626
include_directories(${CMAKE_CURRENT_BINARY_DIR})
2727
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
2828
target_link_libraries(toyc-ch4

mlir/examples/toy/Ch4/include/toy/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(LLVM_TARGET_DEFINITIONS Ops.td)
2-
mlir_tablegen(Ops.h.inc -gen-op-decls)
3-
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
2+
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
3+
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
44
add_public_tablegen_target(ToyCh4OpsIncGen)
55

66
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)

mlir/examples/toy/Ch5/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
include_directories(include)
21
add_subdirectory(include)
32

43
set(LLVM_LINK_COMPONENTS
54
Support
65
)
76

87
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
9-
mlir_tablegen(ToyCombine.inc -gen-rewriters)
8+
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
109
add_public_tablegen_target(ToyCh5CombineIncGen)
1110

1211
add_toy_chapter(toyc-ch5
@@ -24,6 +23,7 @@ add_toy_chapter(toyc-ch5
2423
ToyCh5CombineIncGen
2524
)
2625

26+
include_directories(include/)
2727
include_directories(${CMAKE_CURRENT_BINARY_DIR})
2828
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
2929
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)

mlir/examples/toy/Ch5/include/toy/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(LLVM_TARGET_DEFINITIONS Ops.td)
2-
mlir_tablegen(Ops.h.inc -gen-op-decls)
3-
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
2+
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
3+
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
44
add_public_tablegen_target(ToyCh5OpsIncGen)
55

66
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)

mlir/examples/toy/Ch6/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
include_directories(include)
21
add_subdirectory(include)
32

43
set(LLVM_LINK_COMPONENTS
@@ -7,7 +6,7 @@ set(LLVM_LINK_COMPONENTS
76
)
87

98
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
10-
mlir_tablegen(ToyCombine.inc -gen-rewriters)
9+
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
1110
add_public_tablegen_target(ToyCh6CombineIncGen)
1211

1312
add_toy_chapter(toyc-ch6
@@ -26,6 +25,7 @@ add_toy_chapter(toyc-ch6
2625
ToyCh6CombineIncGen
2726
)
2827

28+
include_directories(include/)
2929
include_directories(${CMAKE_CURRENT_BINARY_DIR})
3030
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
3131
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)

mlir/examples/toy/Ch6/include/toy/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(LLVM_TARGET_DEFINITIONS Ops.td)
2-
mlir_tablegen(Ops.h.inc -gen-op-decls)
3-
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
2+
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
3+
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
44
add_public_tablegen_target(ToyCh6OpsIncGen)
55

66
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)

mlir/examples/toy/Ch7/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
include_directories(include)
21
add_subdirectory(include)
32

43
set(LLVM_LINK_COMPONENTS
@@ -7,7 +6,7 @@ set(LLVM_LINK_COMPONENTS
76
)
87

98
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
10-
mlir_tablegen(ToyCombine.inc -gen-rewriters)
9+
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
1110
add_public_tablegen_target(ToyCh7CombineIncGen)
1211

1312
add_toy_chapter(toyc-ch7
@@ -26,6 +25,7 @@ add_toy_chapter(toyc-ch7
2625
ToyCh7CombineIncGen
2726
)
2827

28+
include_directories(include/)
2929
include_directories(${CMAKE_CURRENT_BINARY_DIR})
3030
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
3131
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)

mlir/examples/toy/Ch7/include/toy/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(LLVM_TARGET_DEFINITIONS Ops.td)
2-
mlir_tablegen(Ops.h.inc -gen-op-decls)
3-
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
2+
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
3+
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
44
add_public_tablegen_target(ToyCh7OpsIncGen)
55

66
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)

0 commit comments

Comments
 (0)