Native: exclude paths from options

Hi All,

Is it possible to change what goes into the native build as compiler/linker options?

In my current build Gradle picks up stuff that I don’t want to have in the build.

Consider the following options.txt snippet…

"/IC:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
"/IC:\Program Files (x86)\Windows Kits\8.1\Include\shared"
"/IC:\Program Files (x86)\Windows Kits\8.1\Include\um"

If I want to exclude the Windows Kits\8.1 parts, how do I do that?

Thanks

Did you set the windows sdk directory?

In this case I don’t want to use the SDK at all. Problem is it gets picked up automatically.

Tried:

toolChains {
    visualCpp(VisualCpp) {
        windowsSdkDir ""
    }
}

But got:

E:\git-repos\execat>gradle tasks

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\git-repos\execat\build.gradle' line: 60

* What went wrong:
A problem occurred configuring root project 'execat'.
> Exception thrown while executing model rule: model.toolChains @ build.gradle line 58, column 2
> Neither path nor baseDir may be null or empty string. path='' basedir='E:\git-repos\execat'

I know this is a bit of a hack but you could remove it from arguments by doing something like this:

toolChains {
  eachPlatform { toolChain ->
     cppCompiler.withArguments { args ->
       def sdkIncludes = args.findAll { it ==~ \.*8\.1.* }
       args.remove(sdkIncludes)
     }
   }
}

Ahhh…the fact that the build.gradle is a first class citizen and not some XML conf still gets me from time to time… :wink:

Thank you, I’ll try that!

Is this still the way to do this? I’m compiling some Unit tests for an ARM based build and I’d like these files to not be there. the /X option doesn’t seem to remove them. Why do these get added at all ? or How?
thanks
Jay