Native: support compileBitcodeWithXcodeLlvm=false binary option

This option makes the compiler use Kotlin/Native-provided LLVM
instead of Xcode-provided LLVM when compiling bitcode to machine code
for Apple targets.

^KT-54799 Fixed
This commit is contained in:
Svyatoslav Scherbina
2023-03-30 18:05:00 +00:00
committed by Space Team
parent 1aa3e54459
commit f5532abd11
2 changed files with 3 additions and 1 deletions
@@ -50,6 +50,8 @@ object BinaryOptions : BinaryOptionRegistry() {
val mimallocUseDefaultOptions by booleanOption()
val mimallocUseCompaction by booleanOption()
val compileBitcodeWithXcodeLlvm by booleanOption()
}
open class BinaryOption<T : Any>(
@@ -71,7 +71,7 @@ internal class BitcodeCompiler(
}
val bitcodePath = bitcodeFile.absoluteFile.normalize().path
val objectPath = objectFile.absoluteFile.normalize().path
if (configurables is AppleConfigurables) {
if (configurables is AppleConfigurables && config.configuration.get(BinaryOptions.compileBitcodeWithXcodeLlvm) != false) {
targetTool("clang++", *flags.toTypedArray(), bitcodePath, "-o", objectPath)
} else {
hostLlvmTool("clang++", *flags.toTypedArray(), bitcodePath, "-o", objectPath)