HomePhabricator

[mlir][CMAKE] Fix cross-compilation build

Authored by vinograd47 on Mar 4 2021, 9:24 AM.

Description

[mlir][CMAKE] Fix cross-compilation build

Use MLIR_LINALG_ODS_GEN and MLIR_LINALG_ODS_YAML_GEN variables
instead of MLIR_LINALG_ODS_GEN_EXE and MLIR_LINALG_ODS_YAML_GEN_EXE.
The former are defined in PARENT SCOPE only, so the if condition
is never evaluates to TRUE.

The logic should be the following (taken from tblgen part):

  1. TOOL_NAME - CACHE variable (default equal to target name). User can override it to actual executable path.
  2. TOOL_NAME_EXE - internal variable, initialized to ${TOOL_NAME} first. In case of cross-compilation (LLVM_USE_HOST_TOOLS == TRUE) if user didn't set own path to native executable via TOOL_NAME variable, CMake will create separate targets to build native tool and will override TOOL_NAME_EXE to the executable produced by this target.
  3. TOOL_NAME_TARGET - internal variable, which points to tool target name. If the native tool is built as described above, it will point to the target correspondant to that native tool.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D98025

Details