我将大型代码库从自定义构建系统移植到Gradle。
我是否有办法用2个项目而不是2个独立的解决方案生成单个VS解决方案?
我的示例build.gradle文件:
apply plugin: 'cpp'
apply plugin: 'visual-studio'
model {
components {
debugger(NativeExecutableSpec) {
}
nativeagent(NativeLibrarySpec) {
}
}
visualStudio {
solutions.all {
solutionFile.location = "vs/${name}.sln"
}
projects.all {
projectFile.location = "vs/${name}.vcxproj"
filtersFile.location = "vs/${name}.filters"
}
}
}
来自.\gradlew tasks
的输出:
.....
IDE tasks
---------
cleanVisualStudio - Removes all generated Visual Studio project and solution files
debuggerVisualStudio - Generates the Visual Studio solution for native executable 'debugger'.
nativeagentVisualStudio - Generates the Visual Studio solution for native library 'nativeagent'.
答案 0 :(得分:1)
我自己想出来,只需指定项目之间的依赖关系:
debugger(NativeExecutableSpec) {
sources {
cpp {
lib library: "nativeagent"
source {
srcDir "debugger/src"
include "**/*.cpp"
}
}
}
}
并运行.\gradlew debuggerVisualStudio