Hi Rene

I don't think the Visual C++ installation is 'configurable' in the same way
as GCC. As far as I'm aware, the set of compilers and target platforms for
Visual Studio is a known set, unlike GCC which can be built to
cross-compile for virtually any platform.

So I think we're better off focusing on modelling the platform differences
that different Visual Studio versions can target, rather than adding this
level of user customisation which may or may not help.

So I would hold off on switching to 'withInvocation', at least for now.
There are more important stories to tackle. Might want to just update the
spec to cover the work already completed, and leave a story for the
'withInvocation' change.

Daz


On Fri, Apr 25, 2014 at 9:04 AM, Rene Groeschke <gra...@breskeby.com> wrote:

>  Hey guys,
>
> I'm currently working on improving the toolchain configuration.
>
> With my latest changes it is possible to tweak commandline arguments
> also for visualcpp toolchain:
>
> model {
>             toolChains {
>                 visualCpp(VisualCpp) {
>                     cppCompiler.withArguments { args ->
>                             args << "-DFRENCH"
>                     }
>                 }
>             }
> }
>
> Furthermore I tweaked the AbstractGccToolchain to allow a custom
> executable per targetplatform:
>
> model {
>                 toolChains {
>                     clang(Clang) {
>                         target("arm"){
>                             cCompiler.executable = '/usr/bin/my-c-compiler'
>                         }
>                     }
>                 }
>                 platforms {
>                     arm {
>                         architecture "arm" // uses custom-c-compiler
>                     }
>                     i386 {
>                         architecture "i386" // uses default clang
>                     }
>                 }
>             }
>
> I'm not sure if customizing the executable for a visualcpp toolchain is
> necessary. I don't have a usecase for that in mind.
>
> Inhttps://github.com/gradle/gradle/blob/master/design-docs/continuous-delivery-for-c-plus-plus.md#story-improved-dsl-for-tool-chain-configuration
> we replace the withArgument method with a "withInvocation" block:
>
> model {
>     toolChains {
>         gcc(Gcc) {
>             cppCompiler.withInvocation {
>                 executable "my-cpp-compiler"
>                 args.replace("-m32", "-march=i386")
>             }
>          }
>     }
> }
>
>
> This defers the configuration of the executable just before the
> compilation is started. IMO has different pros & cons
>
> - we can react on the default selected executable (e.g. pipe all clang++
> calls via my own clang script)
> - a possible expensive configuration is only done when compilation is
> done in the build
> - every toolchain evaluates if the necessary tools are available. in the
> last example this would look for a clang executable when detecting
> available toolchains, even though it is not used.
>
> I discussed the current need for "withInvocation" with Daz a while ago
> and I'm not sure about the benefit of this atm. Are there usecases here
> I havn't thought of?
>
> cheers,
> René
>
>
>


-- 
Darrell (Daz) DeBoer
Principal Software Engineer, *Gradleware <http://gradleware.com>*

Join us for Gradle Summit 2014, June 12th and 13th in Santa Clara, CA:
http://www.gradlesummit.com

Reply via email to