With the current Gradle version, is it possible to compile native C sources using Clang on Windows?


(Jesús Zazueta) #1

Hi. Like the title says; I’ve looked through the forums but I don’t think I’ve found something.

Thank you!


(René Groeschke) #2

Hello Jesús, As far as I know clang does not yet support windows out of the box. The easiest way to get clang on windows working with gradle is to install it via cygwin. Once you have clang installed via cygwin (http://cygwin.com), you should be able to configure the clang toolchain in the build.gradle file like this:

apply plugin: 'c'
  model {
 toolChains {
  clang(Clang){
   cCompiler.executable = "C:\cygwin\bin\clang.exe"
          ...
                }
    }
}
  executables {
    main {}
}

hope that helped,

cheers, René


(Jesús Zazueta) #3

Well that could certainly be useful.

If it helps, someone is maintaining a Win32 port of Clang here: http://www.ishani.org/web/articles/code/clang-win32

Thanks again!