llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Nathan Lanza (lanza) <details> <summary>Changes</summary> Introduce a cmake variable that guards the inclusion of ClangIR into the build of clang. Guard that we aren't trying to build without MLIR. Add two subdirectories that, as of now, don't do anything. --- Full diff: https://github.com/llvm/llvm-project/pull/86078.diff 7 Files Affected: - (modified) clang/CMakeLists.txt (+7) - (added) clang/include/clang/CIR/CMakeLists.txt () - (modified) clang/include/clang/CMakeLists.txt (+3) - (modified) clang/include/clang/Config/config.h.cmake (+3) - (added) clang/lib/CIR/CMakeLists.txt () - (modified) clang/lib/CMakeLists.txt (+4) - (modified) clang/test/CMakeLists.txt (+1) ``````````diff diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 47fc2e4886cfc2..0e2e9dbf7b2528 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -164,6 +164,13 @@ if(CLANG_ENABLE_LIBXML2) endif() endif() +if(CLANG_ENABLE_CIR) + if (NOT "${LLVM_ENABLE_PROJECTS}" MATCHES "MLIR|mlir") + message(FATAL_ERROR + "Cannot build ClangIR without MLIR in LLVM_ENABLE_PROJECTS") + endif() +endif() + include(CheckIncludeFile) check_include_file(sys/resource.h CLANG_HAVE_RLIMITS) diff --git a/clang/include/clang/CIR/CMakeLists.txt b/clang/include/clang/CIR/CMakeLists.txt new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/clang/include/clang/CMakeLists.txt b/clang/include/clang/CMakeLists.txt index 0dc9ea5ed8ac8a..47ac70cd21690f 100644 --- a/clang/include/clang/CMakeLists.txt +++ b/clang/include/clang/CMakeLists.txt @@ -1,5 +1,8 @@ add_subdirectory(AST) add_subdirectory(Basic) +if(CLANG_ENABLE_CIR) + add_subdirectory(CIR) +endif() add_subdirectory(Driver) add_subdirectory(Parse) add_subdirectory(Sema) diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake index 4015ac8040861c..27ed69e21562bf 100644 --- a/clang/include/clang/Config/config.h.cmake +++ b/clang/include/clang/Config/config.h.cmake @@ -83,4 +83,7 @@ /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */ #cmakedefine01 CLANG_SPAWN_CC1 +/* Whether CIR is built into Clang */ +#cmakedefine01 CLANG_ENABLE_CIR + #endif diff --git a/clang/lib/CIR/CMakeLists.txt b/clang/lib/CIR/CMakeLists.txt new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/clang/lib/CMakeLists.txt b/clang/lib/CMakeLists.txt index 0cac86451f39e4..14ba55360fe050 100644 --- a/clang/lib/CMakeLists.txt +++ b/clang/lib/CMakeLists.txt @@ -31,3 +31,7 @@ if(CLANG_INCLUDE_TESTS) endif() add_subdirectory(Interpreter) add_subdirectory(Support) + +if(CLANG_ENABLE_CIR) + add_subdirectory(CIR) +endif() diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index fcfca354f4a75f..df34a5707da33e 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -9,6 +9,7 @@ llvm_canonicalize_cmake_booleans( CLANG_ENABLE_STATIC_ANALYZER CLANG_PLUGIN_SUPPORT CLANG_SPAWN_CC1 + CLANG_ENABLE_CIR ENABLE_BACKTRACES LLVM_ENABLE_ZLIB LLVM_ENABLE_ZSTD `````````` </details> https://github.com/llvm/llvm-project/pull/86078 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits