Geoffrey Martin-Noble | 552d3f8 | 2021-05-25 17:56:09 -0700 | [diff] [blame] | 1 | # Copyright 2019 The IREE Authors |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 2 | # |
Geoffrey Martin-Noble | 552d3f8 | 2021-05-25 17:56:09 -0700 | [diff] [blame] | 3 | # Licensed under the Apache License v2.0 with LLVM Exceptions. |
| 4 | # See https://llvm.org/LICENSE.txt for license information. |
| 5 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Ben Vanik | 6b112ef | 2019-10-03 10:45:14 -0700 | [diff] [blame] | 6 | |
Stella Laurenzo | be0f1e1 | 2023-04-03 13:34:38 -0700 | [diff] [blame] | 7 | # Special case package namespace for tools/ -> "" (empty string) |
| 8 | # For example, tools/iree-compile -> iree-compile (no namespace) |
| 9 | set(IREE_PACKAGE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}") |
| 10 | |
Scott Todd | 44f95f8 | 2022-06-01 09:59:32 -0700 | [diff] [blame] | 11 | # Tools IREE provides for compiling, executing, and benchmarking programs, as |
| 12 | # well as other utilities. |
| 13 | # |
| 14 | # Only binary targets and their associated main files should go in this |
| 15 | # directory. Library targets and header files should be placed in the |
| 16 | # appropriate subtree, e.g. `compiler/src/iree/compiler/Tools/`. |
| 17 | # |
Scott Todd | 20d746a | 2023-01-12 09:11:59 -0800 | [diff] [blame] | 18 | # Compiler tools are designed to run on host platforms (Linux, macOS, Windows), |
| 19 | # so they are only built when IREE_BUILD_COMPILER is set and are tagged |
| 20 | # "hostonly". When cross-compiling (or generally wanting to use already-built |
Scott Todd | de426de | 2023-01-13 08:26:02 -0800 | [diff] [blame] | 21 | # compiler tools), set the IREE_HOST_BIN_DIR CMake option. |
Scott Todd | 44f95f8 | 2022-06-01 09:59:32 -0700 | [diff] [blame] | 22 | # |
| 23 | # This file does not use bazel_to_cmake because of special logic throughout. |
Scott Todd | 6132bb3 | 2020-08-11 12:04:40 -0700 | [diff] [blame] | 24 | |
Scott Todd | 20d746a | 2023-01-12 09:11:59 -0800 | [diff] [blame] | 25 | # Write some important CMake options to a file for convenient use from scripts. |
| 26 | configure_file(build_config_template.txt.in build_config.txt) |
| 27 | |
Stella Laurenzo | 863d302 | 2024-01-13 15:20:16 -1000 | [diff] [blame] | 28 | # If cross-compiling and not building the compiler, then attempt to find |
| 29 | # the compiler tools. |
| 30 | # This is actual broken because the situation is tri-state: |
| 31 | # 1. Cross-compiling with no built compiler: Should work the same as |
| 32 | # IREE_BUILD_COMPILER=OFF in a host build (i.e. nothing depending |
| 33 | # on the compiler should be built). |
| 34 | # 2. Cross-compiling with a compiler built for the target: Anything |
| 35 | # on the host which needs the compiler, still must have host tools. |
| 36 | # 3. Normal host build. |
| 37 | # This simplistic setup makes #2 impossible and it overloads #1 to |
| 38 | # also support building things that depend on the compiler. The targets |
| 39 | # need to be aliased/forked for host variants to fully support. For now |
| 40 | # we just make all of these as OPTIONAL and let things break if not set up |
| 41 | # right. |
Scott Todd | de426de | 2023-01-13 08:26:02 -0800 | [diff] [blame] | 42 | if(IREE_HOST_BIN_DIR AND NOT IREE_BUILD_COMPILER) |
Stella Laurenzo | 863d302 | 2024-01-13 15:20:16 -1000 | [diff] [blame] | 43 | iree_import_binary(NAME iree-tblgen OPTIONAL) |
| 44 | iree_import_binary(NAME iree-compile OPTIONAL) |
| 45 | iree_import_binary(NAME iree-opt OPTIONAL) |
| 46 | iree_import_binary(NAME iree-run-mlir OPTIONAL) |
Scott Todd | 315e238 | 2024-01-30 13:35:51 -0800 | [diff] [blame] | 47 | iree_import_binary(NAME FileCheck OPTIONAL) |
| 48 | iree_import_binary(NAME not OPTIONAL) |
Stella Laurenzo | 863d302 | 2024-01-13 15:20:16 -1000 | [diff] [blame] | 49 | iree_import_binary(NAME clang OPTIONAL) |
| 50 | iree_import_binary(NAME llvm-link OPTIONAL) |
Scott Todd | 20d746a | 2023-01-12 09:11:59 -0800 | [diff] [blame] | 51 | endif() |
| 52 | |
Scott Todd | 315e238 | 2024-01-30 13:35:51 -0800 | [diff] [blame] | 53 | # For sub-directories, we want targets fully qualified relative to the |
| 54 | # root. But after, we want those in *this* directory to be unqualified |
| 55 | # (i.e. 'iree-compile'). |
| 56 | set(IREE_PACKAGE_ROOT_PREFIX "iree/tools") |
| 57 | iree_add_all_subdirs() |
| 58 | set(IREE_PACKAGE_ROOT_PREFIX "") |
| 59 | |
Scott Todd | 4c022df | 2022-05-10 16:55:18 -0700 | [diff] [blame] | 60 | # TODO(#6353): Tools has thread dependencies in gtest, benchmark, yaml, etc. |
| 61 | # This should be split between runtime/compiler with optional threading support. |
Scott Todd | e93f0ee | 2022-05-03 12:06:29 -0700 | [diff] [blame] | 62 | if(NOT IREE_ENABLE_THREADING) |
Cindy Liu | 331946c | 2021-06-01 12:20:30 -0700 | [diff] [blame] | 63 | return() |
| 64 | endif() |
| 65 | |
Geoffrey Martin-Noble | 3419026 | 2020-02-06 10:43:58 -0800 | [diff] [blame] | 66 | iree_cc_binary( |
| 67 | NAME |
Ben Vanik | 23f2828 | 2024-02-23 11:14:25 -0800 | [diff] [blame] | 68 | iree-benchmark-executable |
| 69 | SRCS |
| 70 | "iree-benchmark-executable-main.c" |
| 71 | DEPS |
| 72 | iree::base |
| 73 | iree::base::internal::flags |
| 74 | iree::hal |
| 75 | iree::modules::hal::types |
| 76 | iree::testing::benchmark |
| 77 | iree::tooling::device_util |
| 78 | iree::tooling::function_io |
| 79 | iree::vm |
| 80 | INSTALL_COMPONENT IREETools-Runtime |
| 81 | ) |
| 82 | |
| 83 | iree_cc_binary( |
| 84 | NAME |
Geoffrey Martin-Noble | 3419026 | 2020-02-06 10:43:58 -0800 | [diff] [blame] | 85 | iree-benchmark-module |
Geoffrey Martin-Noble | 3419026 | 2020-02-06 10:43:58 -0800 | [diff] [blame] | 86 | SRCS |
Geoffrey Martin-Noble | 0a6b9cc | 2020-09-22 20:17:05 -0700 | [diff] [blame] | 87 | "iree-benchmark-module-main.cc" |
Geoffrey Martin-Noble | 3419026 | 2020-02-06 10:43:58 -0800 | [diff] [blame] | 88 | DEPS |
Geoffrey Martin-Noble | 3419026 | 2020-02-06 10:43:58 -0800 | [diff] [blame] | 89 | benchmark |
Ben Vanik | 931a3b1 | 2021-05-20 13:27:13 -0700 | [diff] [blame] | 90 | iree::base |
Ben Vanik | e28d253 | 2021-02-03 13:44:24 -0800 | [diff] [blame] | 91 | iree::base::internal::flags |
Ben Vanik | 931a3b1 | 2021-05-20 13:27:13 -0700 | [diff] [blame] | 92 | iree::hal |
Ben Vanik | e9ae963 | 2022-10-04 08:13:30 -0700 | [diff] [blame] | 93 | iree::modules::hal::types |
Ben Vanik | 007109f | 2022-08-03 07:26:50 -0700 | [diff] [blame] | 94 | iree::tooling::context_util |
Ben Vanik | 097d826 | 2022-06-09 11:35:04 -0700 | [diff] [blame] | 95 | iree::tooling::device_util |
Ben Vanik | 30901f5 | 2024-02-08 11:23:21 -0800 | [diff] [blame] | 96 | iree::tooling::function_io |
Ben Vanik | e8a9ec4 | 2020-07-16 22:04:57 -0700 | [diff] [blame] | 97 | iree::vm |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 98 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | 50e46cd | 2021-06-28 10:19:35 -0700 | [diff] [blame] | 99 | ) |
| 100 | |
| 101 | iree_cc_binary( |
| 102 | NAME |
inho9606 | 995d0b7 | 2021-01-05 17:07:16 +0900 | [diff] [blame] | 103 | iree-check-module |
inho9606 | 995d0b7 | 2021-01-05 17:07:16 +0900 | [diff] [blame] | 104 | SRCS |
| 105 | "iree-check-module-main.cc" |
| 106 | DEPS |
Ben Vanik | 7c2d310 | 2021-04-30 10:32:55 -0700 | [diff] [blame] | 107 | iree::base |
Ben Vanik | 5507c6e | 2021-02-02 21:27:08 -0800 | [diff] [blame] | 108 | iree::base::internal::file_io |
Ben Vanik | e28d253 | 2021-02-03 13:44:24 -0800 | [diff] [blame] | 109 | iree::base::internal::flags |
Ben Vanik | 931a3b1 | 2021-05-20 13:27:13 -0700 | [diff] [blame] | 110 | iree::hal |
Ben Vanik | d2f24f0 | 2021-06-21 09:13:53 -0700 | [diff] [blame] | 111 | iree::modules::check |
inho9606 | 995d0b7 | 2021-01-05 17:07:16 +0900 | [diff] [blame] | 112 | iree::testing::gtest |
Ben Vanik | bcec0b5 | 2022-08-06 08:45:46 -0700 | [diff] [blame] | 113 | iree::tooling::context_util |
Ben Vanik | 7859d63 | 2022-10-24 14:37:28 -0700 | [diff] [blame] | 114 | iree::tooling::device_util |
Ben Vanik | 931a3b1 | 2021-05-20 13:27:13 -0700 | [diff] [blame] | 115 | iree::vm |
Ben Vanik | cf49d69 | 2023-02-24 20:24:09 -0800 | [diff] [blame] | 116 | iree::vm::bytecode::module |
inho9606 | 995d0b7 | 2021-01-05 17:07:16 +0900 | [diff] [blame] | 117 | TESTONLY |
| 118 | ) |
| 119 | |
| 120 | iree_cc_binary( |
| 121 | NAME |
Ben Vanik | fce839f | 2023-11-28 17:12:58 -0800 | [diff] [blame] | 122 | iree-convert-parameters |
| 123 | SRCS |
| 124 | "iree-convert-parameters-main.c" |
| 125 | DEPS |
| 126 | iree::base |
| 127 | iree::base::internal::file_io |
| 128 | iree::base::internal::flags |
| 129 | iree::hal |
| 130 | iree::io::formats::irpa |
| 131 | iree::io::parameter_index |
| 132 | iree::io::scope_map |
| 133 | iree::tooling::parameter_util |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 134 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | fce839f | 2023-11-28 17:12:58 -0800 | [diff] [blame] | 135 | ) |
| 136 | |
| 137 | iree_cc_binary( |
| 138 | NAME |
Ben Vanik | 0635b09 | 2023-03-28 13:03:38 -0700 | [diff] [blame] | 139 | iree-cpuinfo |
| 140 | SRCS |
| 141 | "iree-cpuinfo.c" |
| 142 | DEPS |
| 143 | iree::base |
| 144 | iree::base::internal::cpu |
| 145 | iree::schemas::cpu_data |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 146 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | 0635b09 | 2023-03-28 13:03:38 -0700 | [diff] [blame] | 147 | ) |
| 148 | |
| 149 | iree_cc_binary( |
| 150 | NAME |
Ben Vanik | fce839f | 2023-11-28 17:12:58 -0800 | [diff] [blame] | 151 | iree-create-parameters |
| 152 | SRCS |
| 153 | "iree-create-parameters-main.c" |
| 154 | DEPS |
| 155 | iree::base |
| 156 | iree::base::internal::file_io |
| 157 | iree::base::internal::flags |
| 158 | iree::hal |
| 159 | iree::io::formats::irpa |
| 160 | iree::io::parameter_index |
| 161 | iree::io::scope_map |
| 162 | iree::io::stream |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 163 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | fce839f | 2023-11-28 17:12:58 -0800 | [diff] [blame] | 164 | ) |
| 165 | |
| 166 | iree_cc_binary( |
| 167 | NAME |
Ben Vanik | c319c2d | 2023-02-24 18:18:47 -0800 | [diff] [blame] | 168 | iree-dump-instruments |
| 169 | SRCS |
| 170 | "iree-dump-instruments-main.c" |
| 171 | DEPS |
| 172 | flatcc::runtime |
| 173 | iree::base |
| 174 | iree::base::internal::file_io |
| 175 | iree::base::internal::flatcc::parsing |
| 176 | iree::schemas::instruments |
| 177 | iree::schemas::instruments::dispatch_def_c_fbs |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 178 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | c319c2d | 2023-02-24 18:18:47 -0800 | [diff] [blame] | 179 | ) |
| 180 | |
| 181 | iree_cc_binary( |
| 182 | NAME |
Ben Vanik | ef13fb6 | 2020-02-29 08:49:03 -0800 | [diff] [blame] | 183 | iree-dump-module |
| 184 | SRCS |
Ben Vanik | 35bc9a1 | 2022-03-09 09:05:58 -0800 | [diff] [blame] | 185 | "iree-dump-module-main.c" |
Ben Vanik | ef13fb6 | 2020-02-29 08:49:03 -0800 | [diff] [blame] | 186 | DEPS |
Ben Vanik | 7b8e9f7 | 2020-11-20 17:37:51 -0800 | [diff] [blame] | 187 | flatcc::runtime |
Ben Vanik | 931a3b1 | 2021-05-20 13:27:13 -0700 | [diff] [blame] | 188 | iree::base |
Ben Vanik | 5507c6e | 2021-02-02 21:27:08 -0800 | [diff] [blame] | 189 | iree::base::internal::file_io |
Ben Vanik | 163547a | 2023-05-15 11:59:13 -0700 | [diff] [blame] | 190 | iree::base::internal::flags |
Ben Vanik | b998f1f | 2021-09-16 09:50:12 -0700 | [diff] [blame] | 191 | iree::base::internal::flatcc::debugging |
Ben Vanik | 163547a | 2023-05-15 11:59:13 -0700 | [diff] [blame] | 192 | iree::base::internal::flatcc::parsing |
Ben Vanik | bc685ed | 2020-11-14 17:09:46 -0800 | [diff] [blame] | 193 | iree::schemas::bytecode_module_def_c_fbs |
Ben Vanik | cf49d69 | 2023-02-24 20:24:09 -0800 | [diff] [blame] | 194 | iree::vm::bytecode::module |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 195 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | ef13fb6 | 2020-02-29 08:49:03 -0800 | [diff] [blame] | 196 | ) |
| 197 | |
Ben Vanik | 11ced0c | 2023-11-03 14:24:08 -0700 | [diff] [blame] | 198 | iree_cc_binary( |
| 199 | NAME |
| 200 | iree-dump-parameters |
| 201 | SRCS |
| 202 | "iree-dump-parameters-main.c" |
| 203 | DEPS |
| 204 | iree::base |
| 205 | iree::base::internal::file_io |
| 206 | iree::base::internal::flags |
| 207 | iree::io::parameter_index |
| 208 | iree::io::scope_map |
| 209 | iree::tooling::parameter_util |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 210 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | 11ced0c | 2023-11-03 14:24:08 -0700 | [diff] [blame] | 211 | ) |
| 212 | |
Ben Vanik | 0635b09 | 2023-03-28 13:03:38 -0700 | [diff] [blame] | 213 | # Only enable fatelf tool when we're compiling it in. |
| 214 | # Currently it requires that the host and target both support embedded ELFs as |
| 215 | # the ELF implementation is only compiled when the target supports it. |
Ben Vanik | e19fc8e | 2023-04-14 16:08:01 -0700 | [diff] [blame] | 216 | if(IREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF OR |
| 217 | IREE_HAL_EXECUTABLE_PLUGIN_EMBEDDED_ELF) |
Ben Vanik | 0635b09 | 2023-03-28 13:03:38 -0700 | [diff] [blame] | 218 | iree_cc_binary( |
| 219 | NAME |
| 220 | iree-fatelf |
| 221 | SRCS |
| 222 | "iree-fatelf.c" |
| 223 | DEPS |
| 224 | iree::base |
| 225 | iree::base::internal::file_io |
| 226 | iree::base::internal::path |
| 227 | iree::hal::local::elf::elf_module |
Ben Vanik | ac94b2a | 2024-01-17 07:22:06 -0800 | [diff] [blame] | 228 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | 0635b09 | 2023-03-28 13:03:38 -0700 | [diff] [blame] | 229 | ) |
| 230 | endif() # IREE_HAL_EXECUTABLE_*_EMBEDDED_ELF |
| 231 | |
Marius Brehler | 0c0cd9f | 2020-03-05 15:35:02 -0800 | [diff] [blame] | 232 | iree_cc_binary( |
| 233 | NAME |
| 234 | iree-run-module |
Ben Vanik | ef13fb6 | 2020-02-29 08:49:03 -0800 | [diff] [blame] | 235 | SRCS |
Stella Laurenzo | d318c54 | 2023-04-27 17:08:22 -0700 | [diff] [blame] | 236 | "iree-run-module-main.c" |
Ben Vanik | ef13fb6 | 2020-02-29 08:49:03 -0800 | [diff] [blame] | 237 | DEPS |
Ben Vanik | abe6c76 | 2021-06-27 21:57:07 -0700 | [diff] [blame] | 238 | iree::base |
Ben Vanik | e28d253 | 2021-02-03 13:44:24 -0800 | [diff] [blame] | 239 | iree::base::internal::flags |
Ben Vanik | 007109f | 2022-08-03 07:26:50 -0700 | [diff] [blame] | 240 | iree::hal |
| 241 | iree::tooling::context_util |
Stella Laurenzo | d318c54 | 2023-04-27 17:08:22 -0700 | [diff] [blame] | 242 | iree::tooling::run_module |
Ben Vanik | abe6c76 | 2021-06-27 21:57:07 -0700 | [diff] [blame] | 243 | iree::vm |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 244 | INSTALL_COMPONENT IREETools-Runtime |
Ben Vanik | abe6c76 | 2021-06-27 21:57:07 -0700 | [diff] [blame] | 245 | ) |
| 246 | |
Scott Todd | 1a1aea6 | 2022-04-28 09:12:11 -0700 | [diff] [blame] | 247 | if(IREE_BUILD_COMPILER) |
CindyLiu | ae9b2c0 | 2023-08-23 09:44:40 -0700 | [diff] [blame] | 248 | if(IREE_LLVM_LINK_TARGET) |
| 249 | install( |
| 250 | TARGETS llvm-link |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 251 | COMPONENT IREETools-CompilerExtra |
CindyLiu | ae9b2c0 | 2023-08-23 09:44:40 -0700 | [diff] [blame] | 252 | RUNTIME DESTINATION bin |
| 253 | ) |
| 254 | endif() |
| 255 | |
| 256 | if(IREE_CLANG_TARGET) |
| 257 | install( |
| 258 | TARGETS clang |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 259 | COMPONENT IREETools-CompilerExtra |
CindyLiu | ae9b2c0 | 2023-08-23 09:44:40 -0700 | [diff] [blame] | 260 | RUNTIME DESTINATION bin |
| 261 | ) |
| 262 | endif() |
| 263 | |
Scott Todd | 315e238 | 2024-01-30 13:35:51 -0800 | [diff] [blame] | 264 | if(IREE_FILECHECK_TARGET) |
| 265 | install( |
| 266 | TARGETS FileCheck |
| 267 | COMPONENT IREETools-CompilerDev |
| 268 | RUNTIME DESTINATION bin |
| 269 | ) |
| 270 | endif() |
| 271 | |
| 272 | if(IREE_NOT_TARGET) |
| 273 | install( |
| 274 | TARGETS not |
| 275 | COMPONENT IREETools-CompilerDev |
| 276 | RUNTIME DESTINATION bin |
| 277 | ) |
| 278 | endif() |
| 279 | |
Stella Laurenzo | ae70815 | 2023-06-22 21:51:59 -0700 | [diff] [blame] | 280 | # Tablegen binaries are special snowflakes among special snowflakes. |
| 281 | # They must be statically linked against internal LLVM libraries, and they |
| 282 | # therefore must not depend on anything outside of the upstream tablegen |
| 283 | # libraries. These targets are specially set up to link in the correct |
| 284 | # way. This is a necessary diversion from how Bazel deals with it (which |
| 285 | # must deep-link to everything to satisfy its checks). |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 286 | iree_cc_binary( |
| 287 | NAME |
| 288 | iree-tblgen |
| 289 | SRCS |
Stella Laurenzo | ae70815 | 2023-06-22 21:51:59 -0700 | [diff] [blame] | 290 | "iree-tblgen.cpp" |
Stella Laurenzo | 41a2ceb | 2022-04-29 12:49:36 -0700 | [diff] [blame] | 291 | "${IREE_SOURCE_DIR}/compiler/src/iree/compiler/Dialect/VM/Tools/VMOpEncoderGen.cpp" |
| 292 | "${IREE_SOURCE_DIR}/compiler/src/iree/compiler/Dialect/VM/Tools/VMOpTableGen.cpp" |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 293 | DEPS |
Oleksandr "Alex" Zinenko | 7b28a41 | 2023-06-29 22:06:18 +0200 | [diff] [blame] | 294 | LLVMSupport |
Thomas | 4c2029f | 2022-08-15 19:20:14 -0700 | [diff] [blame] | 295 | MLIRTblgenLib |
Lei Zhang | 0d281b7 | 2020-06-01 20:00:23 -0400 | [diff] [blame] | 296 | HOSTONLY |
Oleksandr "Alex" Zinenko | 7b28a41 | 2023-06-29 22:06:18 +0200 | [diff] [blame] | 297 | DISABLE_LLVM_LINK_LLVM_DYLIB |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 298 | INSTALL_COMPONENT IREETools-CompilerDev |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 299 | ) |
Stella Laurenzo | 0603415 | 2020-01-03 11:26:31 -0800 | [diff] [blame] | 300 | |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 301 | iree_cc_binary( |
| 302 | NAME |
Stella Laurenzo | 7f2972c | 2022-03-19 14:09:43 -0700 | [diff] [blame] | 303 | iree-compile |
Stella Laurenzo | ae1c3a2 | 2022-03-17 11:17:58 -0700 | [diff] [blame] | 304 | SRCS |
Stella Laurenzo | 7f2972c | 2022-03-19 14:09:43 -0700 | [diff] [blame] | 305 | "iree-compile-main.cc" |
Stella Laurenzo | ae1c3a2 | 2022-03-17 11:17:58 -0700 | [diff] [blame] | 306 | DEPS |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 307 | iree::compiler::bindings::c::headers |
Stella Laurenzo | 6dd9de8 | 2023-03-07 19:02:25 -0800 | [diff] [blame] | 308 | iree::compiler::API::Impl |
Stella Laurenzo | ae1c3a2 | 2022-03-17 11:17:58 -0700 | [diff] [blame] | 309 | DATA |
| 310 | ${IREE_LLD_TARGET} |
| 311 | HOSTONLY |
Stella Laurenzo | 7ec09ce | 2022-11-24 11:13:52 -0800 | [diff] [blame] | 312 | SETUP_INSTALL_RPATH |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 313 | INSTALL_COMPONENT IREETools-Compiler |
Stella Laurenzo | ae1c3a2 | 2022-03-17 11:17:58 -0700 | [diff] [blame] | 314 | ) |
| 315 | |
Scott Todd | 44f95f8 | 2022-06-01 09:59:32 -0700 | [diff] [blame] | 316 | iree_cc_binary( |
Scott Todd | 1f1ef56 | 2022-05-10 08:47:32 -0700 | [diff] [blame] | 317 | NAME |
Kunwar Grover | 60a2566 | 2023-09-29 03:30:21 +0530 | [diff] [blame] | 318 | iree-reduce |
| 319 | SRCS |
| 320 | "iree-reduce.cc" |
| 321 | DEPS |
| 322 | iree::compiler::bindings::c::headers |
| 323 | iree::compiler::API::Impl |
| 324 | DATA |
| 325 | ${IREE_LLD_TARGET} |
| 326 | HOSTONLY |
| 327 | SETUP_INSTALL_RPATH |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 328 | INSTALL_COMPONENT IREETools-Compiler |
Kunwar Grover | 60a2566 | 2023-09-29 03:30:21 +0530 | [diff] [blame] | 329 | ) |
| 330 | |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 331 | # Only build IREE's busybox lld if the backing LLVM has LLD enabled. |
| 332 | # Otherwise, it will build but fail at runtime saying that it is not |
| 333 | # supported, and this fouls up tools search heuristics. |
| 334 | if(IREE_LLD_TARGET) |
| 335 | iree_cc_binary( |
| 336 | NAME |
| 337 | iree-lld |
| 338 | SRCS |
| 339 | "iree-lld-main.cc" |
| 340 | DEPS |
| 341 | iree::compiler::bindings::c::headers |
| 342 | iree::compiler::API::Impl |
| 343 | HOSTONLY |
| 344 | SETUP_INSTALL_RPATH |
| 345 | INSTALL_COMPONENT IREETools-Compiler |
| 346 | ) |
| 347 | endif() |
| 348 | |
Kunwar Grover | 60a2566 | 2023-09-29 03:30:21 +0530 | [diff] [blame] | 349 | iree_cc_binary( |
| 350 | NAME |
Scott Todd | 44f95f8 | 2022-06-01 09:59:32 -0700 | [diff] [blame] | 351 | iree-opt |
Scott Todd | 1f1ef56 | 2022-05-10 08:47:32 -0700 | [diff] [blame] | 352 | SRCS |
| 353 | "iree-opt-main.cc" |
| 354 | DEPS |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 355 | iree::compiler::bindings::c::headers |
Stella Laurenzo | 6dd9de8 | 2023-03-07 19:02:25 -0800 | [diff] [blame] | 356 | iree::compiler::API::Impl |
Ben Vanik | b189c6e | 2021-06-18 13:19:15 -0700 | [diff] [blame] | 357 | DATA |
Stella Laurenzo | 74b04b7 | 2022-03-02 10:21:11 -0800 | [diff] [blame] | 358 | ${IREE_LLD_TARGET} |
Lei Zhang | 0d281b7 | 2020-06-01 20:00:23 -0400 | [diff] [blame] | 359 | HOSTONLY |
Stella Laurenzo | 7ec09ce | 2022-11-24 11:13:52 -0800 | [diff] [blame] | 360 | SETUP_INSTALL_RPATH |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 361 | INSTALL_COMPONENT IREETools-Compiler |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 362 | ) |
Marius Brehler | 0c0cd9f | 2020-03-05 15:35:02 -0800 | [diff] [blame] | 363 | |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 364 | iree_cc_binary( |
| 365 | NAME |
Scott Todd | 111be2e | 2021-06-10 12:56:53 -0700 | [diff] [blame] | 366 | iree-mlir-lsp-server |
| 367 | SRCS |
| 368 | "iree-mlir-lsp-server.cc" |
| 369 | DEPS |
Stella Laurenzo | 309dc5b | 2023-02-22 23:07:43 -0800 | [diff] [blame] | 370 | iree::compiler::bindings::c::headers |
Stella Laurenzo | 6dd9de8 | 2023-03-07 19:02:25 -0800 | [diff] [blame] | 371 | iree::compiler::API::Impl |
Stella Laurenzo | 7ec09ce | 2022-11-24 11:13:52 -0800 | [diff] [blame] | 372 | SETUP_INSTALL_RPATH |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 373 | INSTALL_COMPONENT IREETools-Compiler |
Scott Todd | 111be2e | 2021-06-10 12:56:53 -0700 | [diff] [blame] | 374 | ) |
| 375 | |
| 376 | iree_cc_binary( |
| 377 | NAME |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 378 | iree-run-mlir |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 379 | SRCS |
Geoffrey Martin-Noble | 0a6b9cc | 2020-09-22 20:17:05 -0700 | [diff] [blame] | 380 | "iree-run-mlir-main.cc" |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 381 | DEPS |
Ben Vanik | 7c2d310 | 2021-04-30 10:32:55 -0700 | [diff] [blame] | 382 | iree::base |
Ben Vanik | e28d253 | 2021-02-03 13:44:24 -0800 | [diff] [blame] | 383 | iree::base::internal::flags |
Stella Laurenzo | d318c54 | 2023-04-27 17:08:22 -0700 | [diff] [blame] | 384 | iree::compiler::bindings::c::headers |
| 385 | iree::compiler::API::Impl |
Ben Vanik | 193c760 | 2021-04-30 10:29:15 -0700 | [diff] [blame] | 386 | iree::hal |
Ben Vanik | 007109f | 2022-08-03 07:26:50 -0700 | [diff] [blame] | 387 | iree::tooling::context_util |
Ben Vanik | 097d826 | 2022-06-09 11:35:04 -0700 | [diff] [blame] | 388 | iree::tooling::device_util |
Stella Laurenzo | d318c54 | 2023-04-27 17:08:22 -0700 | [diff] [blame] | 389 | iree::tooling::run_module |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 390 | iree::vm |
Ben Vanik | b189c6e | 2021-06-18 13:19:15 -0700 | [diff] [blame] | 391 | DATA |
Stella Laurenzo | 74b04b7 | 2022-03-02 10:21:11 -0800 | [diff] [blame] | 392 | ${IREE_LLD_TARGET} |
Lei Zhang | 0d281b7 | 2020-06-01 20:00:23 -0400 | [diff] [blame] | 393 | HOSTONLY |
Scott Todd | 45f1137 | 2023-05-02 12:01:39 -0700 | [diff] [blame] | 394 | SETUP_INSTALL_RPATH |
Stella Laurenzo | 15c306f | 2023-12-28 19:03:20 -0800 | [diff] [blame] | 395 | INSTALL_COMPONENT IREETools-Compiler |
Marius Brehler | 1d617e3 | 2020-03-06 15:26:33 -0800 | [diff] [blame] | 396 | ) |
Geoffrey Martin-Noble | b1bc038 | 2021-01-06 11:58:38 -0800 | [diff] [blame] | 397 | |
Ben Vanik | e98a03b | 2022-09-23 14:17:05 -0700 | [diff] [blame] | 398 | # Ensure FileCheck and associated binaries get built. Tests don't have |
| 399 | # dependencies in CMake because they aren't targets. So until we fix that, we |
| 400 | # just force this to get built. |
Geoffrey Martin-Noble | 435c270 | 2022-01-24 15:56:56 -0800 | [diff] [blame] | 401 | # Limiting this to when IREE_BUILD_TESTS is set prevents the installation |
| 402 | # below, which we use for cross-platform testing. |
| 403 | set_target_properties(FileCheck PROPERTIES EXCLUDE_FROM_ALL OFF) |
Ben Vanik | e98a03b | 2022-09-23 14:17:05 -0700 | [diff] [blame] | 404 | set_target_properties(not PROPERTIES EXCLUDE_FROM_ALL OFF) |
Scott Todd | de426de | 2023-01-13 08:26:02 -0800 | [diff] [blame] | 405 | elseif(NOT IREE_HOST_BIN_DIR) |
Scott Todd | 20d746a | 2023-01-12 09:11:59 -0800 | [diff] [blame] | 406 | message(STATUS |
| 407 | "*Not* building or importing IREE's compiler tools.\n " |
Scott Todd | de426de | 2023-01-13 08:26:02 -0800 | [diff] [blame] | 408 | "Set IREE_BUILD_COMPILER to build them or IREE_HOST_BIN_DIR to " |
Scott Todd | 20d746a | 2023-01-12 09:11:59 -0800 | [diff] [blame] | 409 | "import them.") |
| 410 | endif() |