I’m working on compiling a SWIG application and we want to compile it for multiple systems. my problem at the moment is how can i build both an x86_64 and x86 for the same target. It would be preferable to also build this for windows using ming-gw. how would I configure gradle to do this in one build step. Is there a better way to configure this setup?
apply plugin: 'cpp-library'
library {
baseName = "bullet"
targetMachines = [
machines.windows.x86_64,
machines.windows.x86,
machines.linux.x86_64,
machines.linux.x86,
machines.macOS.x86_64,
machines.macOS.x86
]
binaries.configureEach {
def compileTask = compileTask.get()
compileTask.compilerArgs.add("-DBT_NO_PROFILE")
compileTask.compilerArgs.add("-DBT_USE_INVERSE_DYNAMICS_WITH_BULLET2")
if (targetPlatform.targetMachine.operatingSystemFamily.isMacOs()) {
compileTask.compilerArgs.add("-I$rootDir/natives/jni-headers/mac/")
} else if (targetPlatform.targetMachine.operatingSystemFamily.isLinux()) {
compileTask.compilerArgs.add("-I$rootDir/natives/jni-headers/linux/")
} else if (targetPlatform.targetMachine.operatingSystemFamily.isWindows()) {
compileTask.compilerArgs.add("-I$rootDir/natives/jni-headers/win32/")
}
}
publicHeaders.from = ["$rootDir/build/swig"]
privateHeaders.from = ["jni-headers", "bullet", "custom", "extras/Serialize", "extras"]
source.from = ["$rootDir/natives", "$rootDir/build/swig"]
buildDir = "$rootDir/build/natives"
}