Browse Source

Build: Fix objective c compiler not being configured.

m1
Jannis Weis 3 years ago
parent
commit
aee1e195ac
  1. 18
      buildSrc/src/main/kotlin/AppleM1ToolChainRule.kt

18
buildSrc/src/main/kotlin/AppleM1ToolChainRule.kt

@ -77,7 +77,8 @@ class AppleM1ToolChainRule : RuleSource() {
} }
} }
private class ConfigureCompilerArgumentsAction( private
class ConfigureCompilerArgumentsAction(
private val compilerMetadata: CompilerMetadataProvider, private val compilerMetadata: CompilerMetadataProvider,
private val sdkPath: SdkPathProvider private val sdkPath: SdkPathProvider
) : Action<MutableList<String>> { ) : Action<MutableList<String>> {
@ -96,7 +97,7 @@ class AppleM1ToolChainRule : RuleSource() {
args.addAll(listOfNotNull("-target", "arm64-apple-macos11", "-isysroot", sdkPath.get())) args.addAll(listOfNotNull("-target", "arm64-apple-macos11", "-isysroot", sdkPath.get()))
args.addAll(compilerMetadata.get().systemLibraries.includeDirs args.addAll(compilerMetadata.get().systemLibraries.includeDirs
.asSequence() .asSequence()
.flatMap { listOf("-system", it.absolutePath) }) .flatMap { listOf("-isystem", it.absolutePath) })
args.addAll(listOf("-F", sdkPath.get() + "/System/Library/Frameworks")) args.addAll(listOf("-F", sdkPath.get() + "/System/Library/Frameworks"))
} }
} }
@ -124,11 +125,22 @@ class AppleM1ToolChainRule : RuleSource() {
override fun execute(platform: GccPlatformToolChain) { override fun execute(platform: GccPlatformToolChain) {
metadataProvider = GccMetadataProvider.forClang(execActionFactory) metadataProvider = GccMetadataProvider.forClang(execActionFactory)
platform.getcCompiler().withArguments(forCCompiler(platform.getcCompiler())) platform.getcCompiler().withArguments(forCCompiler(platform.getcCompiler()))
platform.cppCompiler.withArguments(forCppCompiler(platform.cppCompiler)) listOf(
platform.getcCompiler(),
platform.cppCompiler,
platform.objcCompiler,
platform.objcppCompiler
).forEach {
it.configureCompilerArgs()
}
platform.linker.withArguments(forLinker(platform.linker)) platform.linker.withArguments(forLinker(platform.linker))
configureCompilerProbeArguments(platform) configureCompilerProbeArguments(platform)
} }
private fun GccCommandLineToolConfiguration.configureCompilerArgs() {
withArguments(forCppCompiler(this))
}
private fun forCCompiler(cCompiler: GccCommandLineToolConfiguration): Action<MutableList<String>> { private fun forCCompiler(cCompiler: GccCommandLineToolConfiguration): Action<MutableList<String>> {
val cCompilerMetadata = CompilerMetadataProvider(metadataProvider, toolchain, cCompiler, sdkPath) val cCompilerMetadata = CompilerMetadataProvider(metadataProvider, toolchain, cCompiler, sdkPath)
return ConfigureCompilerArgumentsAction(cCompilerMetadata, sdkPath) return ConfigureCompilerArgumentsAction(cCompilerMetadata, sdkPath)

Loading…
Cancel
Save