Getting rid of detailedName
This commit is contained in:
committed by
alexander-gorshenev
parent
4fcdcf925e
commit
54bede3db3
+6
-5
@@ -16,8 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.native.interop.tool
|
||||
|
||||
import org.jetbrains.kotlin.konan.target.*
|
||||
import org.jetbrains.kotlin.konan.util.visibleName
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.PlatformManager
|
||||
import org.jetbrains.kotlin.konan.target.customerDistribution
|
||||
import org.jetbrains.kotlin.konan.util.defaultTargetSubstitutions
|
||||
import org.jetbrains.kotlin.native.interop.gen.jvm.KotlinPlatform
|
||||
|
||||
class ToolConfig(userProvidedTargetName: String?, flavor: KotlinPlatform) {
|
||||
@@ -31,9 +34,7 @@ class ToolConfig(userProvidedTargetName: String?, flavor: KotlinPlatform) {
|
||||
|
||||
private val platform = platformManager.platform(target)
|
||||
|
||||
val substitutions = mapOf<String, String>(
|
||||
"target" to target.detailedName,
|
||||
"arch" to target.architecture.visibleName)
|
||||
val substitutions = defaultTargetSubstitutions(target)
|
||||
|
||||
fun downloadDependencies() = platform.downloadDependencies()
|
||||
|
||||
|
||||
-26
@@ -49,23 +49,6 @@ private fun String.asArgList(key: String) =
|
||||
else
|
||||
listOf(this)
|
||||
|
||||
// Performs substitution similar to:
|
||||
// foo = ${foo} ${foo.${arch}} ${foo.${os}}
|
||||
private fun substitute(properties: Properties, substitutions: Map<String, String>) {
|
||||
for (key in properties.stringPropertyNames()) {
|
||||
for (substitution in substitutions.values) {
|
||||
val suffix = ".$substitution"
|
||||
if (key.endsWith(suffix)) {
|
||||
val baseKey = key.removeSuffix(suffix)
|
||||
val oldValue = properties.getProperty(baseKey, "")
|
||||
val appendedValue = properties.getProperty(key, "")
|
||||
val newValue = if (oldValue != "") "$oldValue $appendedValue" else appendedValue
|
||||
properties.setProperty(baseKey, newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> Collection<T>.atMostOne(): T? {
|
||||
return when (this.size) {
|
||||
0 -> null
|
||||
@@ -85,15 +68,6 @@ private fun runCmd(command: Array<String>, verbose: Boolean = false) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadProperties(file: File?, substitutions: Map<String, String>): Properties {
|
||||
val result = Properties()
|
||||
file?.bufferedReader()?.use { reader ->
|
||||
result.load(reader)
|
||||
}
|
||||
substitute(result, substitutions)
|
||||
return result
|
||||
}
|
||||
|
||||
private fun Properties.storeProperties(file: File) {
|
||||
file.outputStream().use {
|
||||
this.store(it, null)
|
||||
|
||||
+1
-1
@@ -830,7 +830,7 @@ internal class CAdapterGenerator(
|
||||
output("RUNTIME_USED ${prefix}_ExportedSymbols* $exportedSymbol(void) { return &__konan_symbols;}")
|
||||
outputStreamWriter.close()
|
||||
|
||||
if (context.config.target.family == Family.WINDOWS) {
|
||||
if (context.config.target.family == Family.MINGW) {
|
||||
outputStreamWriter = context.config.tempFiles
|
||||
.cAdapterDef
|
||||
.printWriter()
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ class LibraryReaderImpl(var libraryFile: File, val currentAbiVersion: Int,
|
||||
get() = (realFiles.includedDir.listFiles).map{it.absolutePath}
|
||||
|
||||
override val linkerOpts: List<String>
|
||||
get() = manifestProperties.propertyList("linkerOpts", target!!.detailedName)
|
||||
get() = manifestProperties.propertyList("linkerOpts", target!!.visibleName)
|
||||
|
||||
override val unresolvedDependencies: List<String>
|
||||
get() = manifestProperties.propertyList("depends")
|
||||
|
||||
+123
-123
@@ -32,25 +32,25 @@ llvmDebugOptFlags = -O1
|
||||
llvmVersion = 5.0.0
|
||||
|
||||
# Mac OS X.
|
||||
llvmHome.osx = clang-llvm-5.0.0-darwin-macos
|
||||
targetToolchain.osx = target-toolchain-1-osx
|
||||
llvmHome.macos_x64 = clang-llvm-5.0.0-darwin-macos
|
||||
targetToolchain.macos_x64 = target-toolchain-1-osx
|
||||
|
||||
arch.osx = x86_64
|
||||
targetSysRoot.osx = target-sysroot-2-darwin-macos
|
||||
libffiDir.osx = libffi-3.2.1-2-darwin-macos
|
||||
llvmLtoFlags.osx =
|
||||
llvmLtoOptFlags.osx = -O3 -function-sections
|
||||
llvmLtoNooptFlags.osx = -O1
|
||||
llvmLtoDynamicFlags.osx = -relocation-model=pic
|
||||
linkerKonanFlags.osx = -lc++ -lobjc -framework Foundation
|
||||
linkerOptimizationFlags.osx = -dead_strip
|
||||
linkerNoDebugFlags.osx = -S
|
||||
linkerDynamicFlags.osx = -dylib
|
||||
osVersionMinFlagLd.osx = -macosx_version_min
|
||||
osVersionMinFlagClang.osx = -mmacosx-version-min
|
||||
osVersionMin.osx = 10.11
|
||||
entrySelector.osx = -alias _Konan_main _main
|
||||
dependencies.osx = \
|
||||
arch.macos_x64 = x86_64
|
||||
targetSysRoot.macos_x64 = target-sysroot-2-darwin-macos
|
||||
libffiDir.macos_x64 = libffi-3.2.1-2-darwin-macos
|
||||
llvmLtoFlags.macos_x64 =
|
||||
llvmLtoOptFlags.macos_x64 = -O3 -function-sections
|
||||
llvmLtoNooptFlags.macos_x64 = -O1
|
||||
llvmLtoDynamicFlags.macos_x64 = -relocation-model=pic
|
||||
linkerKonanFlags.macos_x64 = -lc++ -lobjc -framework Foundation
|
||||
linkerOptimizationFlags.macos_x64 = -dead_strip
|
||||
linkerNoDebugFlags.macos_x64 = -S
|
||||
linkerDynamicFlags.macos_x64 = -dylib
|
||||
osVersionMinFlagLd.macos_x64 = -macosx_version_min
|
||||
osVersionMinFlagClang.macos_x64 = -mmacosx-version-min
|
||||
osVersionMin.macos_x64 = 10.11
|
||||
entrySelector.macos_x64 = -alias _Konan_main _main
|
||||
dependencies.macos_x64 = \
|
||||
libffi-3.2.1-2-darwin-macos \
|
||||
clang-llvm-5.0.0-darwin-macos
|
||||
|
||||
@@ -61,120 +61,120 @@ target-toolchain-1-osx.default = \
|
||||
remote:internal
|
||||
|
||||
# Apple iOS.
|
||||
targetToolchain.osx-ios = target-toolchain-1-osx
|
||||
dependencies.osx-ios = \
|
||||
targetToolchain.macos_x64-ios_arm64 = target-toolchain-1-osx
|
||||
dependencies.macos_x64-ios_arm64 = \
|
||||
libffi-3.2.1-2-darwin-ios \
|
||||
clang-llvm-5.0.0-darwin-macos
|
||||
|
||||
target-sysroot-3-darwin-ios.default = \
|
||||
remote:internal
|
||||
|
||||
arch.ios = arm64
|
||||
entrySelector.ios = -alias _Konan_main _main
|
||||
targetSysRoot.ios = target-sysroot-3-darwin-ios
|
||||
libffiDir.ios = libffi-3.2.1-2-darwin-ios
|
||||
llvmLtoFlags.ios =
|
||||
llvmLtoOptFlags.ios = -O3 -function-sections
|
||||
linkerNoDebugFlags.ios = -S
|
||||
linkerDynamicFlags.ios = -dylib
|
||||
llvmLtoNooptFlags.ios = -O1
|
||||
llvmLtoDynamicFlags.ios = -relocation-model=pic
|
||||
linkerKonanFlags.ios = -lc++ -lobjc -framework Foundation -sdk_version 11.2
|
||||
linkerOptimizationFlags.ios = -dead_strip
|
||||
osVersionMinFlagLd.ios = -iphoneos_version_min
|
||||
osVersionMinFlagClang.ios = -miphoneos-version-min
|
||||
osVersionMin.ios = 8.0
|
||||
arch.ios_arm64 = arm64
|
||||
entrySelector.ios_arm64 = -alias _Konan_main _main
|
||||
targetSysRoot.ios_arm64 = target-sysroot-3-darwin-ios
|
||||
libffiDir.ios_arm64 = libffi-3.2.1-2-darwin-ios
|
||||
llvmLtoFlags.ios_arm64 =
|
||||
llvmLtoOptFlags.ios_arm64 = -O3 -function-sections
|
||||
linkerNoDebugFlags.ios_arm64 = -S
|
||||
linkerDynamicFlags.ios_arm64 = -dylib
|
||||
llvmLtoNooptFlags.ios_arm64 = -O1
|
||||
llvmLtoDynamicFlags.ios_arm64 = -relocation-model=pic
|
||||
linkerKonanFlags.ios_arm64 = -lc++ -lobjc -framework Foundation -sdk_version 11.2
|
||||
linkerOptimizationFlags.ios_arm64 = -dead_strip
|
||||
osVersionMinFlagLd.ios_arm64 = -iphoneos_version_min
|
||||
osVersionMinFlagClang.ios_arm64 = -miphoneos-version-min
|
||||
osVersionMin.ios_arm64 = 8.0
|
||||
|
||||
# Apple iOS simulator.
|
||||
targetToolchain.osx-ios_sim = target-toolchain-1-osx
|
||||
dependencies.osx-ios_sim = \
|
||||
targetToolchain.macos_x64-ios_x64 = target-toolchain-1-osx
|
||||
dependencies.macos_x64-ios_x64 = \
|
||||
libffi-3.2.1-1-darwin-ios_sim \
|
||||
clang-llvm-5.0.0-darwin-macos
|
||||
|
||||
target-sysroot-2-darwin-ios_sim.default = \
|
||||
remote:internal
|
||||
|
||||
arch.ios_sim = x86_64
|
||||
entrySelector.ios_sim = -alias _Konan_main _main
|
||||
targetSysRoot.ios_sim = target-sysroot-2-darwin-ios_sim
|
||||
libffiDir.ios_sim = libffi-3.2.1-1-darwin-ios_sim
|
||||
llvmLtoFlags.ios_sim =
|
||||
llvmLtoOptFlags.ios_sim = -O3 -function-sections
|
||||
llvmLtoNooptFlags.ios_sim = -O1
|
||||
llvmLtoDynamicFlags.ios_sim = -relocation-model=pic
|
||||
linkerKonanFlags.ios_sim = -lc++ -lobjc -framework Foundation -sdk_version 11.2
|
||||
linkerOptimizationFlags.ios_sim = -dead_strip
|
||||
linkerNoDebugFlags.ios_sim = -S
|
||||
linkerDynamicFlags.ios_sim = -dylib
|
||||
osVersionMinFlagLd.ios_sim = -ios_simulator_version_min
|
||||
osVersionMinFlagClang.ios_sim = -mios-simulator-version-min
|
||||
osVersionMin.ios_sim = 8.0
|
||||
arch.ios_x64 = x86_64
|
||||
entrySelector.ios_x64 = -alias _Konan_main _main
|
||||
targetSysRoot.ios_x64 = target-sysroot-2-darwin-ios_sim
|
||||
libffiDir.ios_x64 = libffi-3.2.1-1-darwin-ios_sim
|
||||
llvmLtoFlags.ios_x64 =
|
||||
llvmLtoOptFlags.ios_x64 = -O3 -function-sections
|
||||
llvmLtoNooptFlags.ios_x64 = -O1
|
||||
llvmLtoDynamicFlags.ios_x64 = -relocation-model=pic
|
||||
linkerKonanFlags.ios_x64 = -lc++ -lobjc -framework Foundation -sdk_version 11.2
|
||||
linkerOptimizationFlags.ios_x64 = -dead_strip
|
||||
linkerNoDebugFlags.ios_x64 = -S
|
||||
linkerDynamicFlags.ios_x64 = -dylib
|
||||
osVersionMinFlagLd.ios_x64 = -ios_simulator_version_min
|
||||
osVersionMinFlagClang.ios_x64 = -mios-simulator-version-min
|
||||
osVersionMin.ios_x64 = 8.0
|
||||
|
||||
# Linux x86-64.
|
||||
llvmHome.linux = clang-llvm-5.0.0-linux-x86-64
|
||||
gccToolchain.linux = target-gcc-toolchain-3-linux-x86-64
|
||||
targetToolchain.linux = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu
|
||||
llvmHome.linux_x64 = clang-llvm-5.0.0-linux-x86-64
|
||||
gccToolchain.linux_x64 = target-gcc-toolchain-3-linux-x86-64
|
||||
targetToolchain.linux_x64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu
|
||||
|
||||
quadruple.linux = x86_64-unknown-linux-gnu
|
||||
targetSysRoot.linux = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot
|
||||
libffiDir.linux = libffi-3.2.1-2-linux-x86-64
|
||||
quadruple.linux_x64 = x86_64-unknown-linux-gnu
|
||||
targetSysRoot.linux_x64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot
|
||||
libffiDir.linux_x64 = libffi-3.2.1-2-linux-x86-64
|
||||
# targetSysroot-relative.
|
||||
libGcc.linux = ../../lib/gcc/x86_64-unknown-linux-gnu/4.8.5
|
||||
llvmLtoFlags.linux =
|
||||
llvmLtoOptFlags.linux = -O3 -function-sections
|
||||
llvmLtoNooptFlags.linux = -O1
|
||||
llvmLtoDynamicFlags.linux = -relocation-model=pic
|
||||
llvmLlcFlags.linux = -march=x86-64
|
||||
linkerKonanFlags.linux = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \
|
||||
libGcc.linux_x64 = ../../lib/gcc/x86_64-unknown-linux-gnu/4.8.5
|
||||
llvmLtoFlags.linux_x64 =
|
||||
llvmLtoOptFlags.linux_x64 = -O3 -function-sections
|
||||
llvmLtoNooptFlags.linux_x64 = -O1
|
||||
llvmLtoDynamicFlags.linux_x64 = -relocation-model=pic
|
||||
llvmLlcFlags.linux_x64 = -march=x86-64
|
||||
linkerKonanFlags.linux_x64 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \
|
||||
--defsym __cxa_demangle=Konan_cxa_demangle
|
||||
linkerOptimizationFlags.linux = --gc-sections
|
||||
linkerNoDebugFlags.linux = -S
|
||||
linkerDynamicFlags.linux = -shared
|
||||
pluginOptimizationFlags.linux = -plugin-opt=mcpu=x86-64 -plugin-opt=O3
|
||||
dynamicLinker.linux = /lib64/ld-linux-x86-64.so.2
|
||||
entrySelector.linux = --defsym main=Konan_main
|
||||
linkerOptimizationFlags.linux_x64 = --gc-sections
|
||||
linkerNoDebugFlags.linux_x64 = -S
|
||||
linkerDynamicFlags.linux_x64 = -shared
|
||||
pluginOptimizationFlags.linux_x64 = -plugin-opt=mcpu=x86-64 -plugin-opt=O3
|
||||
dynamicLinker.linux_x64 = /lib64/ld-linux-x86-64.so.2
|
||||
entrySelector.linux_x64 = --defsym main=Konan_main
|
||||
# targetSysRoot relative
|
||||
abiSpecificLibraries.linux = ../lib64 lib64 usr/lib64
|
||||
dependencies.linux = \
|
||||
abiSpecificLibraries.linux_x64 = ../lib64 lib64 usr/lib64
|
||||
dependencies.linux_x64 = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
target-gcc-toolchain-3-linux-x86-64 \
|
||||
libffi-3.2.1-2-linux-x86-64
|
||||
|
||||
# Raspberry Pi
|
||||
targetToolchain.linux-raspberrypi = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu
|
||||
dependencies.linux-raspberrypi = \
|
||||
targetToolchain.linux_x64-linux_arm32_hfp = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu
|
||||
dependencies.linux_x64-linux_arm32_hfp = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
target-gcc-toolchain-3-linux-x86-64 \
|
||||
target-sysroot-1-raspberrypi \
|
||||
libffi-3.2.1-2-linux-x86-64 \
|
||||
libffi-3.2.1-2-raspberrypi
|
||||
|
||||
quadruple.raspberrypi = armv6-unknown-linux-gnueabihf
|
||||
entrySelector.raspberrypi = --defsym main=Konan_main
|
||||
linkerNoDebugFlags.raspberrypi = -S
|
||||
linkerDynamicFlags.raspberrypi = -shared
|
||||
linkerOptimizationFlags.raspberrypi = --gc-sections
|
||||
targetSysRoot.raspberrypi = target-sysroot-1-raspberrypi
|
||||
quadruple.linux_arm32_hfp = armv6-unknown-linux-gnueabihf
|
||||
entrySelector.linux_arm32_hfp = --defsym main=Konan_main
|
||||
linkerNoDebugFlags.linux_arm32_hfp = -S
|
||||
linkerDynamicFlags.linux_arm32_hfp = -shared
|
||||
linkerOptimizationFlags.linux_arm32_hfp = --gc-sections
|
||||
targetSysRoot.linux_arm32_hfp = target-sysroot-1-raspberrypi
|
||||
# We could reuse host toolchain here.
|
||||
libffiDir.raspberrypi = libffi-3.2.1-2-raspberrypi
|
||||
linkerKonanFlags.raspberrypi = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \
|
||||
libffiDir.linux_arm32_hfp = libffi-3.2.1-2-raspberrypi
|
||||
linkerKonanFlags.linux_arm32_hfp = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \
|
||||
--defsym __cxa_demangle=Konan_cxa_demangle
|
||||
# targetSysroot-relative.
|
||||
libGcc.raspberrypi = lib/gcc/arm-linux-gnueabihf/4.8.3
|
||||
llvmLtoFlags.raspberrypi = -float-abi=hard -mcpu=arm1136jf-s
|
||||
llvmLtoOptFlags.raspberrypi = -O3 -function-sections
|
||||
llvmLtoNooptFlags.raspberrypi = -O1
|
||||
llvmLtoDynamicFlags.raspberrypi = -relocation-model=pic
|
||||
dynamicLinker.raspberrypi = /lib/ld-linux-armhf.so.3
|
||||
libGcc.linux_arm32_hfp = lib/gcc/arm-linux-gnueabihf/4.8.3
|
||||
llvmLtoFlags.linux_arm32_hfp = -float-abi=hard -mcpu=arm1136jf-s
|
||||
llvmLtoOptFlags.linux_arm32_hfp = -O3 -function-sections
|
||||
llvmLtoNooptFlags.linux_arm32_hfp = -O1
|
||||
llvmLtoDynamicFlags.linux_arm32_hfp = -relocation-model=pic
|
||||
dynamicLinker.linux_arm32_hfp = /lib/ld-linux-armhf.so.3
|
||||
# targetSysRoot relative
|
||||
abiSpecificLibraries.raspberrypi = \
|
||||
abiSpecificLibraries.linux_arm32_hfp = \
|
||||
../lib/arm-linux-gnueabihf \
|
||||
lib/arm-linux-gnueabihf \
|
||||
usr/lib/arm-linux-gnueabihf
|
||||
|
||||
# MIPS
|
||||
targetToolchain.linux-linux_mips32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu
|
||||
dependencies.linux-linux_mips32 = \
|
||||
targetToolchain.linux_x64-linux_mips32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu
|
||||
dependencies.linux_x64-linux_mips32 = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
target-gcc-toolchain-2-linux-mips \
|
||||
target-gcc-toolchain-3-linux-x86-64 \
|
||||
@@ -202,8 +202,8 @@ dynamicLinker.linux_mips32 = /lib/ld.so.1
|
||||
abiSpecificLibraries.linux_mips32 =
|
||||
|
||||
# MIPSel
|
||||
targetToolchain.linux-linux_mipsel32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu
|
||||
dependencies.linux-linux_mipsel32 = \
|
||||
targetToolchain.linux_x64-linux_mipsel32 = target-gcc-toolchain-2-linux-mips/x86_64-unknown-linux-gnu
|
||||
dependencies.linux_x64-linux_mipsel32 = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
target-gcc-toolchain-2-linux-mips \
|
||||
target-gcc-toolchain-3-linux-x86-64 \
|
||||
@@ -230,15 +230,15 @@ dynamicLinker.linux_mipsel32 = /lib/ld.so.1
|
||||
abiSpecificLibraries.linux_mipsel32 =
|
||||
|
||||
# Android ARM32, based on NDK for android-21.
|
||||
targetToolchain.osx-android_arm32 = target-toolchain-21-osx-android_arm32
|
||||
targetToolchain.macos_x64-android_arm32 = target-toolchain-21-osx-android_arm32
|
||||
# TODO: split dependencies to host-dependent and host-independent parts.
|
||||
dependencies.osx-android_arm32 = \
|
||||
dependencies.macos_x64-android_arm32 = \
|
||||
clang-llvm-5.0.0-darwin-macos \
|
||||
target-sysroot-21-android_arm32 \
|
||||
target-toolchain-21-osx-android_arm32 \
|
||||
libffi-3.2.1-2-android_arm32
|
||||
targetToolchain.linux-android_arm32 = target-toolchain-21-linux-android_arm32
|
||||
dependencies.linux-android_arm32 = \
|
||||
targetToolchain.linux_x64-android_arm32 = target-toolchain-21-linux-android_arm32
|
||||
dependencies.linux_x64-android_arm32 = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
target-sysroot-21-android_arm32 \
|
||||
target-toolchain-21-linux-android_arm32 \
|
||||
@@ -255,15 +255,15 @@ libffiDir.android_arm32 = libffi-3.2.1-2-android_arm32
|
||||
linkerKonanFlags.android_arm32 = -lm -latomic -lstdc++ -landroid
|
||||
|
||||
# Android ARM64, based on NDK for android-21.
|
||||
targetToolchain.osx-android_arm64 = target-toolchain-21-osx-android_arm64
|
||||
targetToolchain.macos_x64-android_arm64 = target-toolchain-21-osx-android_arm64
|
||||
# TODO: split dependencies to host-dependent and host-independent parts.
|
||||
dependencies.osx-android_arm64 = \
|
||||
dependencies.macos_x64-android_arm64 = \
|
||||
clang-llvm-5.0.0-darwin-macos \
|
||||
target-sysroot-21-android_arm64 \
|
||||
target-toolchain-21-osx-android_arm64 \
|
||||
libffi-3.2.1-2-android_arm64
|
||||
targetToolchain.linux-android_arm64 = target-toolchain-21-linux-android_arm64
|
||||
dependencies.linux-android_arm64 = \
|
||||
targetToolchain.linux_x64-android_arm64 = target-toolchain-21-linux-android_arm64
|
||||
dependencies.linux_x64-android_arm64 = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
target-sysroot-21-android_arm64 \
|
||||
target-toolchain-21-linux-android_arm64 \
|
||||
@@ -278,42 +278,42 @@ linkerKonanFlags.android_arm64 = -lm -latomic -lstdc++ -landroid
|
||||
linkerNoDebugFlags.android_arm64 = -Wl,-S
|
||||
|
||||
# Windows x86-64, based on mingw-w64.
|
||||
llvmHome.mingw = msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64
|
||||
targetToolchain.mingw = msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64
|
||||
llvmHome.mingw_x64 = msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64
|
||||
targetToolchain.mingw_x64 = msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64
|
||||
|
||||
quadruple.mingw = x86_64-w64-mingw32
|
||||
targetSysRoot.mingw = msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64
|
||||
libffiDir.mingw = libffi-3.2.1-mingw-w64-x86-64
|
||||
llvmLtoFlags.mingw =
|
||||
llvmLtoOptFlags.mingw = -O3 -function-sections
|
||||
llvmLtoNooptFlags.mingw = -O1
|
||||
linkerNoDebugFlags.mingw = -Wl,-S
|
||||
linkerDynamicFlags.mingw = -shared
|
||||
linkerKonanFlags.mingw =-static-libgcc -static-libstdc++ \
|
||||
quadruple.mingw_x64 = x86_64-w64-mingw32
|
||||
targetSysRoot.mingw_x64 = msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64
|
||||
libffiDir.mingw_x64 = libffi-3.2.1-mingw-w64-x86-64
|
||||
llvmLtoFlags.mingw_x64 =
|
||||
llvmLtoOptFlags.mingw_x64 = -O3 -function-sections
|
||||
llvmLtoNooptFlags.mingw_x64 = -O1
|
||||
linkerNoDebugFlags.mingw_x64 = -Wl,-S
|
||||
linkerDynamicFlags.mingw_x64 = -shared
|
||||
linkerKonanFlags.mingw_x64 =-static-libgcc -static-libstdc++ \
|
||||
-Xclang -flto-visibility-public-std \
|
||||
-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive,-Bdynamic \
|
||||
-Wl,--defsym,__cxa_demangle=Konan_cxa_demangle
|
||||
linkerOptimizationFlags.mingw = -Wl,--gc-sections
|
||||
entrySelector.mingw = -Wl,--defsym,main=Konan_main
|
||||
dependencies.mingw = \
|
||||
linkerOptimizationFlags.mingw_x64 = -Wl,--gc-sections
|
||||
entrySelector.mingw_x64 = -Wl,--defsym,main=Konan_main
|
||||
dependencies.mingw_x64 = \
|
||||
msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64 \
|
||||
libffi-3.2.1-mingw-w64-x86-64
|
||||
|
||||
# WebAssembly 32-bit.
|
||||
targetToolchain.osx-wasm32 = target-toolchain-2-osx-wasm
|
||||
dependencies.osx-wasm32 = \
|
||||
targetToolchain.macos_x64-wasm32 = target-toolchain-2-osx-wasm
|
||||
dependencies.macos_x64-wasm32 = \
|
||||
clang-llvm-5.0.0-darwin-macos \
|
||||
target-sysroot-2-wasm \
|
||||
target-toolchain-2-osx-wasm
|
||||
|
||||
targetToolchain.linux-wasm32 = target-toolchain-1-linux-wasm
|
||||
dependencies.linux-wasm32 = \
|
||||
targetToolchain.linux_x64-wasm32 = target-toolchain-1-linux-wasm
|
||||
dependencies.linux_x64-wasm32 = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
target-sysroot-2-wasm \
|
||||
target-toolchain-1-linux-wasm
|
||||
|
||||
targetToolchain.mingw-wasm32 = target-toolchain-1-mingw-wasm
|
||||
dependencies.mingw-wasm32 = \
|
||||
targetToolchain.mingw_x64-wasm32 = target-toolchain-1-mingw-wasm
|
||||
dependencies.mingw_x64-wasm32 = \
|
||||
msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64 \
|
||||
target-sysroot-2-wasm \
|
||||
target-toolchain-1-mingw-wasm
|
||||
@@ -330,4 +330,4 @@ llcNooptFlags.wasm32 = -O1
|
||||
llcOptFlags.wasm32 = -O3
|
||||
llcDebugFlags.wasm32 = -O0
|
||||
# The stack size is in bytes.
|
||||
s2wasmFlags.wasm32 = --allocate-stack 1048576 --import-memory
|
||||
s2wasmFlags.wasm32 = --allocate-stack 1048576 --import-memory
|
||||
|
||||
@@ -23,20 +23,20 @@ entrySelector.zephyr_stm32f4_disco = --defsym main=Konan_main
|
||||
|
||||
boardSpecificClangFlags.zephyr_stm32f4_disco = -mabi=aapcs -mthumb -mcpu=cortex-m4
|
||||
|
||||
targetToolchain.linux-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-linux/arm-none-eabi
|
||||
dependencies.linux-zephyr_stm32f4_disco = \
|
||||
targetToolchain.linux_x64-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-linux/arm-none-eabi
|
||||
dependencies.linux_x64-zephyr_stm32f4_disco = \
|
||||
clang-llvm-5.0.0-linux-x86-64 \
|
||||
gcc-arm-none-eabi-7-2017-q4-major-linux \
|
||||
target-sysroot-2-wasm
|
||||
|
||||
targetToolchain.osx-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-mac/arm-none-eabi
|
||||
dependencies.osx-zephyr_stm32f4_disco = \
|
||||
targetToolchain.macos_x64-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-mac/arm-none-eabi
|
||||
dependencies.macos_x64-zephyr_stm32f4_disco = \
|
||||
gcc-arm-none-eabi-7-2017-q4-major-mac \
|
||||
clang-llvm-5.0.0-darwin-macos \
|
||||
target-sysroot-2-wasm
|
||||
|
||||
targetToolchain.mingw-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi
|
||||
dependencies.mingw-zephyr_stm32f4_disco = \
|
||||
targetToolchain.mingw_x64-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi
|
||||
dependencies.mingw_x64-zephyr_stm32f4_disco = \
|
||||
msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64 \
|
||||
gcc-arm-none-eabi-7-2017-q4-major-win32 \
|
||||
target-sysroot-2-wasm
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import org.jetbrains.kotlin.KlibInstall
|
||||
import org.jetbrains.kotlin.konan.target.*
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget.*
|
||||
import org.jetbrains.kotlin.konan.util.DefFile
|
||||
import org.jetbrains.kotlin.konan.util.*
|
||||
|
||||
import static org.jetbrains.kotlin.konan.util.VisibleNamedKt.getVisibleName
|
||||
|
||||
@@ -28,8 +27,6 @@ buildscript {
|
||||
|
||||
//#region Util functions.
|
||||
private ArrayList<DefFile> targetDefFiles(KonanTarget target) {
|
||||
def substitution = ['arch': target.visibleName,
|
||||
'os' : target.detailedName]
|
||||
file("src/platform/${getVisibleName(target.family)}")
|
||||
.listFiles()
|
||||
.findAll { it.name.endsWith(".def") }
|
||||
@@ -38,7 +35,7 @@ private ArrayList<DefFile> targetDefFiles(KonanTarget target) {
|
||||
.findAll { ! ((target instanceof KonanTarget.LINUX_ARM32_HFP ||
|
||||
target instanceof KonanTarget.LINUX_MIPS32 ||
|
||||
target instanceof KonanTarget.LINUX_MIPSEL32) && it.name == 'zlib.def') }
|
||||
.collect { new DefFile(it, substitution) }
|
||||
.collect { TargetDefFileKt.DefFile(it, target) }
|
||||
}
|
||||
|
||||
private String defFileToLibName(String target, String name) {
|
||||
@@ -46,6 +43,8 @@ private String defFileToLibName(String target, String name) {
|
||||
}
|
||||
//#endregion
|
||||
|
||||
// TODO: I think most for the non-DSL language below can either be incorporated into DSL
|
||||
// or moved out of .gradle file.
|
||||
project.rootProject.ext.platformManager.enabled.each { target ->
|
||||
|
||||
def targetName = target.visibleName
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
depends = CFNetwork CoreFoundation Foundation Security darwin posix
|
||||
language = Objective-C
|
||||
package = platform.IOSurface
|
||||
headers.ios = IOSurface/IOSurfaceRef.h IOSurface/IOSurfaceObjC.h
|
||||
headers.ios_arm64 = IOSurface/IOSurfaceRef.h IOSurface/IOSurfaceObjC.h
|
||||
|
||||
headerFilter = IOSurface/**
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ enum class Family(val exeSuffix:String, val dynamicPrefix: String, val dynamicSu
|
||||
OSX ("kexe", "lib", "dylib"),
|
||||
IOS ("kexe", "lib", "dylib"),
|
||||
LINUX ("kexe", "lib", "so" ),
|
||||
WINDOWS ("exe" , "" , "dll" ),
|
||||
MINGW ("exe" , "" , "dll" ),
|
||||
ANDROID ("so" , "lib", "so" ),
|
||||
WASM ("wasm", "" , "wasm" ),
|
||||
ZEPHYR ("o" , "lib", "a" )
|
||||
@@ -38,25 +38,25 @@ enum class Architecture(val bitness: Int) {
|
||||
WASM32(32);
|
||||
}
|
||||
|
||||
sealed class KonanTarget(override val name: String, val family: Family, val architecture: Architecture, val detailedName: String) : Named {
|
||||
object ANDROID_ARM32 : KonanTarget( "android_arm32", Family.ANDROID, Architecture.ARM32, "android_arm32")
|
||||
object ANDROID_ARM64 : KonanTarget( "android_arm64", Family.ANDROID, Architecture.ARM64, "android_arm64")
|
||||
object IOS_ARM64 : KonanTarget( "ios_arm64", Family.IOS, Architecture.ARM64, "ios")
|
||||
object IOS_X64 : KonanTarget( "ios_x64", Family.IOS, Architecture.X64, "ios_sim")
|
||||
object LINUX_X64 : KonanTarget( "linux_x64", Family.LINUX, Architecture.X64, "linux")
|
||||
object MINGW_X64 : KonanTarget( "mingw_x64", Family.WINDOWS, Architecture.X64, "mingw")
|
||||
object MACOS_X64 : KonanTarget( "macos_x64", Family.OSX, Architecture.X64, "osx")
|
||||
object LINUX_ARM32_HFP :KonanTarget( "linux_arm32_hfp", Family.LINUX, Architecture.ARM32, "raspberrypi")
|
||||
object LINUX_MIPS32 : KonanTarget( "linux_mips32", Family.LINUX, Architecture.MIPS32, "linux_mips32")
|
||||
object LINUX_MIPSEL32 : KonanTarget( "linux_mipsel32", Family.LINUX, Architecture.MIPSEL32, "linux_mipsel32")
|
||||
object WASM32 : KonanTarget( "wasm32", Family.WASM, Architecture.WASM32, "wasm32")
|
||||
sealed class KonanTarget(override val name: String, val family: Family, val architecture: Architecture) : Named {
|
||||
object ANDROID_ARM32 : KonanTarget( "android_arm32", Family.ANDROID, Architecture.ARM32)
|
||||
object ANDROID_ARM64 : KonanTarget( "android_arm64", Family.ANDROID, Architecture.ARM64)
|
||||
object IOS_ARM64 : KonanTarget( "ios_arm64", Family.IOS, Architecture.ARM64)
|
||||
object IOS_X64 : KonanTarget( "ios_x64", Family.IOS, Architecture.X64)
|
||||
object LINUX_X64 : KonanTarget( "linux_x64", Family.LINUX, Architecture.X64)
|
||||
object MINGW_X64 : KonanTarget( "mingw_x64", Family.MINGW, Architecture.X64)
|
||||
object MACOS_X64 : KonanTarget( "macos_x64", Family.OSX, Architecture.X64)
|
||||
object LINUX_ARM32_HFP :KonanTarget( "linux_arm32_hfp", Family.LINUX, Architecture.ARM32)
|
||||
object LINUX_MIPS32 : KonanTarget( "linux_mips32", Family.LINUX, Architecture.MIPS32)
|
||||
object LINUX_MIPSEL32 : KonanTarget( "linux_mipsel32", Family.LINUX, Architecture.MIPSEL32)
|
||||
object WASM32 : KonanTarget( "wasm32", Family.WASM, Architecture.WASM32)
|
||||
|
||||
// Tunable targets
|
||||
class ZEPHYR(val subName: String, val genericName: String = "zephyr") : KonanTarget("${genericName}_$subName", Family.ZEPHYR, Architecture.ARM32, "${genericName}_$subName")
|
||||
class ZEPHYR(val subName: String, val genericName: String = "zephyr") : KonanTarget("${genericName}_$subName", Family.ZEPHYR, Architecture.ARM32)
|
||||
}
|
||||
|
||||
fun hostTargetSuffix(host: KonanTarget, target: KonanTarget) =
|
||||
if (target == host) host.detailedName else "${host.detailedName}-${target.detailedName}"
|
||||
if (target == host) host.name else "${host.name}-${target.name}"
|
||||
|
||||
enum class CompilerOutputKind {
|
||||
PROGRAM {
|
||||
@@ -111,7 +111,7 @@ private class TargetManagerImpl(val userRequest: String?, val hostManager: HostM
|
||||
}
|
||||
|
||||
override val hostTargetSuffix get() = hostTargetSuffix(HostManager.host, target)
|
||||
override val targetSuffix get() = target.detailedName
|
||||
override val targetSuffix get() = target.name
|
||||
}
|
||||
|
||||
open class HostManager(protected val distribution: Distribution = Distribution()) {
|
||||
@@ -228,9 +228,9 @@ open class HostManager(protected val distribution: Distribution = Distribution()
|
||||
val hostIsLinux = (host == KonanTarget.LINUX_X64)
|
||||
val hostIsMingw = (host == KonanTarget.MINGW_X64)
|
||||
|
||||
val hostSuffix get() = host.detailedName
|
||||
val hostSuffix get() = host.name
|
||||
@JvmStatic
|
||||
val hostName get() = host.visibleName
|
||||
val hostName get() = host.name
|
||||
|
||||
val knownTargetTemplates = listOf("zephyr")
|
||||
|
||||
|
||||
@@ -19,16 +19,16 @@ package org.jetbrains.kotlin.konan.properties
|
||||
import org.jetbrains.kotlin.konan.target.*
|
||||
|
||||
fun Properties.hostString(name: String): String?
|
||||
= this.propertyString(name, HostManager.host.detailedName)
|
||||
= this.propertyString(name, HostManager.hostName)
|
||||
|
||||
fun Properties.hostList(name: String): List<String>
|
||||
= this.propertyList(name, HostManager.host.detailedName)
|
||||
= this.propertyList(name, HostManager.hostName)
|
||||
|
||||
fun Properties.targetString(name: String, target: KonanTarget): String?
|
||||
= this.propertyString(name, target.detailedName)
|
||||
= this.propertyString(name, target.name)
|
||||
|
||||
fun Properties.targetList(name: String, target: KonanTarget): List<String>
|
||||
= this.propertyList(name, target.detailedName)
|
||||
= this.propertyList(name, target.name)
|
||||
|
||||
fun Properties.hostTargetString(name: String, target: KonanTarget): String?
|
||||
= this.propertyString(name, hostTargetSuffix(HostManager.host, target))
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.jetbrains.kotlin.konan.util
|
||||
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import java.io.File
|
||||
|
||||
fun defaultTargetSubstitutions(target: KonanTarget) =
|
||||
mapOf<String, String>(
|
||||
"target" to target.visibleName,
|
||||
"arch" to target.architecture.visibleName,
|
||||
"family" to target.family.visibleName)
|
||||
|
||||
fun DefFile(file: File?, target: KonanTarget) = DefFile(file, defaultTargetSubstitutions(target))
|
||||
+1
-1
@@ -103,7 +103,7 @@ open class KonanGenerateCMakeTask : DefaultTask() {
|
||||
private val File.relativePath get() = relativeTo(project.projectDir)
|
||||
|
||||
private val String.crossPlatformPath get() =
|
||||
if (host.family == Family.WINDOWS) replace('\\', '/') else this
|
||||
if (host.family == Family.MINGW) replace('\\', '/') else this
|
||||
|
||||
private val FileCollection.asCMakeSourceList: List<String>
|
||||
get() = files.map { it.relativePath.toString().crossPlatformPath }
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ class CMakeSpecification extends BaseKonanSpecification {
|
||||
def sdlIncludePath
|
||||
def sdlLinkOptions
|
||||
switch (HostManager.host.family) {
|
||||
case Family.WINDOWS:
|
||||
case Family.MINGW:
|
||||
sdlIncludePath = "C:/SDL2/include"
|
||||
sdlLinkOptions = "C:/SDL2/lib"
|
||||
break
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ class EnvVariableSpecification extends BaseKonanSpecification {
|
||||
List<String> tasks,
|
||||
Map<String, String> environment = [:],
|
||||
Map<String, String> properties = ["konan.useEnvironmentVariables": 'true']) {
|
||||
def wrapper = (HostManager.host.family == Family.WINDOWS) ? "gradlew.bat" : "gradlew"
|
||||
def wrapper = (HostManager.host.family == Family.MINGW) ? "gradlew.bat" : "gradlew"
|
||||
def command = ["$project.projectDir.absolutePath/$wrapper".toString()]
|
||||
command.addAll(tasks)
|
||||
command.addAll(properties.collect { "-P${it.key}=${it.value}".toString() })
|
||||
|
||||
Reference in New Issue
Block a user