Skip to content

Instantly share code, notes, and snippets.

Created August 8, 2014 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7e80670dcd3a091127e9 to your computer and use it in GitHub Desktop.
Save anonymous/7e80670dcd3a091127e9 to your computer and use it in GitHub Desktop.
Gradle cross-compile definition
// ###########################
//GRADLE 1.12 definition
// ###########################
model {
platforms {
omnilinux_ppc {
architecture "arm" // HACK FOR PPC, ppc not recognized
operatingSystem "linux"
}
}
toolChains {
gcc(Gcc) {
// Uncomment to use a GCC install that is not in the PATH
// path "/usr/bin/gcc"
}
omnilinux_ppc(Gcc) {
def prefix = "powerpc-405-linux-gnu-"
CCompiler.executable = prefix + CCompiler.executable
cppCompiler.executable = prefix + cppCompiler.executable
assembler.executable = prefix + assembler.executable
linker.executable = prefix + linker.executable
staticLibArchiver.executable = prefix + staticLibArchiver.executable
addPlatformConfiguration(new OmniLinuxPpcConfiguration())
}
}
}
class OmniLinuxPpcConfiguration implements TargetPlatformConfiguration {
boolean supportsPlatform(Platform platform) {
return platform.operatingSystem.linux && platform.architecture.arm // HACK FOR PPC
}
List<String> getCCompilerArgs() {
[]
}
List<String> getCppCompilerArgs() {
["-DOMNI_LINUX_PLATFORM"]
}
List<String> getObjectiveCCompilerArgs() {
[]
}
List<String> getObjectiveCppCompilerArgs() {
[]
}
List<String> getAssemblerArgs() {
[]
}
List<String> getLinkerArgs() {
[]
}
List<String> getStaticLibraryArchiverArgs() {
[]
}
}
// ###########################
// GRADLE 2.0 definition
// ###########################
model {
platforms {
omnilinux_ppc {
architecture "ppc"
operatingSystem "linux"
}
}
toolChains {
gcc(Gcc) {
// Uncomment to use a GCC install that is not in the PATH
// path "/usr/bin/gcc"
}
target("omnilinux_ppc") {
def prefix = "powerpc-405-linux-gnu-"
cppCompiler.executable = prefix + cppCompiler.executable
assembler.executable = prefix + assembler.executable
linker.executable = prefix + linker.executable
staticLibArchiver.executable = prefix + staticLibArchiver.executable
cppCompiler.withArguments { args ->
args << "-DOMNI_LINUX_PLATFORM"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment