build: add target native SDK as downloadable dependency

also improve Gradle native toolchains configuration
This commit is contained in:
Svyatoslav Scherbina
2016-11-02 15:12:18 +07:00
committed by SvyatoslavScherbina
parent db1853f627
commit e7558f9ddc
7 changed files with 24 additions and 23 deletions
-7
View File
@@ -16,13 +16,6 @@ def javaHome = System.getProperty('java.home')
def compilerArgsForJniIncludes = ["", "linux", "darwin"].collect { "-I$javaHome/../include/$it" } as String[]
model {
//TODO: it's better to find some way share this configuration
toolChains {
clang(Clang) {
path "${llvmDir}/bin/clang"
}
}
components {
clangbridge(NativeLibrarySpec) {
sources {
-7
View File
@@ -15,13 +15,6 @@ def javaHome = System.getProperty('java.home')
def compilerArgsForJniIncludes = ["", "linux", "darwin"].collect { "-I$javaHome/../include/$it" } as String[]
model {
//TODO: it's better to find some way share this configuration
toolChains {
clang(Clang) {
path "${llvmDir}/bin/clang"
}
}
components {
callbacks(NativeLibrarySpec) {
sources.c.source {
+5
View File
@@ -12,6 +12,7 @@ abstract class KonanTest extends DefaultTask {
def runtimeProject = project.project(":runtime")
def llvmLlc = llvmTool("llc")
def llvmC = llvmTool("clang")
def llvmCAdditionalArgs = ["--sysroot=$project.sysrootDir"]
def runtimeBc = new File("${runtimeProject.buildDir.canonicalPath}/runtime.bc")
def mainC = 'main.c'
String goldValue = null
@@ -88,6 +89,8 @@ class UnitKonanTest extends KonanTest {
project.exec {
commandLine "${llvmC}", "${testC}", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}",
"-o", "${exe.absolutePath}"
args llvmCAdditionalArgs
}
}
}
@@ -97,6 +100,8 @@ class RunKonanTest extends KonanTest {
project.exec {
commandLine "${llvmC}", "-DRUN_TEST", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}",
"-o", "${exe.absolutePath}"
args llvmCAdditionalArgs
}
}
}
+9 -9
View File
@@ -11,16 +11,16 @@ allprojects {
evaluationDependsOn(":dependencies")
}
afterEvaluate {
if (plugins.hasPlugin('c')) {
model {
toolChains {
clang(Clang) {
path "$llvmDir/bin"
plugins.withType(NativeComponentPlugin) {
model {
toolChains {
clang(Clang) {
path "$llvmDir/bin"
// The system PATH should be appended automatically according to Gradle docs,
// but this doesn't seem to happen
path System.env.PATH.split(File.pathSeparator)
eachPlatform { // TODO: will not work when cross-compiling
[cCompiler, cppCompiler, linker].each {
it.withArguments { it << "--sysroot=$sysrootDir" }
}
}
}
}
@@ -73,6 +73,8 @@ class CompileCppToBitcode extends DefaultTask {
executable "$project.llvmDir/bin/clang++"
args '-std=c++11'
args "--sysroot=$project.sysrootDir"
args compilerArgs
args "-I$headersDir"
@@ -174,6 +174,10 @@ class NamedNativeInteropConfig implements Named {
args "-linker:" + linker
}
String sysrootArg = "--sysroot=$project.sysrootDir"
compilerOpts += sysrootArg
linkerOpts += sysrootArg
args compilerOpts.collect { "-copt:$it" }
args linkerOpts.collect { "-lopt:$it" }
+4
View File
@@ -85,6 +85,10 @@ task llvm(type: TgzNativeDep) {
baseName = "clang+llvm-3.8.0-$target"
}
task sysroot(type: TgzNativeDep) {
baseName = "target-sysroot-1-$target"
}
task update {
dependsOn tasks.withType(NativeDep)