How to override the name of the program used to compile C++ sources and the linker?

When compiling for PNaCl I really need to use the script “pnacl-clang” in place of “clang”, but in 2.11 I can’t see any option to override the name of the executable. I currently have a working Makefile and really I’m looking for the equivalent of setting CXX, LD, etc in gradle.

Since I am new to gradle I thought I would try tweaking the native-binaries/variants sample to do this where it sets the cppCompiler.args, and I had seen older posts that set cppCompiler.executable. However that doesn’t seem to work and I get an error “No signature of method XXX is applicable to argument types”.

Any ideas how I might do this? I am presuming that I’m missing something pretty basic as I am really new to gradle.

Thanks

1 Like

OK I solved this. I can now build using pnacl-clang but I had to create a toolchain - I don’t think it works yet but at least I have some hope. I was surprised that this took so long though …

If someone else wants to use pnacl something like this seems to work for me:

model {
  buildTypes {
    debug
    release
  }
  platforms {
    pnacl {
    }
  }
  toolChains {
    pnacl(Clang) {
      ext.nacl_sdk_root = "...path/to/nacl_sdk/pepper_47"
      path file(nacl_sdk_root + '/toolchain/mac_pnacl/bin/') // TODO get OSNAME
      target 'pnacl', {
        it.cppCompiler.executable 'pnacl-clang++'
        it.cCompiler.executable 'pnacl-clang'
        it.linker.executable 'pnacl-clang++'
        it.objcCompiler.executable 'pnacl-clang'
        it.objcppCompiler.executable 'pnacl-clang++'
        it.staticLibArchiver.executable 'pnacl-ar'
      }
    }
    main(NativeExecutableSpec) {
        targetPlatform "pnacl"
    }
  }