mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This switches from using lit.cfg to attempt to recompute the module triple to using the triple computed in CMake to ensure consistency. This is a better source of truth than having many sources everywhere. In case anyone sees this and is wondering, the "target triple" refers to the triple that the compiler is built for, while the "variant triple" refers to the platform that the tests and runtimes are built for.
147 lines
6.0 KiB
Python
147 lines
6.0 KiB
Python
# swift/validation-test/lit.site.cfg.in ---------------------------*- python -*-
|
|
#
|
|
# This source file is part of the Swift.org open source project
|
|
#
|
|
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
# Licensed under Apache License v2.0 with Runtime Library Exception
|
|
#
|
|
# See https://swift.org/LICENSE.txt for license information
|
|
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
#
|
|
# -----------------------------------------------------------------------------
|
|
|
|
import sys
|
|
import platform
|
|
|
|
config.cmake = "@CMAKE_COMMAND@"
|
|
config.cmake_binary_dir = "@CMAKE_BINARY_DIR@"
|
|
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
|
|
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
|
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
|
|
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
|
|
config.llvm_code_generators = "@LLVM_TARGETS_TO_BUILD@".split(";")
|
|
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
|
|
config.swift_src_root = "@SWIFT_SOURCE_DIR@"
|
|
config.swift_obj_root = "@SWIFT_BINARY_DIR@"
|
|
config.target_triple = "@LLVM_TARGET_TRIPLE@"
|
|
config.variant_triple = "@VARIANT_TRIPLE@"
|
|
config.variant_module_triple = "@VARIANT_MODULE_TRIPLE@"
|
|
config.variant_suffix = "@VARIANT_SUFFIX@"
|
|
config.variant_sdk = "@VARIANT_SDK@"
|
|
config.swift_test_results_dir = \
|
|
lit_config.params.get("swift_test_results_dir", "@SWIFT_TEST_RESULTS_DIR@")
|
|
|
|
config.host_triple = "@SWIFT_HOST_TRIPLE@"
|
|
config.host_sdkroot = "@SWIFT_HOST_SDKROOT@"
|
|
|
|
config.swift_driver_test_options = "@SWIFT_DRIVER_TEST_OPTIONS@"
|
|
config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
|
|
config.swift_ide_test_test_options = "@SWIFT_IDE_TEST_TEST_OPTIONS@"
|
|
|
|
# --- Darwin Configuration ---
|
|
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
|
|
|
|
# --- Android Configuration ---
|
|
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
|
|
config.android_api_level = "@SWIFT_ANDROID_API_LEVEL@"
|
|
|
|
# --- Windows MSVC Configuration ---
|
|
config.swift_stdlib_msvc_runtime = None
|
|
if "@SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY@" == "MultiThreaded":
|
|
config.swift_stdlib_msvc_runtime = 'MT'
|
|
elif "@SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY@" == "MultiThreadedDebug":
|
|
config.swift_stdlib_msvc_runtime = 'MTd'
|
|
elif "@SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY@" == "MultiThreadedDLL":
|
|
config.swift_stdlib_msvc_runtime = 'MD'
|
|
elif "@SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY@" == "MultiThreadedDebugDLL":
|
|
config.swift_stdlib_msvc_runtime = 'MDd'
|
|
else:
|
|
assert(False)
|
|
|
|
config.coverage_mode = "@SWIFT_ANALYZE_CODE_COVERAGE@"
|
|
config.lldb_build_root = "@LLDB_BUILD_DIR@"
|
|
config.libdispatch_build_path = "@SWIFT_PATH_TO_LIBDISPATCH_BUILD@"
|
|
config.libdispatch_static_build_path = "@SWIFT_PATH_TO_LIBDISPATCH_STATIC_BUILD@"
|
|
|
|
if "@SWIFT_ASAN_BUILD@" == "TRUE":
|
|
config.available_features.add("asan")
|
|
else:
|
|
config.available_features.add('no_asan')
|
|
|
|
if "@SWIFT_TOOLS_ENABLE_LTO@".lower() in ["full", "thin"]:
|
|
config.available_features.add("lto")
|
|
else:
|
|
config.available_features.add("no_lto")
|
|
|
|
if '@SWIFT_STDLIB_ENABLE_LTO@'.lower() in ['full', 'thin']:
|
|
config.available_features.add('stdlib_lto')
|
|
|
|
if "@LLVM_ENABLE_ASSERTIONS@" == "TRUE":
|
|
config.available_features.add('asserts')
|
|
else:
|
|
config.available_features.add('no_asserts')
|
|
|
|
# If tools have debug info, set the tools-debuginfo flag.
|
|
if "@CMAKE_BUILD_TYPE@" in ["Debug", "RelWithDebInfo"]:
|
|
config.available_features.add('tools-debuginfo')
|
|
|
|
# If tools are release-mode, set the tools-release flag.
|
|
if "@CMAKE_BUILD_TYPE@" in ["Release", "RelWithDebInfo"]:
|
|
config.available_features.add('tools-release')
|
|
|
|
if "@SWIFT_STDLIB_ASSERTIONS@" == "TRUE":
|
|
config.available_features.add('swift_stdlib_asserts')
|
|
else:
|
|
config.available_features.add('swift_stdlib_no_asserts')
|
|
|
|
if "@SWIFT_OPTIMIZED@" == "TRUE":
|
|
config.available_features.add("optimized_stdlib")
|
|
|
|
if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
|
|
config.available_features.add('sourcekit')
|
|
|
|
if "@SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY@" == "TRUE":
|
|
config.available_features.add("single_threaded_concurrency")
|
|
|
|
if "@SWIFT_THREADING_PACKAGE@" != "none":
|
|
# This is not called "threading" because we might want that later
|
|
config.available_features.add("thread_safe_runtime")
|
|
config.available_features.add("threading_@SWIFT_THREADING_PACKAGE@")
|
|
|
|
if "@SWIFT_ENABLE_REFLECTION@" == "TRUE":
|
|
config.available_features.add("reflection")
|
|
|
|
if "@SWIFT_ENABLE_OBSERVATION@" == "TRUE":
|
|
config.available_features.add("observation")
|
|
|
|
if "@SWIFT_BUILT_STANDALONE@" == "TRUE":
|
|
config.available_features.add('standalone_build')
|
|
|
|
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
|
|
|
|
if "@SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING@" == "TRUE":
|
|
config.available_features.add('differentiable_programming')
|
|
if "@SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY@" == "TRUE":
|
|
config.available_features.add('concurrency')
|
|
if "@SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED@" == "TRUE":
|
|
config.available_features.add('distributed')
|
|
if "@SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING@" == "TRUE":
|
|
config.available_features.add('string_processing')
|
|
if "@SWIFT_STDLIB_ENABLE_DEBUG_PRECONDITIONS_IN_RELEASE@" == "TRUE":
|
|
config.available_features.add('swift_stdlib_debug_preconditions_in_release')
|
|
|
|
config.swift_freestanding_is_darwin = "@SWIFT_FREESTANDING_IS_DARWIN@" == "TRUE"
|
|
config.swift_stdlib_use_relative_protocol_witness_tables = "@SWIFT_STDLIB_USE_RELATIVE_PROTOCOL_WITNESS_TABLES@" == "TRUE"
|
|
config.swift_stdlib_use_use_fragile_resilient_protocol_witness_tables = "@SWIFT_STDLIB_USE_FRAGILE_RESILIENT_PROTOCOL_WITNESS_TABLES@" == "TRUE"
|
|
config.swift_enable_dispatch = "@SWIFT_ENABLE_DISPATCH@" == "TRUE"
|
|
config.swift_stdlib_enable_objc_interop = "@SWIFT_STDLIB_ENABLE_OBJC_INTEROP@" == "TRUE"
|
|
# Configured in DarwinSDKs.cmake
|
|
config.freestanding_sdk_name = "@SWIFT_SDK_FREESTANDING_LIB_SUBDIR@"
|
|
|
|
config.swift_sdks = "@SWIFT_SDKS@".split(";")
|
|
|
|
# Let the main config do the real work.
|
|
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))
|
|
lit_config.load_config(config, os.path.join(config.test_exec_root, "lit.swift-features.cfg"))
|
|
lit_config.load_config(config, "@SWIFT_SOURCE_DIR@/validation-test/lit.cfg")
|