bullet-native: move generate headers task

native-compilation-test
Kirill Vainer 8 years ago
parent 2e8d69f809
commit 3cdb7fd928
  1. 63
      jme3-bullet-native-android/build.gradle
  2. 35
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_PhysicsSpace.h
  3. 1
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsRigidBody.h
  4. 51
      jme3-bullet/build.gradle

@ -50,6 +50,7 @@ task unzipBullet(type: Copy) {
from zipTree(zipFile)
into outputDir
}
unzipBullet.dependsOn {
def zipFile = file(localZipFile)
// println "zipFile path: " + zipFile.absolutePath
@ -70,6 +71,7 @@ task copyBullet(type: Copy) {
from sourceDir
into outputDir
}
copyBullet.dependsOn {
def bulletUnzipDir = file(localZipFolder)
// println "bulletUnzipDir: " + bulletUnzipDir.absolutePath
@ -81,7 +83,7 @@ copyBullet.dependsOn {
}
// Copy jME cpp native files to jni directory
task copyJmeCpp(type: Copy, dependsOn:copyBullet) {
task copyJmeCpp(type: Copy) {
def sourceDir = new File(jmeCppPath)
def outputDir = new File(jniPath)
// println "copyJmeCpp sourceDir = " + sourceDir
@ -92,7 +94,7 @@ task copyJmeCpp(type: Copy, dependsOn:copyBullet) {
}
// Copy jME android native files to jni directory
task copyJmeAndroid(type: Copy, dependsOn:copyJmeCpp) {
task copyJmeAndroid(type: Copy) {
def sourceDir = new File(jmeAndroidPath)
def outputDir = new File(jniPath)
// println "copyJmeAndroid sourceDir = " + sourceDir
@ -102,62 +104,7 @@ task copyJmeAndroid(type: Copy, dependsOn:copyJmeCpp) {
into outputDir
}
task generateNativeHeaders(dependsOn: copyJmeAndroid) {
doLast {
String destDirPath = jniPath
String classes = " \
com.jme3.bullet.PhysicsSpace, \
\
com.jme3.bullet.collision.PhysicsCollisionEvent, \
com.jme3.bullet.collision.PhysicsCollisionObject,\
com.jme3.bullet.objects.PhysicsCharacter, \
com.jme3.bullet.objects.PhysicsGhostObject, \
com.jme3.bullet.objects.PhysicsRigidBody, \
com.jme3.bullet.objects.PhysicsVehicle, \
com.jme3.bullet.objects.VehicleWheel, \
com.jme3.bullet.objects.infos.RigidBodyMotionState, \
\
com.jme3.bullet.collision.shapes.CollisionShape, \
com.jme3.bullet.collision.shapes.BoxCollisionShape, \
com.jme3.bullet.collision.shapes.CapsuleCollisionShape, \
com.jme3.bullet.collision.shapes.CompoundCollisionShape, \
com.jme3.bullet.collision.shapes.ConeCollisionShape, \
com.jme3.bullet.collision.shapes.CylinderCollisionShape, \
com.jme3.bullet.collision.shapes.GImpactCollisionShape, \
com.jme3.bullet.collision.shapes.HeightfieldCollisionShape, \
com.jme3.bullet.collision.shapes.HullCollisionShape, \
com.jme3.bullet.collision.shapes.MeshCollisionShape, \
com.jme3.bullet.collision.shapes.PlaneCollisionShape, \
com.jme3.bullet.collision.shapes.SimplexCollisionShape, \
com.jme3.bullet.collision.shapes.SphereCollisionShape, \
\
com.jme3.bullet.joints.PhysicsJoint, \
com.jme3.bullet.joints.ConeJoint, \
com.jme3.bullet.joints.HingeJoint, \
com.jme3.bullet.joints.Point2PointJoint, \
com.jme3.bullet.joints.SixDofJoint, \
com.jme3.bullet.joints.SixDofSpringJoint, \
com.jme3.bullet.joints.SliderJoint, \
com.jme3.bullet.joints.motors.RotationalLimitMotor, \
com.jme3.bullet.joints.motors.TranslationalLimitMotor, \
\
com.jme3.bullet.util.NativeMeshUtil, \
com.jme3.bullet.util.DebugShapeFactory"
String projectClassPath = configurations.runtime.asFileTree.matching {
exclude ".gradle"
}.asPath
exec {
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
args '-d', destDirPath
args '-classpath', projectClassPath
args classes.split(",").collect { it.trim() }
}
}
}
task buildBulletNativeLib(type: Exec, dependsOn: generateNativeHeaders) {
task buildBulletNativeLib(type: Exec, dependsOn: [copyJmeAndroid, copyJmeCpp, copyBullet]) {
// args 'TARGET_PLATFORM=android-9'
// println "buildBulletNativeLib ndkWorkingPath: " + ndkWorkingPath
// println "buildBulletNativeLib rootProject.ndkCommandPath: " + rootProject.ndkCommandPath

@ -144,11 +144,27 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_setGravity
/*
* Class: com_jme3_bullet_PhysicsSpace
* Method: rayTest_native
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;JLjava/util/List;)V
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;JLjava/util/List;I)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native
(JNIEnv *, jobject, jobject, jobject, jlong, jobject, jint);
/*
* Class: com_jme3_bullet_PhysicsSpace
* Method: sweepTest_native
* Signature: (JLcom/jme3/math/Transform;Lcom/jme3/math/Transform;JLjava/util/List;F)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_sweepTest_1native
(JNIEnv *, jobject, jlong, jobject, jobject, jlong, jobject, jfloat);
/*
* Class: com_jme3_bullet_PhysicsSpace
* Method: setSolverNumIterations
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_setSolverNumIterations
(JNIEnv *, jobject, jlong, jint);
/*
* Class: com_jme3_bullet_PhysicsSpace
* Method: initNativePhysics
@ -165,23 +181,6 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_initNativePhysics
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_finalizeNative
(JNIEnv *, jobject, jlong);
/*
* Class: com_jme3_bullet_PhysicsSpace
* Method : sweepTest_native
* Signature: (J;L;Lcom/jme3/math/Transform;Lcom/jme3/math/Transform;L;JLjava/util/List;F)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_sweepTest_1native
(JNIEnv *, jobject, jlong, jobject, jobject, jlong, jobject, jfloat);
/*
* Class: com_jme3_bullet_PhysicsSpace
* Method: setSolverNumIterations
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_setSolverNumIterations
(JNIEnv *, jobject, jlong, jint);
#ifdef __cplusplus
}
#endif

@ -401,7 +401,6 @@ JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngula
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularFactor
(JNIEnv *, jobject, jlong, jobject);
/*
* Class: com_jme3_bullet_objects_PhysicsRigidBody
* Method: setAngularFactor

@ -15,3 +15,54 @@ dependencies {
compile project(':jme3-core')
compile project(':jme3-terrain')
}
task generateNativeHeaders(type: Exec, dependsOn: classes) {
def classes = " \
com.jme3.bullet.PhysicsSpace, \
\
com.jme3.bullet.collision.PhysicsCollisionEvent, \
com.jme3.bullet.collision.PhysicsCollisionObject,\
com.jme3.bullet.objects.PhysicsCharacter, \
com.jme3.bullet.objects.PhysicsGhostObject, \
com.jme3.bullet.objects.PhysicsRigidBody, \
com.jme3.bullet.objects.PhysicsVehicle, \
com.jme3.bullet.objects.VehicleWheel, \
com.jme3.bullet.objects.infos.RigidBodyMotionState, \
\
com.jme3.bullet.collision.shapes.CollisionShape, \
com.jme3.bullet.collision.shapes.BoxCollisionShape, \
com.jme3.bullet.collision.shapes.CapsuleCollisionShape, \
com.jme3.bullet.collision.shapes.CompoundCollisionShape, \
com.jme3.bullet.collision.shapes.ConeCollisionShape, \
com.jme3.bullet.collision.shapes.CylinderCollisionShape, \
com.jme3.bullet.collision.shapes.GImpactCollisionShape, \
com.jme3.bullet.collision.shapes.HeightfieldCollisionShape, \
com.jme3.bullet.collision.shapes.HullCollisionShape, \
com.jme3.bullet.collision.shapes.MeshCollisionShape, \
com.jme3.bullet.collision.shapes.PlaneCollisionShape, \
com.jme3.bullet.collision.shapes.SimplexCollisionShape, \
com.jme3.bullet.collision.shapes.SphereCollisionShape, \
\
com.jme3.bullet.joints.PhysicsJoint, \
com.jme3.bullet.joints.ConeJoint, \
com.jme3.bullet.joints.HingeJoint, \
com.jme3.bullet.joints.Point2PointJoint, \
com.jme3.bullet.joints.SixDofJoint, \
com.jme3.bullet.joints.SixDofSpringJoint, \
com.jme3.bullet.joints.SliderJoint, \
com.jme3.bullet.joints.motors.RotationalLimitMotor, \
com.jme3.bullet.joints.motors.TranslationalLimitMotor, \
\
com.jme3.bullet.util.NativeMeshUtil, \
com.jme3.bullet.util.DebugShapeFactory"
def classpath = sourceSets.main.runtimeClasspath.asPath
def nativeIncludes = new File(project(":jme3-bullet-native").projectDir, "src/native/cpp")
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
args "-d", nativeIncludes
args "-classpath", classpath
args classes.split(",").collect { it.trim() }
}
assemble.dependsOn(generateNativeHeaders)
Loading…
Cancel
Save