有Swift编译器选项 -target :
$ swiftc -h
...
-target <value> Generate code for the given target
...
从哪里可以获得编译器选项 -target 的所有可能值(即:x86_64-apple-ios11.0
,x86_64-apple-macosx10.12
,...)?
谢谢!
答案 0 :(得分:0)
看https://github.com/apple/swift/blob/master/utils/build-script-impl
在构建脚本中搜索诸如SWIFT_HOST_VARIANT
,SWIFT_HOST_VARIANT_SDK
,SWIFT_HOST_VARIANT_ARCH
和SWIFT_HOST_TRIPLE
之类的术语
#!/usr/bin/env bash
#===--- build-script-impl - Implementation details of build-script ---------===#
#
## This source file is part of the Swift.org open source project
# Each variable name is re-exported into this script in uppercase, where dashes
# are substituted by underscores. For example, `swift-install-components` is
# referred to as `SWIFT_INSTALL_COMPONENTS` in the remainder of this script.
KNOWN_SETTINGS=(
# name default description
# ... snip ...
darwin-deployment-version-osx "10.9" "minimum deployment target version for OS X"
darwin-deployment-version-ios "7.0" "minimum deployment target version for iOS"
# ... snip ...
function set_build_options_for_host() {
llvm_cmake_options=()
swift_cmake_options=()
cmark_cmake_options=()
lldb_cmake_options=()
swiftpm_bootstrap_options=()
SWIFT_HOST_VARIANT=
SWIFT_HOST_VARIANT_SDK=
SWIFT_HOST_VARIANT_ARCH=
SWIFT_HOST_TRIPLE=
local host="$1"
# Hosts which can be cross-compiled must specify:
# SWIFT_HOST_TRIPLE and llvm_target_arch (as well as usual HOST_VARIANT flags)
case ${host} in
freebsd-x86_64)
SWIFT_HOST_VARIANT="freebsd"
SWIFT_HOST_VARIANT_SDK="FREEBSD"
SWIFT_HOST_VARIANT_ARCH="x86_64"
;;
cygwin-x86_64)
SWIFT_HOST_VARIANT="cygwin"
SWIFT_HOST_VARIANT_SDK="CYGWIN"
SWIFT_HOST_VARIANT_ARCH="x86_64"
;;
# ... snip ...
linux-*)
SWIFT_HOST_VARIANT="linux"
SWIFT_HOST_VARIANT_SDK="LINUX"
case ${host} in
linux-x86_64)
SWIFT_HOST_VARIANT_ARCH="x86_64"
;;
# ... snip ...
linux-aarch64)
SWIFT_HOST_VARIANT_ARCH="aarch64"
;;
# ... snip ...
;;
macosx-* | iphoneos-* | iphonesimulator-* | \
appletvos-* | appletvsimulator-* | \
watchos-* | watchsimulator-*)
case ${host} in
macosx-x86_64)
xcrun_sdk_name="macosx"
llvm_target_arch=""
SWIFT_HOST_TRIPLE="x86_64-apple-macosx${DARWIN_DEPLOYMENT_VERSION_OSX}"
SWIFT_HOST_VARIANT="macosx"
SWIFT_HOST_VARIANT_SDK="OSX"
SWIFT_HOST_VARIANT_ARCH="x86_64"