Support 2 core separately
This commit is contained in:
parent
fc48116faa
commit
be36c30d2e
3 changed files with 32 additions and 93 deletions
|
@ -92,7 +92,4 @@ public class Version {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOldCoreVersion(ClientContext ctx) {
|
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+oldCore");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
SCRIPT_LOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
SCRIPT_LOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
NAME=$(basename $(dirname "${BASH_SOURCE[0]}") )
|
NAME=$(basename $(dirname "${BASH_SOURCE[0]}") )
|
||||||
|
|
||||||
"$SCRIPT_LOC/../../core/externals/configure.sh"
|
|
||||||
SRCLOC="$SCRIPT_LOC/../../core/externals/qtbase-android"
|
|
||||||
|
|
||||||
if [ ! -d "$ANDROID_SDK" ]; then
|
if [ ! -d "$ANDROID_SDK" ]; then
|
||||||
echo "ANDROID_SDK is not set"
|
echo "ANDROID_SDK is not set"
|
||||||
exit
|
exit
|
||||||
|
@ -23,68 +20,6 @@ if [ -z "$OSMAND_X86_ONLY" ] && [ -z "$OSMAND_ARM_ONLY" ] && [ -z "$OSMAND_ARMv5
|
||||||
echo "BUILD_ALL set to true"
|
echo "BUILD_ALL set to true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
QTBASE_CONFIGURATION=\
|
"$SCRIPT_LOC/../../core/android-configure.sh"
|
||||||
"-opensource -confirm-license -xplatform android-g++ "\
|
|
||||||
"-nomake examples -nomake demos -nomake tests -nomake docs "\
|
|
||||||
"-qt-sql-sqlite "\
|
|
||||||
"-no-gui -no-widgets -no-opengl -no-accessibility -no-linuxfb -no-directfb -no-eglfs -no-xcb -no-qml-debug -no-javascript-jit "\
|
|
||||||
"-c++11 -shared -release "\
|
|
||||||
"-v"
|
|
||||||
|
|
||||||
if [ -n "$BUILD_ALL" ] || [ -n "$OSMAND_ARM_ONLY" ] || [ -n "$OSMAND_ARMv5_ONLY" ]; then
|
|
||||||
if [ ! -d "$SRCLOC/upstream.patched.armeabi" ]; then
|
|
||||||
cp -rf "$SRCLOC/upstream.patched" "$SRCLOC/upstream.patched.armeabi"
|
|
||||||
export ANDROID_TARGET_ARCH=armeabi
|
|
||||||
export ANDROID_NDK_PLATFORM=android-8
|
|
||||||
(cd "$SRCLOC/upstream.patched.armeabi" && \
|
|
||||||
./configure $QTBASE_CONFIGURATION \
|
|
||||||
-no-neon)
|
|
||||||
fi
|
|
||||||
(cd "$SRCLOC/upstream.patched.armeabi" && make -j`nproc`)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$BUILD_ALL" ] || [ -n "$OSMAND_ARM_ONLY" ] || [ -n "$OSMAND_ARMv7a_ONLY" ]; then
|
|
||||||
if [ ! -d "$SRCLOC/upstream.patched.armeabi-v7a" ]; then
|
|
||||||
cp -rf "$SRCLOC/upstream.patched" "$SRCLOC/upstream.patched.armeabi-v7a"
|
|
||||||
export ANDROID_TARGET_ARCH=armeabi-v7a
|
|
||||||
export ANDROID_NDK_PLATFORM=android-8
|
|
||||||
(cd "$SRCLOC/upstream.patched.armeabi-v7a" && \
|
|
||||||
./configure $QTBASE_CONFIGURATION \
|
|
||||||
-no-neon)
|
|
||||||
fi
|
|
||||||
(cd "$SRCLOC/upstream.patched.armeabi-v7a" && make -j`nproc`)
|
|
||||||
|
|
||||||
if [ ! -d "$SRCLOC/upstream.patched.armeabi-v7a-neon" ]; then
|
|
||||||
cp -rf "$SRCLOC/upstream.patched" "$SRCLOC/upstream.patched.armeabi-v7a-neon"
|
|
||||||
export ANDROID_TARGET_ARCH=armeabi-v7a
|
|
||||||
export ANDROID_NDK_PLATFORM=android-8
|
|
||||||
(cd "$SRCLOC/upstream.patched.armeabi-v7a-neon" && \
|
|
||||||
./configure $QTBASE_CONFIGURATION \
|
|
||||||
-qtlibinfix _neon)
|
|
||||||
fi
|
|
||||||
(cd "$SRCLOC/upstream.patched.armeabi-v7a-neon" && make -j`nproc`)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$BUILD_ALL" ] || [ -n "$OSMAND_X86_ONLY" ]; then
|
|
||||||
if [ ! -d "$SRCLOC/upstream.patched.x86" ]; then
|
|
||||||
cp -rf "$SRCLOC/upstream.patched" "$SRCLOC/upstream.patched.x86"
|
|
||||||
export ANDROID_TARGET_ARCH=x86
|
|
||||||
export ANDROID_NDK_PLATFORM=android-9
|
|
||||||
(cd "$SRCLOC/upstream.patched.x86" && \
|
|
||||||
./configure $QTBASE_CONFIGURATION)
|
|
||||||
fi
|
|
||||||
(cd "$SRCLOC/upstream.patched.x86" && make -j`nproc`)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$BUILD_ALL" ] || [ -n "$OSMAND_MIPS_ONLY" ]; then
|
|
||||||
if [ ! -d "$SRCLOC/upstream.patched.mips" ]; then
|
|
||||||
cp -rf "$SRCLOC/upstream.patched" "$SRCLOC/upstream.patched.mips"
|
|
||||||
export ANDROID_TARGET_ARCH=mips
|
|
||||||
export ANDROID_NDK_PLATFORM=android-9
|
|
||||||
(cd "$SRCLOC/upstream.patched.mips" && \
|
|
||||||
./configure $QTBASE_CONFIGURATION)
|
|
||||||
fi
|
|
||||||
(cd "$SRCLOC/upstream.patched.mips" && make -j`nproc`)
|
|
||||||
fi
|
|
||||||
|
|
||||||
(cd "$SCRIPT_LOC" && "$ANDROID_NDK/ndk-build" -j`nproc`)
|
(cd "$SCRIPT_LOC" && "$ANDROID_NDK/ndk-build" -j`nproc`)
|
|
@ -4,7 +4,6 @@ package net.osmand.plus.render;
|
||||||
import net.osmand.NativeLibrary;
|
import net.osmand.NativeLibrary;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.ClientContext;
|
import net.osmand.plus.ClientContext;
|
||||||
import net.osmand.plus.Version;
|
|
||||||
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
||||||
import net.osmand.render.RenderingRuleSearchRequest;
|
import net.osmand.render.RenderingRuleSearchRequest;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
@ -29,25 +28,48 @@ public class NativeOsmandLibrary extends NativeLibrary {
|
||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
synchronized (NativeOsmandLibrary.class) {
|
synchronized (NativeOsmandLibrary.class) {
|
||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
|
isNativeSupported = false;
|
||||||
try {
|
try {
|
||||||
log.debug("Loading native gnustl_shared..."); //$NON-NLS-1$
|
log.debug("Loading native gnustl_shared..."); //$NON-NLS-1$
|
||||||
System.loadLibrary("gnustl_shared");
|
System.loadLibrary("gnustl_shared");
|
||||||
log.debug("Loading native cpufeatures_proxy..."); //$NON-NLS-1$
|
log.debug("Loading native cpufeatures_proxy..."); //$NON-NLS-1$
|
||||||
System.loadLibrary("cpufeatures_proxy");
|
System.loadLibrary("cpufeatures_proxy");
|
||||||
/*(if (PlatformUtil.AVIAN_LIBRARY) {
|
|
||||||
log.debug("Loading load routing test..."); //$NON-NLS-1$
|
|
||||||
System.loadLibrary("routing_test");
|
|
||||||
testRoutingPing();
|
|
||||||
}*/
|
|
||||||
if(android.os.Build.VERSION.SDK_INT >= 8) {
|
if(android.os.Build.VERSION.SDK_INT >= 8) {
|
||||||
log.debug("Loading jnigraphics, since Android >= 2.2 ..."); //$NON-NLS-1$
|
log.debug("Loading jnigraphics, since Android >= 2.2 ..."); //$NON-NLS-1$
|
||||||
System.loadLibrary("jnigraphics");
|
System.loadLibrary("jnigraphics");
|
||||||
}
|
}
|
||||||
final String libCpuSuffix = cpuHasNeonSupport() ? "_neon" : "";
|
final String libCpuSuffix = cpuHasNeonSupport() ? "_neon" : "";
|
||||||
log.debug("Loading native libraries..."); //$NON-NLS-1$
|
log.debug("Loading native libraries..."); //$NON-NLS-1$
|
||||||
if(Version.isOldCoreVersion(ctx)) {
|
try {
|
||||||
|
loadNewCore(libCpuSuffix);
|
||||||
|
log.debug("Creating NativeOsmandLibrary instance..."); //$NON-NLS-1$
|
||||||
|
library = new NativeOsmandLibrary();
|
||||||
|
isNativeSupported = true;
|
||||||
|
} catch(Throwable e) {
|
||||||
|
log.error("Failed to load new native library", e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if(!isNativeSupported) {
|
||||||
|
loadOldCore(libCpuSuffix);
|
||||||
|
log.debug("Creating NativeOsmandLibrary instance..."); //$NON-NLS-1$
|
||||||
|
library = new NativeOsmandLibrary();
|
||||||
|
log.debug("Initializing rendering rules storage..."); //$NON-NLS-1$
|
||||||
|
NativeOsmandLibrary.initRenderingRulesStorage(storage);
|
||||||
|
isNativeSupported = true;
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.error("Failed to load native library", e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return library;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void loadOldCore(final String libCpuSuffix) {
|
||||||
System.loadLibrary("osmand" + libCpuSuffix);
|
System.loadLibrary("osmand" + libCpuSuffix);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
private static void loadNewCore(final String libCpuSuffix) {
|
||||||
System.loadLibrary("Qt5Core" + libCpuSuffix);
|
System.loadLibrary("Qt5Core" + libCpuSuffix);
|
||||||
System.loadLibrary("Qt5Network" + libCpuSuffix);
|
System.loadLibrary("Qt5Network" + libCpuSuffix);
|
||||||
System.loadLibrary("Qt5Concurrent" + libCpuSuffix);
|
System.loadLibrary("Qt5Concurrent" + libCpuSuffix);
|
||||||
|
@ -57,21 +79,6 @@ public class NativeOsmandLibrary extends NativeLibrary {
|
||||||
System.loadLibrary("OsmAndCoreUtils" + libCpuSuffix);
|
System.loadLibrary("OsmAndCoreUtils" + libCpuSuffix);
|
||||||
System.loadLibrary("OsmAndJNI" + libCpuSuffix);
|
System.loadLibrary("OsmAndJNI" + libCpuSuffix);
|
||||||
}
|
}
|
||||||
log.debug("Creating NativeOsmandLibrary instance..."); //$NON-NLS-1$
|
|
||||||
library = new NativeOsmandLibrary();
|
|
||||||
log.debug("Initializing rendering rules storage..."); //$NON-NLS-1$
|
|
||||||
NativeOsmandLibrary.initRenderingRulesStorage(storage);
|
|
||||||
isNativeSupported = true;
|
|
||||||
log.debug("Native library loaded successfully"); //$NON-NLS-1$
|
|
||||||
} catch (Throwable e) {
|
|
||||||
log.error("Failed to load native library", e); //$NON-NLS-1$
|
|
||||||
isNativeSupported = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return library;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isSupported()
|
public static boolean isSupported()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue