Revert "[CMAKE] Plumb include_directories() into tablegen()"

This reverts commit ae044c5b0caa095602b6ef4cca40d57efc26a8f6.

This breaks the buildbots, which use an older version of cmake.
This commit is contained in:
Stephen Neuendorffer 2020-04-03 10:47:36 -07:00
parent ae044c5b0c
commit f288c21687
12 changed files with 24 additions and 23 deletions

View File

@ -17,7 +17,7 @@ function(clang_tablegen)
message(FATAL_ERROR "SOURCE source-file required by clang_tablegen")
endif()
set( CLANG_TABLEGEN_ARGUMENTS "" )
set( CLANG_TABLEGEN_ARGUMENTS -I ${CLANG_SOURCE_DIR}/include )
set( LLVM_TARGET_DEFINITIONS ${CTG_SOURCE} )
tablegen(CLANG ${CTG_UNPARSED_ARGUMENTS} ${CLANG_TABLEGEN_ARGUMENTS})

View File

@ -2,6 +2,10 @@
# Extra parameters for `tblgen' may come after `ofn' parameter.
# Adds the name of the generated file to TABLEGEN_OUTPUT.
if(LLVM_MAIN_INCLUDE_DIR)
set(LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_INCLUDE_DIR})
endif()
function(tablegen project ofn)
# Validate calling context.
if(NOT ${project}_TABLEGEN_EXE)
@ -71,8 +75,6 @@ function(tablegen project ofn)
set(tblgen_change_flag "--write-if-changed")
endif()
get_directory_property(includes "INCLUDE_DIRECTORIES")
list(TRANSFORM includes PREPEND -I)
# We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the DEPENDS list
# (both the target and the file) to have .inc files rebuilt on
# a tablegen change, as cmake does not propagate file-level dependencies
@ -84,7 +86,6 @@ function(tablegen project ofn)
# but lets us having smaller and cleaner code here.
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
${includes}
${LLVM_TABLEGEN_FLAGS}
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
${tblgen_change_flag}

View File

@ -1,5 +1,5 @@
function(mlir_tablegen ofn)
tablegen(MLIR ${ARGV})
tablegen(MLIR ${ARGV} "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
PARENT_SCOPE)
endfunction()

View File

@ -1,4 +1,3 @@
include_directories(include)
add_subdirectory(include)
set(LLVM_LINK_COMPONENTS
@ -6,7 +5,7 @@ set(LLVM_LINK_COMPONENTS
)
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
mlir_tablegen(ToyCombine.inc -gen-rewriters)
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
add_public_tablegen_target(ToyCh3CombineIncGen)
add_toy_chapter(toyc-ch3
@ -21,6 +20,7 @@ add_toy_chapter(toyc-ch3
ToyCh3CombineIncGen
)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
target_link_libraries(toyc-ch3

View File

@ -1,4 +1,3 @@
include_directories(include)
add_subdirectory(include)
set(LLVM_LINK_COMPONENTS
@ -6,7 +5,7 @@ set(LLVM_LINK_COMPONENTS
)
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
mlir_tablegen(ToyCombine.inc -gen-rewriters)
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
add_public_tablegen_target(ToyCh4CombineIncGen)
add_toy_chapter(toyc-ch4
@ -23,6 +22,7 @@ add_toy_chapter(toyc-ch4
ToyCh4CombineIncGen
)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
target_link_libraries(toyc-ch4

View File

@ -1,6 +1,6 @@
set(LLVM_TARGET_DEFINITIONS Ops.td)
mlir_tablegen(Ops.h.inc -gen-op-decls)
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
add_public_tablegen_target(ToyCh4OpsIncGen)
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)

View File

@ -1,4 +1,3 @@
include_directories(include)
add_subdirectory(include)
set(LLVM_LINK_COMPONENTS
@ -6,7 +5,7 @@ set(LLVM_LINK_COMPONENTS
)
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
mlir_tablegen(ToyCombine.inc -gen-rewriters)
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
add_public_tablegen_target(ToyCh5CombineIncGen)
add_toy_chapter(toyc-ch5
@ -24,6 +23,7 @@ add_toy_chapter(toyc-ch5
ToyCh5CombineIncGen
)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)

View File

@ -1,6 +1,6 @@
set(LLVM_TARGET_DEFINITIONS Ops.td)
mlir_tablegen(Ops.h.inc -gen-op-decls)
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
add_public_tablegen_target(ToyCh5OpsIncGen)
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)

View File

@ -1,4 +1,3 @@
include_directories(include)
add_subdirectory(include)
set(LLVM_LINK_COMPONENTS
@ -7,7 +6,7 @@ set(LLVM_LINK_COMPONENTS
)
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
mlir_tablegen(ToyCombine.inc -gen-rewriters)
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
add_public_tablegen_target(ToyCh6CombineIncGen)
add_toy_chapter(toyc-ch6
@ -26,6 +25,7 @@ add_toy_chapter(toyc-ch6
ToyCh6CombineIncGen
)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)

View File

@ -1,6 +1,6 @@
set(LLVM_TARGET_DEFINITIONS Ops.td)
mlir_tablegen(Ops.h.inc -gen-op-decls)
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
add_public_tablegen_target(ToyCh6OpsIncGen)
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)

View File

@ -1,4 +1,3 @@
include_directories(include)
add_subdirectory(include)
set(LLVM_LINK_COMPONENTS
@ -7,7 +6,7 @@ set(LLVM_LINK_COMPONENTS
)
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
mlir_tablegen(ToyCombine.inc -gen-rewriters)
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
add_public_tablegen_target(ToyCh7CombineIncGen)
add_toy_chapter(toyc-ch7
@ -26,6 +25,7 @@ add_toy_chapter(toyc-ch7
ToyCh7CombineIncGen
)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)

View File

@ -1,6 +1,6 @@
set(LLVM_TARGET_DEFINITIONS Ops.td)
mlir_tablegen(Ops.h.inc -gen-op-decls)
mlir_tablegen(Ops.cpp.inc -gen-op-defs)
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..")
add_public_tablegen_target(ToyCh7OpsIncGen)
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td)