This is an archive of the discontinued LLVM Phabricator instance.

[mlir][CMAKE] Fix cross-compilation build
ClosedPublic

Authored by vinograd47 on Mar 5 2021, 2:47 AM.

Details

Summary

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.

Diff Detail

Event Timeline

vinograd47 created this revision.Mar 5 2021, 2:47 AM
vinograd47 requested review of this revision.Mar 5 2021, 2:47 AM
mehdi_amini accepted this revision.Mar 5 2021, 12:17 PM
This revision is now accepted and ready to land.Mar 5 2021, 12:17 PM
This revision was automatically updated to reflect the committed changes.