Raspberry Pi target (#365)
This commit is contained in:
+7
-2
@@ -90,7 +90,6 @@ internal class NativeIndexImpl(val language: Language) : NativeIndex() {
|
|||||||
this.def = def
|
this.def = def
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (underlying is ConstArrayType)
|
assert (underlying is ConstArrayType)
|
||||||
// So the result must feel like array:
|
// So the result must feel like array:
|
||||||
return ConstArrayType(RecordType(structDeclaration), 1)
|
return ConstArrayType(RecordType(structDeclaration), 1)
|
||||||
@@ -110,6 +109,12 @@ internal class NativeIndexImpl(val language: Language) : NativeIndex() {
|
|||||||
return builtinVaListType(type, name, underlying)
|
return builtinVaListType(type, name, underlying)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (name == "__gnuc_va_list" || name == "va_list") {
|
||||||
|
// TODO: fix GNUC varargs support.
|
||||||
|
return UnsupportedType
|
||||||
|
}
|
||||||
|
|
||||||
if ((underlying is RecordType && underlying.decl.spelling.split(' ').last() == name) ||
|
if ((underlying is RecordType && underlying.decl.spelling.split(' ').last() == name) ||
|
||||||
(underlying is EnumType && underlying.def.spelling.split(' ').last() == name)) {
|
(underlying is EnumType && underlying.def.spelling.split(' ').last() == name)) {
|
||||||
|
|
||||||
@@ -346,4 +351,4 @@ private fun indexDeclarations(library: NativeLibrary, nativeIndex: NativeIndexIm
|
|||||||
clang_IndexAction_dispose(indexAction)
|
clang_IndexAction_dispose(indexAction)
|
||||||
clang_disposeIndex(index)
|
clang_disposeIndex(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-11
@@ -39,7 +39,8 @@ private val knownTargets = mapOf(
|
|||||||
"linux" to "linux",
|
"linux" to "linux",
|
||||||
"macbook" to "osx",
|
"macbook" to "osx",
|
||||||
"iphone" to "osx-ios",
|
"iphone" to "osx-ios",
|
||||||
"iphone_sim" to "osx-ios-sim")
|
"iphone_sim" to "osx-ios-sim",
|
||||||
|
"raspberrypi" to "linux-raspberrypi")
|
||||||
|
|
||||||
|
|
||||||
private fun String.targetSuffix(): String =
|
private fun String.targetSuffix(): String =
|
||||||
@@ -117,10 +118,11 @@ private fun runCmd(command: Array<String>, workDir: File, verbose: Boolean = fal
|
|||||||
|
|
||||||
private fun Properties.defaultCompilerOpts(target: String, dependencies: String): List<String> {
|
private fun Properties.defaultCompilerOpts(target: String, dependencies: String): List<String> {
|
||||||
|
|
||||||
val sysRootDir = this.getOsSpecific("sysRoot", target)!!
|
val hostSysRootDir = this.getOsSpecific("sysRoot", target)!!
|
||||||
val sysRoot = "$dependencies/$sysRootDir"
|
val hostSysRoot = "$dependencies/$hostSysRootDir"
|
||||||
val targetSysRootDir = this.getOsSpecific("targetSysRoot", target)
|
val targetSysRootDir = this.getOsSpecific("targetSysRoot", target) ?: hostSysRootDir
|
||||||
val targetSysRoot = "$dependencies/$targetSysRootDir"
|
val targetSysRoot = "$dependencies/$targetSysRootDir"
|
||||||
|
val sysRoot = targetSysRoot
|
||||||
val llvmHomeDir = this.getOsSpecific("llvmHome", target)!!
|
val llvmHomeDir = this.getOsSpecific("llvmHome", target)!!
|
||||||
val llvmHome = "$dependencies/$llvmHomeDir"
|
val llvmHome = "$dependencies/$llvmHomeDir"
|
||||||
val llvmVersion = this.getProperty("llvmVersion")!!
|
val llvmVersion = this.getProperty("llvmVersion")!!
|
||||||
@@ -136,22 +138,22 @@ private fun Properties.defaultCompilerOpts(target: String, dependencies: String)
|
|||||||
"osx" ->
|
"osx" ->
|
||||||
return listOf(
|
return listOf(
|
||||||
"-isystem", isystem,
|
"-isystem", isystem,
|
||||||
"-B$sysRoot/usr/bin",
|
"-B$hostSysRoot/usr/bin",
|
||||||
"--sysroot=$sysRoot",
|
"--sysroot=$sysRoot",
|
||||||
"-mmacosx-version-min=10.10")
|
"-mmacosx-version-min=10.10")
|
||||||
"osx-ios" ->
|
"osx-ios" ->
|
||||||
return listOf(
|
return listOf(
|
||||||
"-arch", "arm64",
|
"-arch", "arm64",
|
||||||
"-isystem", isystem,
|
"-isystem", isystem,
|
||||||
"-B$sysRoot/usr/bin",
|
"-B$hostSysRoot/usr/bin",
|
||||||
"--sysroot=$targetSysRoot",
|
"--sysroot=$sysRoot",
|
||||||
"-miphoneos-version-min=5.0.0")
|
"-miphoneos-version-min=5.0.0")
|
||||||
"osx-ios-sim" ->
|
"osx-ios-sim" ->
|
||||||
return listOf(
|
return listOf(
|
||||||
"-arch", "x86_64",
|
"-arch", "x86_64",
|
||||||
"-isystem", isystem,
|
"-isystem", isystem,
|
||||||
"-B$sysRoot/usr/bin",
|
"-B$hostSysRoot/usr/bin",
|
||||||
"--sysroot=$targetSysRoot",
|
"--sysroot=$sysRoot",
|
||||||
"-mios-simulator-version-min=5.0.0")
|
"-mios-simulator-version-min=5.0.0")
|
||||||
"linux" -> {
|
"linux" -> {
|
||||||
val gccToolChainDir = this.getOsSpecific("gccToolChain", target)!!
|
val gccToolChainDir = this.getOsSpecific("gccToolChain", target)!!
|
||||||
@@ -161,7 +163,19 @@ private fun Properties.defaultCompilerOpts(target: String, dependencies: String)
|
|||||||
"-isystem", isystem,
|
"-isystem", isystem,
|
||||||
"--gcc-toolchain=$gccToolChain",
|
"--gcc-toolchain=$gccToolChain",
|
||||||
"-L$llvmHome/lib",
|
"-L$llvmHome/lib",
|
||||||
"-B$sysRoot/../bin",
|
"-B$hostSysRoot/../bin",
|
||||||
|
"--sysroot=$sysRoot")
|
||||||
|
}
|
||||||
|
"linux-raspberrypi" -> {
|
||||||
|
val gccToolChainDir = this.getOsSpecific("gccToolChain", target)!!
|
||||||
|
val gccToolChain= "$dependencies/$gccToolChainDir"
|
||||||
|
|
||||||
|
return listOf(
|
||||||
|
"-target", "armv7-unknown-linux-gnueabihf",
|
||||||
|
"-isystem", isystem,
|
||||||
|
"--gcc-toolchain=$gccToolChain",
|
||||||
|
"-L$llvmHome/lib",
|
||||||
|
"-B$hostSysRoot/../bin",
|
||||||
"--sysroot=$sysRoot")
|
"--sysroot=$sysRoot")
|
||||||
}
|
}
|
||||||
else -> error("Unexpected target: ${target}")
|
else -> error("Unexpected target: ${target}")
|
||||||
@@ -203,7 +217,6 @@ private fun processLib(konanHome: String,
|
|||||||
val flavorName = args["-flavor"]?.single() ?: "jvm"
|
val flavorName = args["-flavor"]?.single() ?: "jvm"
|
||||||
val flavor = KotlinPlatform.values().single { it.name.equals(flavorName, ignoreCase = true) }
|
val flavor = KotlinPlatform.values().single { it.name.equals(flavorName, ignoreCase = true) }
|
||||||
val target = args["-target"]?.single()?.targetSuffix() ?: defaultTarget()
|
val target = args["-target"]?.single()?.targetSuffix() ?: defaultTarget()
|
||||||
|
|
||||||
val defFile = args["-def"]?.single()?.let { File(it) }
|
val defFile = args["-def"]?.single()?.let { File(it) }
|
||||||
|
|
||||||
if (defFile == null && args["-pkg"] == null) {
|
if (defFile == null && args["-pkg"] == null) {
|
||||||
|
|||||||
+10
-5
@@ -4,10 +4,11 @@ import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
|||||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
|
|
||||||
enum class KonanTarget(var enabled: Boolean = false) {
|
enum class KonanTarget(var enabled: Boolean = false) {
|
||||||
IPHONE(),
|
IPHONE,
|
||||||
IPHONE_SIM(),
|
IPHONE_SIM,
|
||||||
LINUX(),
|
LINUX,
|
||||||
MACBOOK()
|
MACBOOK,
|
||||||
|
RASPBERRYPI
|
||||||
}
|
}
|
||||||
|
|
||||||
class TargetManager(val config: CompilerConfiguration) {
|
class TargetManager(val config: CompilerConfiguration) {
|
||||||
@@ -16,7 +17,10 @@ class TargetManager(val config: CompilerConfiguration) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
when (host) {
|
when (host) {
|
||||||
KonanTarget.LINUX -> KonanTarget.LINUX.enabled = true
|
KonanTarget.LINUX -> {
|
||||||
|
KonanTarget.LINUX.enabled = true
|
||||||
|
KonanTarget.RASPBERRYPI.enabled = true
|
||||||
|
}
|
||||||
KonanTarget.MACBOOK -> {
|
KonanTarget.MACBOOK -> {
|
||||||
KonanTarget.MACBOOK.enabled = true
|
KonanTarget.MACBOOK.enabled = true
|
||||||
KonanTarget.IPHONE.enabled = true
|
KonanTarget.IPHONE.enabled = true
|
||||||
@@ -66,6 +70,7 @@ class TargetManager(val config: CompilerConfiguration) {
|
|||||||
if (host == KonanTarget.LINUX) {
|
if (host == KonanTarget.LINUX) {
|
||||||
when (current) {
|
when (current) {
|
||||||
KonanTarget.LINUX -> return("linux")
|
KonanTarget.LINUX -> return("linux")
|
||||||
|
KonanTarget.RASPBERRYPI -> return("linux-raspberrypi")
|
||||||
KonanTarget.IPHONE -> return("linux-ios")
|
KonanTarget.IPHONE -> return("linux-ios")
|
||||||
KonanTarget.IPHONE_SIM -> return("linux-ios-sim")
|
KonanTarget.IPHONE_SIM -> return("linux-ios-sim")
|
||||||
else -> error("Impossible combination of $host and $current")
|
else -> error("Impossible combination of $host and $current")
|
||||||
|
|||||||
+40
-14
@@ -41,7 +41,6 @@ internal open class MacOSPlatform(distribution: Distribution)
|
|||||||
|
|
||||||
open val sysRoot = distribution.sysRoot
|
open val sysRoot = distribution.sysRoot
|
||||||
open val targetSysRoot = sysRoot
|
open val targetSysRoot = sysRoot
|
||||||
open val llvmLib = distribution.llvmLib
|
|
||||||
|
|
||||||
override fun linkCommand(objectFiles: List<String>, executable: String, optimize: Boolean): List<String> {
|
override fun linkCommand(objectFiles: List<String>, executable: String, optimize: Boolean): List<String> {
|
||||||
|
|
||||||
@@ -75,9 +74,15 @@ internal class IPhoneSimulatorFromMacOSPlatform(distribution: Distribution)
|
|||||||
override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.osx-ios-sim")
|
override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.osx-ios-sim")
|
||||||
override val targetSysRoot = "${distribution.dependencies}/${properties.propertyString("targetSysRoot.osx-ios-sim")!!}"
|
override val targetSysRoot = "${distribution.dependencies}/${properties.propertyString("targetSysRoot.osx-ios-sim")!!}"
|
||||||
}
|
}
|
||||||
internal class LinuxPlatform(distribution: Distribution)
|
|
||||||
|
internal open class LinuxPlatform(distribution: Distribution)
|
||||||
: PlatformFlags(distribution) {
|
: PlatformFlags(distribution) {
|
||||||
|
|
||||||
|
open val sysRoot = distribution.sysRoot
|
||||||
|
|
||||||
|
val llvmLib = distribution.llvmLib
|
||||||
|
val libGcc = distribution.libGcc
|
||||||
|
|
||||||
override val llvmLtoFlags = properties.propertyList("llvmLtoFlags.linux")
|
override val llvmLtoFlags = properties.propertyList("llvmLtoFlags.linux")
|
||||||
override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.linux")
|
override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.linux")
|
||||||
|
|
||||||
@@ -90,11 +95,6 @@ internal class LinuxPlatform(distribution: Distribution)
|
|||||||
properties.propertyList("pluginOptimizationFlags.linux")
|
properties.propertyList("pluginOptimizationFlags.linux")
|
||||||
|
|
||||||
override fun linkCommand(objectFiles: List<String>, executable: String, optimize: Boolean): List<String> {
|
override fun linkCommand(objectFiles: List<String>, executable: String, optimize: Boolean): List<String> {
|
||||||
|
|
||||||
val sysRoot = distribution.sysRoot
|
|
||||||
val llvmLib = distribution.llvmLib
|
|
||||||
val libGcc = distribution.libGcc
|
|
||||||
|
|
||||||
// TODO: Can we extract more to the konan.properties?
|
// TODO: Can we extract more to the konan.properties?
|
||||||
return mutableListOf<String>("$linker",
|
return mutableListOf<String>("$linker",
|
||||||
"--sysroot=${sysRoot}",
|
"--sysroot=${sysRoot}",
|
||||||
@@ -116,6 +116,29 @@ internal class LinuxPlatform(distribution: Distribution)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class RaspberryPiPlatform(distribution: Distribution)
|
||||||
|
: LinuxPlatform(distribution) {
|
||||||
|
|
||||||
|
override val sysRoot = "${distribution.dependencies}/${properties.propertyString("targetSysRoot.linux-raspberrypi")!!}"
|
||||||
|
|
||||||
|
override fun linkCommand(objectFiles: List<String>, executable: String, optimize: Boolean): List<String> {
|
||||||
|
// TODO: Can we extract more to the konan.properties?
|
||||||
|
return mutableListOf<String>("$linker",
|
||||||
|
"--sysroot=${sysRoot}",
|
||||||
|
"-export-dynamic", "-z", "relro", "--hash-style=gnu",
|
||||||
|
"--build-id", "--eh-frame-hdr",
|
||||||
|
"-dynamic-linker", "/lib/ld-linux-armhf.so.3",
|
||||||
|
"-o", executable,
|
||||||
|
"${sysRoot}/usr/lib/crt1.o", "${sysRoot}/usr/lib/crti.o", "${libGcc}/crtbegin.o",
|
||||||
|
"-L${llvmLib}", "-L${libGcc}", "-L${sysRoot}/../lib/arm-linux-gnueabihf", "-L${sysRoot}/lib/arm-linux-gnueabihf",
|
||||||
|
"-L${sysRoot}/usr/lib/arm-linux-gnueabihf", "-L${sysRoot}/../lib", "-L${sysRoot}/lib", "-L${sysRoot}/usr/lib") +
|
||||||
|
if (optimize) listOf("-plugin", "$llvmLib/LLVMgold.so") + pluginOptimizationFlags else {listOf<String>()} +
|
||||||
|
objectFiles +
|
||||||
|
if (optimize) linkerOptimizationFlags else {listOf<String>()} +
|
||||||
|
linkerKonanFlags +
|
||||||
|
listOf("-lgcc", "-lgcc_s", "-lc", "${libGcc}/crtend.o", "${sysRoot}/usr/lib/crtn.o")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal class LinkStage(val context: Context) {
|
internal class LinkStage(val context: Context) {
|
||||||
|
|
||||||
@@ -126,24 +149,28 @@ internal class LinkStage(val context: Context) {
|
|||||||
Distribution(context.config.configuration)
|
Distribution(context.config.configuration)
|
||||||
private val properties = distribution.properties
|
private val properties = distribution.properties
|
||||||
|
|
||||||
val platform: PlatformFlags = when (TargetManager.host) {
|
val platform = when (TargetManager.host) {
|
||||||
KonanTarget.LINUX -> LinuxPlatform(distribution)
|
KonanTarget.LINUX -> when (targetManager.current) {
|
||||||
|
KonanTarget.LINUX -> LinuxPlatform(distribution)
|
||||||
|
KonanTarget.RASPBERRYPI -> RaspberryPiPlatform(distribution)
|
||||||
|
else -> TODO("Target not implemented yet.")
|
||||||
|
}
|
||||||
KonanTarget.MACBOOK -> when (targetManager.current) {
|
KonanTarget.MACBOOK -> when (targetManager.current) {
|
||||||
KonanTarget.IPHONE_SIM
|
KonanTarget.IPHONE_SIM
|
||||||
-> IPhoneSimulatorFromMacOSPlatform(distribution)
|
-> IPhoneSimulatorFromMacOSPlatform(distribution)
|
||||||
KonanTarget.IPHONE
|
KonanTarget.IPHONE
|
||||||
-> IPhoneOSfromMacOSPlatform(distribution)
|
-> IPhoneOSfromMacOSPlatform(distribution)
|
||||||
KonanTarget.MACBOOK
|
KonanTarget.MACBOOK
|
||||||
-> MacOSPlatform(distribution)
|
-> MacOSPlatform(distribution)
|
||||||
else -> TODO("Target not implemented yet.")
|
else -> TODO("Target not implemented yet.")
|
||||||
}
|
}
|
||||||
else -> TODO("Target not implemented yet")
|
else -> TODO("Target not implemented yet")
|
||||||
}
|
}
|
||||||
|
|
||||||
val suffix = targetManager.currentSuffix()
|
val suffix = targetManager.currentSuffix()
|
||||||
|
|
||||||
val optimize = config.get(KonanConfigKeys.OPTIMIZATION) ?: false
|
val optimize = config.get(KonanConfigKeys.OPTIMIZATION) ?: false
|
||||||
val emitted = config.get(KonanConfigKeys.BITCODE_FILE)!!
|
val emitted = config.get(KonanConfigKeys.BITCODE_FILE)!!
|
||||||
val nostdlib = config.get(KonanConfigKeys.NOSTDLIB) ?: false
|
|
||||||
val nomain = config.get(KonanConfigKeys.NOMAIN) ?: false
|
val nomain = config.get(KonanConfigKeys.NOMAIN) ?: false
|
||||||
val libraries = context.config.librariesToLink
|
val libraries = context.config.librariesToLink
|
||||||
|
|
||||||
@@ -168,7 +195,6 @@ internal class LinkStage(val context: Context) {
|
|||||||
tmpObjectFile.deleteOnExit()
|
tmpObjectFile.deleteOnExit()
|
||||||
val objectFile = tmpObjectFile.absolutePath
|
val objectFile = tmpObjectFile.absolutePath
|
||||||
|
|
||||||
val tool = distribution.llvmLlc
|
|
||||||
val command = listOf(distribution.llvmLlc, "-o", objectFile, "-filetype=obj") +
|
val command = listOf(distribution.llvmLlc, "-o", objectFile, "-filetype=obj") +
|
||||||
properties.propertyList("llvmLlcFlags.$suffix") + listOf(file)
|
properties.propertyList("llvmLlcFlags.$suffix") + listOf(file)
|
||||||
runTool(*command.toTypedArray())
|
runTool(*command.toTypedArray())
|
||||||
|
|||||||
@@ -49,3 +49,12 @@ linkerOptimizationFlags.linux = --gc-sections
|
|||||||
pluginOptimizationFlags.linux = -plugin-opt=mcpu=x86-64 -plugin-opt=O3
|
pluginOptimizationFlags.linux = -plugin-opt=mcpu=x86-64 -plugin-opt=O3
|
||||||
entrySelector.linux = --defsym main=Konan_main
|
entrySelector.linux = --defsym main=Konan_main
|
||||||
|
|
||||||
|
// Raspberry Pi
|
||||||
|
arch.linux-raspberrypi = armv7
|
||||||
|
sysRoot.linux-raspberrypi = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot
|
||||||
|
targetSysRoot.linux-raspberrypi = target-sysroot-1-raspberrypi
|
||||||
|
llvmHome.linux-raspberrypi = clang+llvm-3.9.0-linux-x86-64
|
||||||
|
libGcc.linux-raspberrypi = target-sysroot-1-raspberrypi/lib/gcc/arm-linux-gnueabihf/4.8.3/
|
||||||
|
gccToolChain.linux-raspberrypi = target-gcc-toolchain-3-linux-x86-64
|
||||||
|
llvmLlcFlags.linux-raspberrypi = -mtriple=armv7-unknown-linux-gnueabihf --disable-fp-elim -mfloat-abi=hard
|
||||||
|
linkerKonanFlags.linux-raspberrypi = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lc -lpthread -fuse-ld=gold
|
||||||
|
|||||||
+10
-1
@@ -26,7 +26,16 @@ allprojects {
|
|||||||
|
|
||||||
if (isLinux()) {
|
if (isLinux()) {
|
||||||
ext.targetArgs <<
|
ext.targetArgs <<
|
||||||
["host": ["--sysroot=${gccToolchainDir}/${gnuTriplet}/sysroot"]]
|
["host":
|
||||||
|
["--sysroot=${gccToolchainDir}/${gnuTriplet}/sysroot"],
|
||||||
|
"raspberrypi":
|
||||||
|
["-target", "armv7-unknown-linux-gnueabihf",
|
||||||
|
"-mfpu=vfp", "-mfloat-abi=hard",
|
||||||
|
"--sysroot=$raspberryPiSysrootDir",
|
||||||
|
// TODO: those two are hacks.
|
||||||
|
"-I$raspberryPiSysrootDir/usr/include/c++/4.8.3",
|
||||||
|
"-I$raspberryPiSysrootDir/usr/include/c++/4.8.3/arm-linux-gnueabihf"]
|
||||||
|
]
|
||||||
} else {
|
} else {
|
||||||
ext.targetArgs <<
|
ext.targetArgs <<
|
||||||
["host":
|
["host":
|
||||||
|
|||||||
Vendored
+3
@@ -82,6 +82,9 @@ if (isLinux()) {
|
|||||||
task gccToolchain(type: TgzNativeDep) {
|
task gccToolchain(type: TgzNativeDep) {
|
||||||
baseName = "target-gcc-toolchain-3-$host"
|
baseName = "target-gcc-toolchain-3-$host"
|
||||||
}
|
}
|
||||||
|
task raspberryPiSysroot(type: TgzNativeDep) {
|
||||||
|
baseName = "target-sysroot-1-raspberrypi"
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
task hostSysroot(type: TgzNativeDep) {
|
task hostSysroot(type: TgzNativeDep) {
|
||||||
baseName = "target-sysroot-1-$host"
|
baseName = "target-sysroot-1-$host"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
DIR=.
|
DIR=.
|
||||||
DIST=../../dist
|
DIST=../../dist
|
||||||
DEPS=../../dependencies/all
|
DEPS=../../dependencies/all
|
||||||
|
|
||||||
CFLAGS_macbook=-I/Library/Frameworks/SDL2.framework/Headers
|
CFLAGS_macbook=-I/Library/Frameworks/SDL2.framework/Headers
|
||||||
LINKER_ARGS_macbook="-F /Library/Frameworks -framework SDL2"
|
LINKER_ARGS_macbook="-F /Library/Frameworks -framework SDL2"
|
||||||
COMPILER_ARGS_macbook=
|
COMPILER_ARGS_macbook=
|
||||||
@@ -16,6 +17,8 @@ LINKER_ARGS_iphone="-framework SDL2 \
|
|||||||
-framework AVFoundation -framework CoreGraphics -framework CoreMotion -framework Foundation -framework GameController \
|
-framework AVFoundation -framework CoreGraphics -framework CoreMotion -framework Foundation -framework GameController \
|
||||||
-framework AudioToolbox -framework OpenGLES -framework QuartzCore -framework UIKit"
|
-framework AudioToolbox -framework OpenGLES -framework QuartzCore -framework UIKit"
|
||||||
COMPILER_ARGS_iphone=-nomain
|
COMPILER_ARGS_iphone=-nomain
|
||||||
|
CFLAGS_raspberrypi=-I$DEPS/target-sysroot-1-raspberrypi/usr/include/SDL2
|
||||||
|
LINKER_ARGS_raspberrypi="-lSDL2"
|
||||||
|
|
||||||
if [ x$TARGET == x ]; then
|
if [ x$TARGET == x ]; then
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
@@ -30,8 +33,8 @@ CFLAGS=${!var}
|
|||||||
var=LINKER_ARGS_${TARGET}
|
var=LINKER_ARGS_${TARGET}
|
||||||
LINKER_ARGS=${!var}
|
LINKER_ARGS=${!var}
|
||||||
var=COMPILER_ARGS_${TARGET}
|
var=COMPILER_ARGS_${TARGET}
|
||||||
COMPILER_ARGS=${!var}
|
COMPILER_ARGS=${!var} # add -opt for an optimized build.
|
||||||
|
|
||||||
$DIST/bin/interop -def:$DIR/sdl.def -copt:"$CFLAGS" -target:$TARGET || exit 1
|
$DIST/bin/interop -def:$DIR/sdl.def -copt:"$CFLAGS" -target:$TARGET || exit 1
|
||||||
$DIST/bin/konanc $COMPILER_ARGS -target $TARGET sdl $DIR/tetris.kt -nativelibrary sdlstubs.bc -linkerArgs "$LINKER_ARGS" -o tetris.kexe -verbose linker || exit 1
|
$DIST/bin/konanc $COMPILER_ARGS -target $TARGET sdl $DIR/tetris.kt -nativelibrary sdlstubs.bc -linkerArgs "$LINKER_ARGS" -o tetris.kexe || exit 1
|
||||||
#strip tetris.kexe
|
#strip tetris.kexe
|
||||||
|
|||||||
Reference in New Issue
Block a user