On Wed, Jun 11, 2014 at 9:59 PM, Xavier Ducrohet <x...@google.com> wrote:
> I'm trying to build an executable under linux for both linux and windows, > as well as mac on mac. > For Linux, I'm using a mingw32 toolchain that can output windows > executables on linux. > > I added a Clang toolchain for MacOS and the mingw32(Gcc) toolchain for > windows, and forgot about linux. Basically I had this: > > > 1. toolChains { > 2. host(Clang) > 3. mingw(Gcc) { > 4. > 5. addPlatformConfiguration(new MingwOnLinuxConfiguration()) > > (I also setup the toolchain to point to the installed mingw) > > With this TargetPlatformConfiguration: > > > 1. class MingwOnLinuxConfiguration implements > TargetPlatformConfiguration { > 2. > 3. boolean supportsPlatform(Platform element) { > 4. return element.getOperatingSystem().name == "windows" > 5. } > > > What is extremely strange is that when building linux on linux, it should > have failed: no Clang toolchain available, and mingw should be compatible > with windows target only. Yet it used mingw to build linux. Is this > expected? > Yep. Gcc.addPlatformConfiguration() is adding a new supported platform to the set of platforms that are supported by Gcc by default. There's not currently any way to replace or remove this default support. > > I've also run into a few issues where changing C compiler Args or Linker > Args doesn't trigger a new compile or linker execution. It seems like the > task inputs don't take those into account properly (under Gradle 1.12). I > can file a separate bug for this. > This definitely should work, but there might be cases in which it's not quite right. If you can provide more details that would be helpful. -- 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