[K/N] Use platform_version instead of sdk_version and os_version_min
This commit is contained in:
committed by
Space Team
parent
9cbd55aa72
commit
9daa40d2ed
@@ -98,7 +98,7 @@ interface ConfigurablesWithEmulator : Configurables {
|
||||
interface AppleConfigurables : Configurables, ClangFlags {
|
||||
val arch get() = targetTriple.architecture
|
||||
val osVersionMin get() = targetString("osVersionMin")!!
|
||||
val osVersionMinFlagLd get() = targetString("osVersionMinFlagLd")!!
|
||||
val sdkVersion get() = targetString("sdkVersion")!!
|
||||
val stripFlags get() = targetList("stripFlags")
|
||||
val additionalToolsDir get() = hostString("additionalToolsDir")
|
||||
val absoluteAdditionalToolsDir get() = absolute(additionalToolsDir)
|
||||
|
||||
@@ -202,10 +202,6 @@ class MacOSBasedLinker(targetProperties: AppleConfigurables)
|
||||
return if (dir != null) "$dir/libclang_rt.$mangledLibraryName$prefix$suffix$extension" else null
|
||||
}
|
||||
|
||||
private val osVersionMinFlags: List<String> by lazy {
|
||||
listOf(osVersionMinFlagLd, osVersionMin + ".0")
|
||||
}
|
||||
|
||||
override fun filterStaticLibraries(binaries: List<String>) = binaries.filter { it.isUnixStaticLib }
|
||||
|
||||
// Note that may break in case of 32-bit Mach-O. See KT-37368.
|
||||
@@ -218,6 +214,28 @@ class MacOSBasedLinker(targetProperties: AppleConfigurables)
|
||||
+listOf("-o", output)
|
||||
}.let(::listOf)
|
||||
|
||||
/**
|
||||
* Construct -platform_version ld64 argument which contains info about
|
||||
* - SDK
|
||||
* - minimal OS version
|
||||
* - SDK version
|
||||
*/
|
||||
private fun platformVersionFlags(): List<String> = mutableListOf<String>().apply {
|
||||
add("-platform_version")
|
||||
|
||||
val platformName = when (target.family) {
|
||||
Family.OSX -> "macos"
|
||||
Family.IOS -> "ios"
|
||||
Family.TVOS -> "tvos"
|
||||
Family.WATCHOS -> "watchos"
|
||||
else -> error("Unexpected Apple target family: ${target.family}")
|
||||
} + if (targetTriple.isSimulator) "-simulator" else ""
|
||||
add(platformName)
|
||||
|
||||
add("$osVersionMin.0")
|
||||
add(sdkVersion)
|
||||
}.toList()
|
||||
|
||||
override fun finalLinkCommands(objectFiles: List<ObjectFile>, executable: ExecutableFile,
|
||||
libraries: List<String>, linkerArgs: List<String>,
|
||||
optimize: Boolean, debug: Boolean, kind: LinkerOutputKind,
|
||||
@@ -242,7 +260,7 @@ class MacOSBasedLinker(targetProperties: AppleConfigurables)
|
||||
result += Command(linker).apply {
|
||||
+"-demangle"
|
||||
+listOf("-dynamic", "-arch", arch)
|
||||
+osVersionMinFlags
|
||||
+platformVersionFlags()
|
||||
+listOf("-syslibroot", absoluteTargetSysRoot, "-o", executable)
|
||||
+objectFiles
|
||||
if (optimize) +linkerOptimizationFlags
|
||||
|
||||
Reference in New Issue
Block a user