Stella Laurenzo | c35d8e9 | 2023-12-28 21:41:56 -0800 | [diff] [blame] | 1 | iree_setup_c_src_root( |
| 2 | PACKAGE_ROOT_PREFIX iree::compiler::bindings::c |
| 3 | DEFAULT_EXPORT_SET Compiler |
| 4 | DEFAULT_INSTALL_COMPONENT IREEDevLibraries-Compiler |
| 5 | ) |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 6 | |
| 7 | ### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_ABOVE_THIS_LINE ### |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 8 | ################################################################################ |
| 9 | # Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from # |
Geoffrey Martin-Noble | 8626fdb | 2023-03-17 09:47:15 -0700 | [diff] [blame] | 10 | # compiler/bindings/c/BUILD.bazel # |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 11 | # # |
| 12 | # Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary # |
| 13 | # CMake-only content. # |
| 14 | # # |
| 15 | # To disable autogeneration for this file entirely, delete this header. # |
| 16 | ################################################################################ |
| 17 | |
| 18 | iree_add_all_subdirs() |
| 19 | |
| 20 | iree_cc_library( |
| 21 | NAME |
| 22 | headers |
| 23 | HDRS |
| 24 | "iree/compiler/api_support.h" |
| 25 | "iree/compiler/embedding_api.h" |
| 26 | "iree/compiler/loader.h" |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 27 | "iree/compiler/mlir_interop.h" |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 28 | "iree/compiler/tool_entry_points_api.h" |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 29 | DEPS |
| 30 | IREELLVMIncludeSetup |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 31 | INCLUDES |
| 32 | "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>" |
| 33 | "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/.>" |
| 34 | PUBLIC |
| 35 | ) |
| 36 | |
| 37 | iree_cc_library( |
| 38 | NAME |
| 39 | loader |
| 40 | SRCS |
| 41 | "iree/compiler/loader/handle_symbols.inc" |
| 42 | "iree/compiler/loader/loader.cpp" |
| 43 | DEPS |
| 44 | ${CMAKE_DL_LIBS} |
| 45 | ::headers |
| 46 | PUBLIC |
| 47 | ) |
| 48 | |
| 49 | ### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ### |
| 50 | |
| 51 | # TODO: Make this test work with Bazel once that is more solid. |
| 52 | |
| 53 | if(IREE_HAVE_DYNAMIC_LIBRARY_LOADING) |
| 54 | # Dynamic library loading enabled. |
| 55 | if(IREE_BUILD_COMPILER AND IREE_BUILD_TESTS) |
| 56 | iree_cc_test( |
| 57 | NAME |
| 58 | loader_test |
| 59 | SRCS |
| 60 | "iree/compiler/loader/loader_test.c" |
| 61 | ARGS |
Stella Laurenzo | 6dd9de8 | 2023-03-07 19:02:25 -0800 | [diff] [blame] | 62 | "$<TARGET_FILE:iree::compiler::API::SharedImpl>" |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 63 | DEPS |
| 64 | ::loader |
| 65 | ) |
| 66 | |
| 67 | # Must be a build dependency but not a library dep (we depend on it at |
| 68 | # runtime). |
| 69 | # TODO: Find a better way to do this. |
| 70 | add_dependencies( |
| 71 | iree_compiler_bindings_c_loader_test |
Stella Laurenzo | 6dd9de8 | 2023-03-07 19:02:25 -0800 | [diff] [blame] | 72 | iree::compiler::API::SharedImpl |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 73 | ) |
| 74 | endif() |
| 75 | else() |
| 76 | # Dynamic library loading not available. Exclude loader from all. |
| 77 | message(STATUS "Disabling compiler loader (platform does not support library loading)") |
| 78 | iree_cc_library_exclude_from_all(loader TRUE) |
| 79 | endif() |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 80 | |
| 81 | # Install public mlir-c headers (since we export them from our library). |
| 82 | # Scan the MLIR_INCLUDE_DIRS and install any that contains mlir-c. This |
| 83 | # will work for both bundled and installed LLVM. |
| 84 | # We could filter this, but it is just some C headers and easier to include |
| 85 | # them all. |
| 86 | foreach(_d ${MLIR_INCLUDE_DIRS}) |
| 87 | if(EXISTS "${_d}/mlir-c") |
| 88 | install( |
| 89 | DIRECTORY "${_d}/mlir-c" |
| 90 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} |
| 91 | COMPONENT IREEDevLibraries-Compiler |
| 92 | EXCLUDE_FROM_ALL |
Scott Todd | 62efaee | 2024-05-31 13:33:55 -0700 | [diff] [blame] | 93 | ) |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 94 | endif() |
| 95 | endforeach() |