My system has several different versions of Visual Studio installed (all of 2005, 2008, 2010, 2012, 2013). Right now it seems that gradle is picking 2013 as the version it’s compiling with, which is not what I want it to do at moment. I would like it to use both 2010 and 2012 to build the native binary. That is, make one version of the binary with 2010 and another version of the binary with 2012.
I’m already actually using buildTypes for debug/release type builds, so would ‘flavors’ work instead? This appears to be rather clunky to get working because I would like to use flavors for a different purpose (other than toolchain versioning) later.
It feels like there should be the ability in the toolchains DSL to specify the list toolchains and optionally their versions to build with… maybe this is simply upcoming.
Do you use this snippet in your own build. I’m surprised you can modify ‘model.toolchains.visualCpp.installDir’ depending on the buildType. I would assume that with the current implementation the last installDir assignment wins. In the following snippet I guess it’s always pointing to VS2012 as you modify a global variable here
executables {
main {
binaries.all {
if ( buildType == buildTypes.VS2010) {
model.toolchains.visualCpp.installDir = '......'
}
if ( buildType == buildTypes.VS2012) {
//this will always be used
model.toolchains.visualCpp.installDir = '......'
}
}
}
}
For gcc compatible toolchains (gcc + clang) you could define a targetplatform per visualstudio implementation but with visualstudio I think this is currently not possible.