Fix missing bullet natives when running tests from within the engine project.
This commit is contained in:
parent
2c6161ecd8
commit
b571840bd0
@ -184,12 +184,19 @@ if(skipPrebuildLibraries!="true"&&buildNativeProjects!="true"){
|
|||||||
String srcRel=src.getAbsolutePath().substring((int)(nativesZipFile.length()+1));
|
String srcRel=src.getAbsolutePath().substring((int)(nativesZipFile.length()+1));
|
||||||
srcRel=srcRel.substring(srcRel.indexOf("/")+1);
|
srcRel=srcRel.substring(srcRel.indexOf("/")+1);
|
||||||
|
|
||||||
|
// TODO backward compatibility with old path, To be removed.
|
||||||
|
int j=srcRel.indexOf("/");
|
||||||
|
String p1=srcRel.substring(0,j);
|
||||||
|
String p2=srcRel.substring(j);
|
||||||
|
if(!p1.equals("android")&&!p2.startsWith("/native")) srcRel=p1+"/native"+p2;
|
||||||
|
//
|
||||||
|
|
||||||
File dest=new File(nativesPath+File.separator+srcRel);
|
File dest=new File(nativesPath+File.separator+srcRel);
|
||||||
|
|
||||||
boolean include=false;
|
boolean include=false;
|
||||||
if(!dest.exists()){
|
if(!dest.exists()){
|
||||||
include=true;
|
include=true;
|
||||||
println("Copy "+src+" "+dest+ ". Destination does not exist");
|
println("Copy "+src+" "+dest);
|
||||||
}else if(dest.lastModified()<src.lastModified()){
|
}else if(dest.lastModified()<src.lastModified()){
|
||||||
include=true;
|
include=true;
|
||||||
println("Copy "+src+" "+dest+ ". Source is newer. src "+src.lastModified()+ " dest "+dest.lastModified());
|
println("Copy "+src+" "+dest+ ". Source is newer. src "+src.lastModified()+ " dest "+dest.lastModified());
|
||||||
|
@ -2,6 +2,8 @@ apply plugin: 'cpp'
|
|||||||
|
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
|
||||||
|
def rootPath = rootProject.projectDir.absolutePath
|
||||||
|
|
||||||
String bulletSrcPath = bulletFolder + '/src'
|
String bulletSrcPath = bulletFolder + '/src'
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
@ -120,7 +122,6 @@ model {
|
|||||||
|
|
||||||
binaries {
|
binaries {
|
||||||
withType(SharedLibraryBinarySpec) {
|
withType(SharedLibraryBinarySpec) {
|
||||||
def rootPath = rootProject.projectDir.absolutePath
|
|
||||||
def javaHome = org.gradle.internal.jvm.Jvm.current().javaHome
|
def javaHome = org.gradle.internal.jvm.Jvm.current().javaHome
|
||||||
def os = targetPlatform.operatingSystem.name
|
def os = targetPlatform.operatingSystem.name
|
||||||
def arch = targetPlatform.architecture.name
|
def arch = targetPlatform.architecture.name
|
||||||
@ -130,30 +131,9 @@ model {
|
|||||||
arch = arch.replaceAll('-', '_')
|
arch = arch.replaceAll('-', '_')
|
||||||
|
|
||||||
// For all binaries that can't be built on the current system
|
// For all binaries that can't be built on the current system
|
||||||
if (buildNativeProjects != "true") {
|
if (buildNativeProjects != "true") buildable = false
|
||||||
buildable = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!buildable) {
|
|
||||||
if (sharedLibraryFile.exists()) {
|
|
||||||
// Add binary to jar file if the binary exists in the build folder already,
|
|
||||||
// e.g. when the build of jme3-bullet-native has been run on a virtual box
|
|
||||||
// and the project hasn't been cleaned yet.
|
|
||||||
jar.into("native/${os}/${arch}") {
|
|
||||||
from sharedLibraryFile
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Get from libs folder if no fresh build is available in the build folder and add to jar file
|
|
||||||
def precompiledFile = Paths.get(rootPath, 'build', 'native', 'bullet', os, arch, fileName).toFile()
|
|
||||||
if (precompiledFile.exists()) {
|
|
||||||
jar.into("native/${os}/${arch}") {
|
|
||||||
from precompiledFile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (buildable) {
|
||||||
cppCompiler.define('BT_NO_PROFILE')
|
cppCompiler.define('BT_NO_PROFILE')
|
||||||
if (toolChain in VisualCpp) {
|
if (toolChain in VisualCpp) {
|
||||||
cppCompiler.args "/I$javaHome\\include"
|
cppCompiler.args "/I$javaHome\\include"
|
||||||
@ -175,43 +155,33 @@ model {
|
|||||||
linker.args "-fvisibility=hidden"
|
linker.args "-fvisibility=hidden"
|
||||||
} else if (os == "windows") {
|
} else if (os == "windows") {
|
||||||
if (toolChain in Gcc) {
|
if (toolChain in Gcc) {
|
||||||
if (toolChain.name.startsWith('mingw')) {
|
if (toolChain.name.startsWith('mingw')) cppCompiler.args '-I', "$projectDir/src/native/cpp/fake_win32"
|
||||||
cppCompiler.args '-I', "$projectDir/src/native/cpp/fake_win32"
|
else cppCompiler.args '-I', "$javaHome/include/win32"
|
||||||
} else {
|
|
||||||
cppCompiler.args '-I', "$javaHome/include/win32"
|
|
||||||
}
|
|
||||||
cppCompiler.args "-fpermissive"
|
cppCompiler.args "-fpermissive"
|
||||||
cppCompiler.args "-static"
|
cppCompiler.args "-static"
|
||||||
cppCompiler.args "-O3"
|
cppCompiler.args "-O3"
|
||||||
cppCompiler.args "-U_FORTIFY_SOURCE"
|
cppCompiler.args "-U_FORTIFY_SOURCE"
|
||||||
linker.args "-static"
|
linker.args "-static"
|
||||||
linker.args "-Wl,--exclude-all-symbols"
|
linker.args "-Wl,--exclude-all-symbols"
|
||||||
}
|
} else if (toolChain in VisualCpp) {
|
||||||
else if (toolChain in VisualCpp) {
|
|
||||||
cppCompiler.args "/I$javaHome\\include\\win32"
|
cppCompiler.args "/I$javaHome\\include\\win32"
|
||||||
}
|
}
|
||||||
cppCompiler.define('WIN32')
|
cppCompiler.define('WIN32')
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.all {
|
tasks.all {
|
||||||
dependsOn unzipBulletIfNeeded
|
dependsOn unzipBulletIfNeeded
|
||||||
dependsOn ':jme3-bullet:compileJava'
|
dependsOn ':jme3-bullet:compileJava'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add output to jar file
|
|
||||||
jar.into("native/${os}/${arch}") {
|
|
||||||
from sharedLibraryFile
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add depend on build
|
|
||||||
jar.dependsOn tasks
|
|
||||||
// Add output to libs folder
|
|
||||||
task "copyBinaryToLibs${targetPlatform.name}"(type: Copy, dependsOn: tasks) {
|
task "copyBinaryToLibs${targetPlatform.name}"(type: Copy, dependsOn: tasks) {
|
||||||
from sharedLibraryFile
|
from sharedLibraryFile
|
||||||
into "${rootPath}/build/native/bullet/${os}/${arch}"
|
into "${rootPath}/build/native/bullet/native/${os}/${arch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add depend on copy
|
// Add depend on copy
|
||||||
jar.dependsOn("copyBinaryToLibs${targetPlatform.name}")
|
jar.dependsOn("copyBinaryToLibs${targetPlatform.name}")
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
withType(StaticLibraryBinarySpec) {
|
withType(StaticLibraryBinarySpec) {
|
||||||
buildable = false
|
buildable = false
|
||||||
@ -264,6 +234,9 @@ sourceSets {
|
|||||||
java {
|
java {
|
||||||
srcDir 'src/native/cpp'
|
srcDir 'src/native/cpp'
|
||||||
}
|
}
|
||||||
|
resources {
|
||||||
|
srcDir file(Paths.get(rootPath, 'build', 'native', 'bullet'))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user