Native: exclude paths from options

(Patrik Schalin) #1

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?


(Ante Ilic) #2

Did you set the windows sdk directory?

(Patrik Schalin) #3

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


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'

(Ante Ilic) #4

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.* }

(Patrik Schalin) #5

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!

(Jay McGaffigan) #6

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?