Temporary workaround to exclude adding LLVM include directories when … …not using the bundled LLVM. Closes https://github.com/google/iree/pull/2193 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/iree/pull/2193 from stellaraccident:llvmfix1 a178757ce09777890ed08ea46b8926ec1df0d2b8 PiperOrigin-RevId: 316019310
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ee931a..a19ab82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -220,6 +220,9 @@ if(${IREE_MLIR_DEP_MODE} STREQUAL "DISABLED") message(STATUS "Not adding MLIR/LLVM dep due to IREE_MLIR_DEP_MODE=DISABLED") elseif(${IREE_MLIR_DEP_MODE} STREQUAL "BUNDLED") + # TODO: See iree_copts.cmake where it sets include directories for this + # case. This should be cleaned up to be all in one place or the other for + # all modes. message(STATUS "Adding bundled LLVM source dependency") add_iree_mlir_src_dep("third_party/llvm-project") elseif(${IREE_MLIR_DEP_MODE} STREQUAL "INSTALLED") @@ -363,3 +366,6 @@ if(${IREE_BUILD_PYTHON_BINDINGS}) iree_complete_py_extension_link_options() endif() + +set(IREE_PUBLIC_INCLUDE_DIRS "${IREE_COMMON_INCLUDE_DIRS}" + CACHE INTERNAL "IREE: Include Directories" FORCE)
diff --git a/build_tools/cmake/iree_copts.cmake b/build_tools/cmake/iree_copts.cmake index f3b2cf3..cec163a 100644 --- a/build_tools/cmake/iree_copts.cmake +++ b/build_tools/cmake/iree_copts.cmake
@@ -137,12 +137,15 @@ set(LLVM_USE_LINKER ${IREE_USE_LINKER} CACHE STRING "" FORCE) endif() -list(APPEND IREE_COMMON_INCLUDE_DIRS - ${PROJECT_SOURCE_DIR}/third_party/llvm-project/llvm/include - ${PROJECT_BINARY_DIR}/third_party/llvm-project/llvm/include - ${PROJECT_SOURCE_DIR}/third_party/llvm-project/mlir/include - ${PROJECT_BINARY_DIR}/third_party/llvm-project/llvm/tools/mlir/include -) +# TODO: This should go in add_iree_mlir_src_dep at the top level. +if(IREE_MLIR_DEP_MODE STREQUAL "BUNDLED") + list(APPEND IREE_COMMON_INCLUDE_DIRS + ${PROJECT_SOURCE_DIR}/third_party/llvm-project/llvm/include + ${PROJECT_BINARY_DIR}/third_party/llvm-project/llvm/include + ${PROJECT_SOURCE_DIR}/third_party/llvm-project/mlir/include + ${PROJECT_BINARY_DIR}/third_party/llvm-project/llvm/tools/mlir/include + ) +endif() set(MLIR_TABLEGEN_EXE mlir-tblgen) set(IREE_TABLEGEN_EXE iree-tblgen)