diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 0b8e1853bf4..8c0a4dc09fc 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -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() } } }