# ========================== begin_copyright_notice ============================
#
# Copyright (C) 2020-2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
# =========================== end_copyright_notice =============================

@LIT_SITE_CFG_IN_HEADER@

import sys

config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.lit_tools_dir = "@LLVM_TOOLS_DIR@"
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.host_arch = "@HOST_ARCH@"
config.python_executable = "@PYTHON_EXECUTABLE@"
config.test_run_dir = "@CMAKE_CURRENT_BINARY_DIR@"
config.vc_opt_build_dir = "$<$<TARGET_EXISTS:vc_opt>:$<TARGET_FILE_DIR:vc_opt>>"
config.cm_opt_bin_dir = "@IGC_BUILD__CMOPT_DIR@/bin"
config.cm_opt_lib_dir = "@IGC_BUILD__CMOPT_DIR@/lib"
config.oneapi_readelf_dir = "@IGC_BUILD__ONEAPI_READELF_DIR@"
config.llvm_plugin = "$<$<TARGET_EXISTS:VCBackendPlugin>:$<TARGET_FILE:VCBackendPlugin>>"
config.llvm_new_pm_plugin = "$<$<TARGET_EXISTS:NewPMPlugin>:$<TARGET_FILE:NewPMPlugin>>"
config.vc_bif_binary_dir = "$<TARGET_PROPERTY:VCBiFPreparation,BINARY_DIR>"
config.vc_platform_list = "@SUPPORTED_VC_PLATFORMS@"
config.llvm_version = "@LLVM_VERSION_MAJOR@"
config.opaque_pointers_enabled = "@IGC_OPTION__API_ENABLE_OPAQUE_POINTERS@"
config.opaque_pointers_default_arg_opt = "@IGC_BUILD__OPAQUE_POINTERS_DEFAULT_ARG_OPT@"
config.opaque_pointers_disable_opt = "@IGC_BUILD__OPAQUE_POINTERS_DISABLE_OPT@"
config.opaque_pointers_enable_opt = "@IGC_BUILD__OPAQUE_POINTERS_ENABLE_OPT@"

# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
try:
    config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
except KeyError:
    e = sys.exc_info()[1]
    key, = e.args
    lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))

import lit.llvm
lit.llvm.initialize(lit_config, config)

# Let the main config do the real work.
lit_config.load_config(config, "@VC_TEST_SOURCE_DIR@/lit.cfg.py")
