32 lines
618 B
Groovy
32 lines
618 B
Groovy
import org.jetbrains.kotlin.CompileCppToBitcode
|
|
|
|
// TODO: consider using some Gradle plugins to build and test
|
|
|
|
|
|
task build(type: CompileCppToBitcode) {
|
|
name 'runtime'
|
|
srcRoot file('src/main')
|
|
|
|
}
|
|
|
|
task test {
|
|
dependsOn build
|
|
|
|
doLast {
|
|
exec {
|
|
commandLine "$llvmInstallPath/bin/clang", 'src/test/c/main.c', '-c', '-emit-llvm', '-o', "$buildDir/main.bc"
|
|
}
|
|
exec {
|
|
commandLine "$llvmInstallPath/bin/clang++", build.outFile, "$buildDir/main.bc", '-o', "$buildDir/main"
|
|
}
|
|
exec {
|
|
workingDir buildDir
|
|
commandLine './main'
|
|
}
|
|
}
|
|
}
|
|
|
|
task clean << {
|
|
delete buildDir
|
|
}
|