import org.doomedsociety.gradlecpp.cfg.ToolchainConfig import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig import org.doomedsociety.gradlecpp.toolchain.icc.Icc import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin import org.gradle.nativeplatform.NativeBinarySpec import org.gradle.nativeplatform.NativeLibrarySpec import org.gradle.nativeplatform.toolchain.VisualCpp apply plugin: 'cpp' apply plugin: IccCompilerPlugin void setupToolchain(NativeBinarySpec b) { ToolchainConfig cfg = rootProject.createToolchainConfig(b) if (cfg instanceof MsvcToolchainConfig) { cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-' } else if (cfg instanceof GccToolchainConfig) { cfg.compilerOptions.languageStandard = 'c++0x' cfg.compilerOptions.args '-msse2', '-fp-model fast=2', '-fomit-frame-pointer', '-fvisibility=hidden', '-fvisibility-inlines-hidden', '-fno-rtti', '-g0', '-s' } ToolchainConfigUtils.apply(project, cfg, b) } model { buildTypes { debug release } platforms { x86 { architecture "x86" } } toolChains { visualCpp(VisualCpp) { } icc(Icc) { } } components { speex(NativeLibrarySpec) { targetPlatform 'x86' sources { speex_src(CppSourceSet) { source { srcDir "src" include "**/*.c" } exportedHeaders { srcDir "include" } } } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } } } }