Skip to content

Instantly share code, notes, and snippets.

@freekh
Last active August 29, 2015 14:06
Show Gist options
  • Save freekh/ebd5c6477cf2b18d2d90 to your computer and use it in GitHub Desktop.
Save freekh/ebd5c6477cf2b18d2d90 to your computer and use it in GitHub Desktop.
main = asm.Executable
main { //could also not name the exec and use asm.Executable { ....?
x86.architecture = "i386" //x86 is a platform
binaries.all {
if (toolChain in VisualCop) {
source sources.i386_masm.asm
assembler.args "/Zi"
} else {
source sources.i386_gcc.asm
}
}
}
sources {
i386_masm {
asm(AssemblerSourceSet) {
source.srcDir "src/main/asm_i386_masm"
}
}
i386_gcc {
asm(AssemblerSourceSet) {
source.srcDir "src/main/asm_i386_gcc"
}
}
}
hello = c.Library
main = c.Executable
main.c.sources.lib = libraries.hello
binaries.all {
// Define toolchain-specific compiler and linker options
if (toolChain in Gcc) {
cCompiler.args "-O2"
linker.args "-Xlinker", "-S"
}
if (toolChain in VisualCpp) {
cCompiler.args "/Zi"
linker.args "/DEBUG"
}
}
// For any shared library binaries built with Visual C++,
// define the DLL_EXPORT macro
binaries.withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cCompiler.args "/Zi"
cCompiler.define "DLL_EXPORT"
}
}
myLib = java.Library //myArtifact = java.Library and java.Application
myLib.java.sourceCompatibility = "1.6" //java is the platform
sources {
java
}
myLib.sources = sources.java ++ sources.resources //overrides with what is the default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment