build: fix linking tests on Linux

runtime now requires "-lm"
This commit is contained in:
Svyatoslav Scherbina
2016-11-11 16:40:10 +07:00
committed by SvyatoslavScherbina
parent 66bd698270
commit edf3708515
+12 -2
View File
@@ -86,6 +86,7 @@ abstract class KonanTest extends DefaultTask {
return project.isLinux()
}
// TODO: stop copy-pasting
protected String linkDl() {
if (linux()) {
return "-ldl"
@@ -95,6 +96,15 @@ abstract class KonanTest extends DefaultTask {
}
}
protected String linkM() {
if (linux()) {
return "-lm"
}
else {
return ""
}
}
protected String rdynamic() {
if (linux()) {
return "-rdynamic"
@@ -110,7 +120,7 @@ class UnitKonanTest extends KonanTest {
def testC = sourceS.absolutePath.replace(".kt.S", "-test.c")
project.execClang {
commandLine "clang", "${testC}", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}",
"-o", "${exe.absolutePath}", linkDl(), rdynamic()
"-o", "${exe.absolutePath}", linkDl(), linkM(), rdynamic()
}
}
}
@@ -119,7 +129,7 @@ class RunKonanTest extends KonanTest {
void compileTest(File sourceS, File runtimeS, File exe) {
project.execClang {
commandLine "clang", "-DRUN_TEST", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}",
"-o", "${exe.absolutePath}", linkDl(), rdynamic()
"-o", "${exe.absolutePath}", linkDl(), linkM(), rdynamic()
}
}
}