llvm.org GIT mirror llvm / dc209b8
[CMake] tablegen(): Use -I <dir> according to the list by include_directories(). For now, local_tds and global_tds are integrated to dependent_tds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200150 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 6 years ago
1 changed file(s) with 17 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
22 # Adds the name of the generated file to TABLEGEN_OUTPUT.
33
44 function(tablegen project ofn)
5 file(GLOB local_tds "*.td")
6 file(GLOB_RECURSE global_tds "${LLVM_MAIN_INCLUDE_DIR}/llvm/*.td")
5 # Use the list by include_directories().
6 get_property(include_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
7
8 # Collect possible dependent *.td(s).
9 # FIXME: It is far from optimal.
10 file(GLOB dependent_tds "*.td")
11 foreach(inc ${include_dirs})
12 file(GLOB tds "${inc}/*.td")
13 list(APPEND dependent_tds ${tds})
14 endforeach()
715
816 if (IS_ABSOLUTE ${LLVM_TARGET_DEFINITIONS})
917 set(LLVM_TARGET_DEFINITIONS_ABSOLUTE ${LLVM_TARGET_DEFINITIONS})
1119 set(LLVM_TARGET_DEFINITIONS_ABSOLUTE
1220 ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS})
1321 endif()
22 foreach(inc ${include_dirs})
23 list(APPEND TABLEGEN_INCLUDE_DIRECTORIES -I ${inc})
24 endforeach()
1425 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
1526 # Generate tablegen output in a temporary file.
16 COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
17 -I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR}
27 COMMAND ${${project}_TABLEGEN_EXE} ${ARGN}
28 -I ${CMAKE_CURRENT_SOURCE_DIR}
29 ${TABLEGEN_INCLUDE_DIRECTORIES}
1830 ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
1931 -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
2032 # The file in LLVM_TARGET_DEFINITIONS may be not in the current
2133 # directory and local_tds may not contain it, so we must
2234 # explicitly list it here:
23 DEPENDS ${${project}_TABLEGEN_EXE} ${local_tds} ${global_tds}
35 DEPENDS ${${project}_TABLEGEN_EXE} ${dependent_tds}
2436 ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
2537 COMMENT "Building ${ofn}..."
2638 )