Gradle offers a plugin which compiler cpp-library
build.gradle.kts
plugins {
`cpp-library`
}
library {
targetMachines.add(machines.windows.x86_64)
linkage.set(listOf(Linkage.SHARED))
source.from("src/main/cpp/*.txt")
}
I am getting below output
:compileDebugCpp NO-SOURCE
How to use the source.from
to specify custom file extension like *.txt
I found the solution my self
I need to put the source in the compilation task as below
tasks.withType(CppCompile::class.java).configureEach {
source.from(fileTree("${project.rootDir}/${project.name}/src/main/cpp").matching {
include("*.txt")
})
}
this allow the gradle C++ compiler task compile .txt
files instead of .cpp
file
So in case if I want to compiler fortran
then I can put *.f
or *.f90
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.