Gradle 格雷德尔:试图建立一个*。所以不会有任何结果
我是Gradle的新手,尤其是在C/C++构建方面。我想把烤饼翻译成格拉德尔。我有目录common/src,其中包含所有*.cc和*.h文件。build.gradle包含以下内容:Gradle 格雷德尔:试图建立一个*。所以不会有任何结果,gradle,build.gradle,Gradle,Build.gradle,我是Gradle的新手,尤其是在C/C++构建方面。我想把烤饼翻译成格拉德尔。我有目录common/src,其中包含所有*.cc和*.h文件。build.gradle包含以下内容: apply plugin: 'c' apply plugin: 'cpp' apply from: './gradle.properties' model { components { common(NativeLibrarySpec) } binaries {
apply plugin: 'c'
apply plugin: 'cpp'
apply from: './gradle.properties'
model {
components {
common(NativeLibrarySpec)
}
binaries {
withType(SharedLibraryBinarySpec) {
if (targetPlatform.operatingSystem.windows) {
cppCompiler.args '/MT', '/ZI'
}
if (targetPlatform.operatingSystem.linux) {
cppCompiler.args '-c', '-g', '-fPIC'
linker.args '-pthread'
}
}
}
}
我正在尝试构建。所以,没有生成任何内容,甚至没有错误
./gradlew commonSharedLibrary
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 0s
我错过了什么?
在哪里可以找到一些C/C++文档和示例
$ ../gradlew -version
------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------
Build time: 2018-04-18 09:09:12 UTC
Revision: b9a962bf70638332300e7f810689cb2febbd4a6c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_151 (Oracle Corporation 25.151-b12)
OS: Linux 3.10.0-514.el7.x86_64 amd64
我不认为你真的声明了Gradle脚本将要构建的源代码
main(NativeLibrarySpec) {
sources {
c {
source {
srcDir "src/source" <---- replace where your source is
include "**/*.c" <------ tells it to compile all c files in dir
}
exportedHeaders { <----- include files for the project
srcDirs "include"
}
}
}
在components{}
范围内,您基本上说您正在构建一个名为Common的库。。。这基本上会生成commonSharedLibrary
任务(实际上什么都不做)
如果调用组件tada(NativeLibrarySpec)
它将生成相应的tadaSharedLibrary
在组件{}
中,您需要声明所构建内容的源{}
main(NativeLibrarySpec) {
sources {
c {
source {
srcDir "src/source" <---- replace where your source is
include "**/*.c" <------ tells it to compile all c files in dir
}
exportedHeaders { <----- include files for the project
srcDirs "include"
}
}
}
main(NativeLibrarySpec){
来源{
c{
来源{
srcDir“src/source”