Unverified Commit ba25a5c5 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Only create objcCompile task on macOS, fails on Windows in IDE (#360)

parent fe6bf4af
......@@ -711,33 +711,35 @@ val linkJvmBindings = tasks.register<LinkSkikoTask>("linkJvmBindings") {
flags.set(listOf(*osFlags))
}
// Very hacky way to compile Objective-C sources and add the
// resulting object files into the final library.
project.tasks.register<Exec>("objcCompile") {
val inputDir = "$projectDir/src/jvmMain/objectiveC/${targetOs.id}"
val outDir = "$buildDir/objc/$target"
val names = File(inputDir).listFiles()!!.map { it.name.removeSuffix(".mm") }
val srcs = names.map { "$inputDir/$it.mm" }.toTypedArray()
val outs = names.map { "$outDir/$it.o" }.toTypedArray()
workingDir = File(outDir)
val skiaDir = skiaJvmBindingsDir.get().absolutePath
commandLine = listOf(
"clang",
*targetOs.clangFlags,
"-I$jdkHome/include",
"-I$jdkHome/include/darwin",
"-I$skiaDir",
"-I$skiaDir/include",
"-I$skiaDir/include/gpu",
"-fobjc-arc",
"-DSK_METAL",
"-std=c++17",
"-c",
*srcs
)
file(outDir).mkdirs()
inputs.files(srcs)
outputs.files(outs)
if (hostOs == OS.MacOS) {
// Very hacky way to compile Objective-C sources and add the
// resulting object files into the final library.
project.tasks.register<Exec>("objcCompile") {
val inputDir = "$projectDir/src/jvmMain/objectiveC/${targetOs.id}"
val outDir = "$buildDir/objc/$target"
val names = File(inputDir).listFiles()!!.map { it.name.removeSuffix(".mm") }
val srcs = names.map { "$inputDir/$it.mm" }.toTypedArray()
val outs = names.map { "$outDir/$it.o" }.toTypedArray()
workingDir = File(outDir)
val skiaDir = skiaJvmBindingsDir.get().absolutePath
commandLine = listOf(
"clang",
*targetOs.clangFlags,
"-I$jdkHome/include",
"-I$jdkHome/include/darwin",
"-I$skiaDir",
"-I$skiaDir/include",
"-I$skiaDir/include/gpu",
"-fobjc-arc",
"-DSK_METAL",
"-std=c++17",
"-c",
*srcs
)
file(outDir).mkdirs()
inputs.files(srcs)
outputs.files(outs)
}
}
val generateVersion = project.tasks.register("generateVersion") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment