CMAKE_BUILD_TYPESets the build type. Possible values are Release, Debug, RelWithDebInfo and MinSizeRel. If unset, build type is set to Release.
CMAKE_<LANG>_COMPILERThis is the command that will be used as the <LANG> compiler, which are C and CXX in IREE. These variables are set to compile IREE with clang or rather clang++. Once set, these variables can not be changed.
This gives a brief explanation of IREE specific CMake options and variables.
IREE_ENABLE_RUNTIME_TRACINGEnables instrumented runtime tracing. Defaults to OFF.
IREE_ENABLE_COMPILER_TRACINGEnables instrumented compiler tracing. This requires that IREE_ENABLE_RUNTIME_TRACING also be set. Defaults to OFF.
IREE_BUILD_COMPILERBuilds the IREE compiler. Defaults to ON.
IREE_BUILD_TESTSBuilds IREE unit tests. Defaults to ON.
IREE_BUILD_BENCHMARKSBuilds IREE benchmarks. Defaults to ON. Forced ON when IREE_BUILD_TESTS=ON.
IREE_BUILD_DOCSBuilds IREE documentation files. Defaults to OFF.
IREE_BUILD_SAMPLESBuilds IREE sample projects. Defaults to ON.
IREE_BUILD_PYTHON_BINDINGSBuilds the IREE python bindings. Defaults to OFF.
IREE_BUILD_BINDINGS_TFLITEBuilds the IREE TFLite C API compatibility shim. Defaults to ON.
IREE_BUILD_BINDINGS_TFLITE_JAVABuilds the IREE TFLite Java bindings with the C API compatibility shim. Defaults to ON.
IREE_HAL_DRIVER_DEFAULTSDefault setting for each IREE_HAL_DRIVER_* option.
IREE_HAL_DRIVER_*Individual options enabling the build for each runtime HAL driver:
IREE_HAL_DRIVER_CUDAIREE_HAL_DRIVER_HIPIREE_HAL_DRIVER_LOCAL_SYNCIREE_HAL_DRIVER_LOCAL_TASKIREE_HAL_DRIVER_VULKANIREE_HAL_DRIVER_METALIREE_TARGET_BACKEND_DEFAULTSDefault setting for each IREE_TARGET_BACKEND_* option.
IREE_TARGET_BACKEND_*Individual options enabling the build for each compiler target backend:
IREE_TARGET_BACKEND_VMVXIREE_TARGET_BACKEND_LLVM_CPUIREE_TARGET_BACKEND_LLVM_CPU_WASMIREE_TARGET_BACKEND_METAL_SPIRVIREE_TARGET_BACKEND_VULKAN_SPIRVIREE_TARGET_BACKEND_ROCMIREE_INPUT_*Individual options enabling each set of input dialects:
IREE_INPUT_STABLEHLOIREE_INPUT_TORCHIREE_INPUT_TOSAIREE_OUTPUT_FORMAT_CEnables the vm-c compiler output format, using MLIR EmitC. Defaults to ON.
IREE_DEV_MODEConfigure settings to optimize for IREE development (as opposed to CI or release). Defaults to OFF. For example, this will downgrade some compiler diagnostics from errors to warnings.
IREE_ENABLE_LLDUse lld when linking. Defaults to OFF. This option is equivalent to -DIREE_USE_LINKER=lld. The option IREE_ENABLE_LLD and IREE_USE_LINKER can not be set at the same time.
IREE_ENABLE_ASANEnable address sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_MSANEnable memory sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_TSANEnable thread sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_UBSANEnable undefined behavior sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_RUNTIME_COVERAGEEnable LLVM code coverage for the runtime code. All runtime libraries and binaries will be compiled with instrumentation and CMake targets will be exposed for performing common coverage tasks.
iree-runtime-coverage-exportMerges and export coverage data to coverage/runtime.lcov.info. All of coverage/runtime/*.profraw files will be merged as if they had been produced in the same run, written to coverage/runtime.profdata, and then exported into LCOV format.
iree-runtime-coverage-clear-allErases all coverage/runtime* files (.profraw/.profdata/*.info). Invoke this to completely clear all collected coverage data.
iree-runtime-coverage-clear-artifactsErases only merged coverage/runtime.* files (.profdata/.info). Invoke this after adding more *.profraw files to update the coverage.
VSCode can be configured with these targets/artifacts to show coverage information by adding the following workspace configuration:
"cmake.preRunCoverageTarget": "iree-runtime-coverage-clear-all", "cmake.postRunCoverageTarget": "iree-runtime-coverage-export", "cmake.coverageInfoFiles": [ "${command:cmake.buildDirectory}/coverage/runtime.lcov.info" ],
Coverage runs with the Test Explorer will clear, accumulate coverage for each test selected, and then export an LCOV file that will be rendered in the coverage panel/overlay.
See the VSCode Testing Documentation for more information.
When cross compiling (using a toolchain file like android.toolchain.cmake), first build and install IREE's tools for your host configuration, then use the IREE_HOST_BIN_DIR CMake option to point the cross compiled build at the host tools.