Skip to content

Commit 0b8e41c

Browse files
aus-inteligcbot
authored andcommitted
Add helper macro for tablegen
Macro will append current source and binary directories to tablegen include directories.
1 parent 12f0b05 commit 0b8e41c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

IGC/Options/include/igc/Options/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
#============================ end_copyright_notice =============================
2424

2525
set(LLVM_TARGET_DEFINITIONS Options.td)
26-
tablegen(LLVM Options.inc -gen-opt-parser-defs)
26+
igc_tablegen(LLVM Options.inc -gen-opt-parser-defs)
2727
add_public_tablegen_target(IGCOptionsTablegen)

IGC/cmake/igc_llvm_utils.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,13 @@ macro(igc_find_external_lit)
8989
message(FATAL_ERROR "llvm-lit is not found, please specify it with LLVM_EXTERNAL_LIT variable")
9090
endif()
9191
endmacro()
92+
93+
# Helper macro to add tablegenning and set
94+
# include flags for current directories.
95+
macro(igc_tablegen)
96+
set(_old_flags ${LLVM_TABLEGEN_FLAGS})
97+
list(APPEND LLVM_TABLEGEN_FLAGS "-I=${CMAKE_CURRENT_SOURCE_DIR}" "-I=${CMAKE_CURRENT_BINARY_DIR}")
98+
tablegen(${ARGN})
99+
set(LLVM_TABLEGEN_FLAGS ${_old_flags})
100+
unset(_old_flags)
101+
endmacro()

0 commit comments

Comments
 (0)