Skip to content

Instantly share code, notes, and snippets.

@glasspelican
Created July 14, 2016 01:26
Show Gist options
  • Save glasspelican/d65eb2d3a5bd8f327ede58a55819b4eb to your computer and use it in GitHub Desktop.
Save glasspelican/d65eb2d3a5bd8f327ede58a55819b4eb to your computer and use it in GitHub Desktop.
apply plugin: 'c'
binaries.all {
if (toolChain in Gcc || toolChain in Clang) {
if (buildType == buildTypes.release) {
cCompiler.define "NDEBUG"
}
cCompiler.define "_REENTRANT"
cCompiler.define "LUA_USE_POSIX"
cCompiler.define "LUA_USE_DLOPEN"
if (buildType == buildTypes.debug) {
cCompiler.args "-g", "-fno-strict-aliasing", "-std=gnu99"
}
else {
cCompiler.args "-O2", "-fno-strict-aliasing", "-std=gnu99", "-Wall", "-Wextra"
linker.args "-s"
}
tasks.withType(LinkSharedLibrary) {
tasks.withType(CCompile) {
includes.from("eris/src")
includes.from("/usr/lib/jvm/java-6-openjdk/include")
includes.from("/usr/lib/jvm/java-6-openjdk/include/linux")
includes.from("/usr/lib/jvm/java-7-openjdk/include")
includes.from("/usr/lib/jvm/java-7-openjdk/include/linux")
includes.from("/usr/lib/jvm/java-7-openjdk-amd64/include")
includes.from("/usr/lib/jvm/java-7-openjdk-amd64/include/linux")
includes.from("/usr/local/openjdk7/include")
includes.from("/usr/local/openjdk7/include/freebsd")
includes.from("/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/include")
includes.from("/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/include/darwin")
includes.from("/root/jdk1.8.0_92/include")
includes.from("/root/jdk1.8.0_92/include/solaris")
}
}
}
if (toolChain in VisualCpp) {
if (buildType == buildTypes.debug) {
cCompiler.args "/Od", "/Zi", "/MTd"
linker.args "/debug"
}
else {
cCompiler.args "/O2", "/MT"
}
tasks.withType(LinkSharedLibrary) {
tasks.withType(CCompile) {
includes.from("eris/src")
includes.from("C:/Program Files (x86)/Java/jdk1.7.0_55/include")
includes.from("C:/Program Files (x86)/Java/jdk1.7.0_55/include/win32")
}
if (targetPlatform == platforms.x86)
libs += files("C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/uuid.lib", "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/kernel32.lib")
if (targetPlatform == platforms.x64)
libs += files("C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/x64/uuid.lib", "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/x64/kernel32.lib")
}
}
tasks.withType(CCompile) {
positionIndependentCode = true
}
}
libraries {
natives { targetPlatforms "x86", "x64", "arm" }
}
sources {
natives {
c {
source {
srcDir "eris/src"
srcDir "jnlua/jnlua/src/main/c"
include "*.c"
exclude "luac.c", "lua.c"
exclude "javavm.c"
}
}
}
}
model {
buildTypes {
debug
release
}
platforms {
x86 { architecture "x86" }
x64 { architecture "x86_64" }
arm { architecture "arm" }
}
toolChains {
gcc(Gcc) {
linker.executable = 'gcc'
target('arm') {
linker.executable = 'arm-unknown-linux-gnueabi-gcc'
cCompiler.executable = 'arm-unknown-linux-gnueabi-gcc'
}
}
clang(Clang)
visualCpp(VisualCpp)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment