build: simplify clang(++) configuration

also introduce 'execClang' block
This commit is contained in:
Svyatoslav Scherbina
2016-11-08 11:34:30 +07:00
committed by SvyatoslavScherbina
parent 4e5e7d37ee
commit 55f8257f92
7 changed files with 75 additions and 24 deletions
+4 -10
View File
@@ -11,8 +11,6 @@ abstract class KonanTest extends DefaultTask {
def backendNative = project.project(":backend.native")
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
@@ -100,22 +98,18 @@ abstract class KonanTest extends DefaultTask {
class UnitKonanTest extends KonanTest {
void compileTest(File sourceS, File runtimeS, File exe) {
def testC = sourceS.absolutePath.replace(".kt.S", "-test.c")
project.exec {
commandLine "${llvmC}", "-B${project.sysrootDir}/usr/bin", "${testC}", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", linkDl(),
project.execClang {
commandLine "clang", "${testC}", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", linkDl(),
"-o", "${exe.absolutePath}"
args llvmCAdditionalArgs
}
}
}
class RunKonanTest extends KonanTest {
void compileTest(File sourceS, File runtimeS, File exe) {
project.exec {
commandLine "${llvmC}", "-DRUN_TEST", "-B${project.sysrootDir}/usr/bin", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", linkDl(),
project.execClang {
commandLine "clang", "-DRUN_TEST", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", linkDl(),
"-o", "${exe.absolutePath}"
args llvmCAdditionalArgs
}
}
}