model { toolChains { clang(Clang) { target('x86') { cppCompiler.withArguments { args -> args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors' args << '-fPIC' << '-m32' args << '-Wno-unused-parameter' << '-Wno-missing-field-initializers' << '-Wno-unused-private-field' } linker.withArguments { args -> args << '-m32' } } target('x64') { cppCompiler.withArguments { args -> args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors' args << '-fPIC' args << '-Wno-missing-field-initializers' << '-Wno-unused-private-field' << '-Wno-unused-parameter' } } } } } ext.setupReleaseDefines = { cppCompiler, linker -> cppCompiler.args '-O2' } ext.setupDebugDefines = { cppCompiler, linker -> cppCompiler.args '-g', '-O0' } // Used only on Windows. ext.setupDef = { linker, deffile -> } ext.debugStripSetup = { if (!project.hasProperty('debug')) { project.tasks.whenObjectAdded { task -> if (task.name.contains('link') && task.name.contains('SharedLibrary')) { def library = task.outputFile.absolutePath task.doLast { exec { commandLine "dsymutil", library } exec { commandLine "strip", '-S', library } } } } } }