This makes `ninja check-mlir` work without the host targets configured.
/* RUN: mlir-capi-execution-engine-test 2>&1 | FileCheck %s
*/
+/* REQUIRES: llvm_has_native_target
+*/
#include "mlir-c/Conversion.h"
#include "mlir-c/ExecutionEngine.h"
# Passed to lit.site.cfg.py.in to set up the path where to find the libraries.
set(MLIR_INTEGRATION_TEST_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+
+ # The native target may not be enabled when cross compiling, raise an error.
+ if(NOT TARGET ${LLVM_NATIVE_ARCH})
+ message(FATAL_ERROR "MLIR_INCLUDE_INTEGRATION_TESTS requires a native target")
+ endif()
+
# Copy test data over.
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/mttkrp_b.tns
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.mtx
config.environment['FILECHECK_OPTS'] = "-enable-var-scope --allow-unused-prefixes=false"
-# LLVM can be configured with an empty default triple
-# by passing ` -DLLVM_DEFAULT_TARGET_TRIPLE="" `.
-# This is how LLVM filters tests that require the host target
-# to be available for JIT tests.
-if config.target_triple:
- config.available_features.add('default_triple')
+if config.native_target in config.targets_to_build:
+ config.available_features.add('llvm_has_native_target')
+
+
# Add the python path for both the source and binary tree.
# Note that presently, the python sources come from the source tree and the
if sys.platform == 'win32':
config.unsupported = True
-# Requires a non-empty default triple for these tests.
-# Passing ` -DLLVM_DEFAULT_TARGET_TRIPLE="" ` when the
-# host target isn't available is how LLVM filters
-# tests that require the host target to be available
-# for JIT tests.
-if 'default_triple' not in config.available_features:
+# Requires the native target to be configured in.
+if 'llvm_has_native_target' not in config.available_features:
config.unsupported = True
# RUN: %PYTHON %s 2>&1 | FileCheck %s
-
+# REQUIRES: llvm_has_native_target
import gc, sys
from mlir.ir import *
from mlir.passmanager import *
add_subdirectory(Analysis)
add_subdirectory(Conversion)
add_subdirectory(Dialect)
-add_subdirectory(ExecutionEngine)
add_subdirectory(Interfaces)
add_subdirectory(IR)
add_subdirectory(Pass)
add_subdirectory(Rewrite)
add_subdirectory(TableGen)
add_subdirectory(Transforms)
+
+# The native target may not be enabled when cross compiling.
+if(TARGET ${LLVM_NATIVE_ARCH})
+ add_subdirectory(ExecutionEngine)
+endif()