gpt4 book ai didi

gradle - Gradle:如何删除NativeLibrarySpec的静态任务

转载 作者:行者123 更新时间:2023-12-03 04:40:39 24 4
gpt4 key购买 nike

我的jni库的gradle 2.3构建脚本如下所示。是否有可能删除为构建静态库而创建的任务?甚至更好的方法来防止创建静态任务?

model {
toolChains {
clang(Clang)
}
buildTypes {
release
}
components {
myNativeLib(NativeLibrarySpec) {
binaries.all {
if (toolChain in Clang && buildType == buildTypes.release) {
cppCompiler.args '-O3', '-mavx2',
"-I${javaHome}/../include",
"-I${javaHome}/../include/darwin", // os-dependent
"-I${buildDir}/javah" // output of javah
linker.args "-o${buildDir}/binaries/${nativeLibrary}"
}
}
}
}
}

最佳答案

您可以删除所有静态任务,如下所示:

model {
toolChains {
clang(Clang)
}
buildTypes {
release
}
components {
myNativeLib(NativeLibrarySpec) {
binaries.all {
if (toolChain in Clang && buildType == buildTypes.release) {
cppCompiler.args '-O3', '-mavx2',
"-I${javaHome}/../include",
"-I${javaHome}/../include/darwin", // os-dependent
"-I${buildDir}/javah" // output of javah
linker.args "-o${buildDir}/binaries/${nativeLibrary}"
}
}
// removes all static tasks
binaries.withType(StaticLibraryBinarySpec) {
binaries.remove(it)
}
}
}
}

关于gradle - Gradle:如何删除NativeLibrarySpec的静态任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28745074/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com