Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (29 sloc) 1.11 KB
plugins {
id 'kotlin-multiplatform'
}
def tensorflowHome = "${MPPTools.kotlinNativeDataPath()}/third-party/tensorflow"
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(hostPreset, 'tensorflow') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.tensorflow.main'
compilations.main.linkerOpts "-L$tensorflowHome/lib", '-ltensorflow'
compilations.main.cinterops {
tensorflow {
includeDirs "$tensorflowHome/include"
}
}
}
}
}
task downloadTensorflow(type: Exec) {
workingDir projectDir
commandLine './downloadTensorflow.sh'
}
tasks[kotlin.targets.tensorflow.compilations.main.cinterops.tensorflow.interopProcessingTaskName].dependsOn downloadTensorflow
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.tensorflow) {
environment 'LD_LIBRARY_PATH': "$tensorflowHome/lib"
environment 'DYLD_LIBRARY_PATH': "$tensorflowHome/lib"
}