DroidFish: Made stockfish engine work in android 5.

This commit is contained in:
Peter Osterlund 2015-01-07 20:42:18 +00:00
parent 36f62e3eb4
commit 3e6a483df3
3 changed files with 28 additions and 12 deletions

View File

@ -3,10 +3,14 @@
<target name="copy_stockfish">
<copy file="${basedir}/libs/arm64-v8a/stockfish" tofile="${basedir}/assets/stockfish-arm64-v8a"/>
<copy file="${basedir}/libs/armeabi/stockfish" tofile="${basedir}/assets/stockfish-armeabi"/>
<copy file="${basedir}/libs/armeabi/stockfish-nopie" tofile="${basedir}/assets/stockfish-armeabi-nopie"/>
<copy file="${basedir}/libs/armeabi-v7a/stockfish" tofile="${basedir}/assets/stockfish-armeabi-v7a"/>
<copy file="${basedir}/libs/armeabi-v7a/stockfish-nopie" tofile="${basedir}/assets/stockfish-armeabi-v7a-nopie"/>
<copy file="${basedir}/libs/mips/stockfish" tofile="${basedir}/assets/stockfish-mips"/>
<copy file="${basedir}/libs/mips/stockfish-nopie" tofile="${basedir}/assets/stockfish-mips-nopie"/>
<copy file="${basedir}/libs/mips64/stockfish" tofile="${basedir}/assets/stockfish-mips64"/>
<copy file="${basedir}/libs/x86/stockfish" tofile="${basedir}/assets/stockfish-x86"/>
<copy file="${basedir}/libs/x86/stockfish-nopie" tofile="${basedir}/assets/stockfish-x86-nopie"/>
<copy file="${basedir}/libs/x86_64/stockfish" tofile="${basedir}/assets/stockfish-x86_64"/>
</target>
</project>

View File

@ -1,13 +1,19 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := stockfish
LOCAL_SRC_FILES := \
SF_SRC_FILES := \
benchmark.cpp main.cpp movegen.cpp pawns.cpp thread.cpp uci.cpp \
bitbase.cpp endgame.cpp material.cpp movepick.cpp position.cpp timeman.cpp ucioption.cpp \
bitboard.cpp evaluate.cpp misc.cpp notation.cpp search.cpp tt.cpp tbprobe.cpp
include $(CLEAR_VARS)
LOCAL_MODULE := stockfish-nopie
LOCAL_SRC_FILES := $(SF_SRC_FILES)
LOCAL_CFLAGS := -std=c++11 -O2
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := stockfish
LOCAL_SRC_FILES := $(SF_SRC_FILES)
LOCAL_CFLAGS := -std=c++11 -O2 -fPIE
LOCAL_LDFLAGS += -FPIE -pie
include $(BUILD_EXECUTABLE)

View File

@ -39,14 +39,20 @@ public class EngineUtil {
/** Return file name of the internal stockfish executable. */
public static String internalStockFishName() {
String abi = Build.CPU_ABI;
if (!abi.equals("x86") &&
!abi.equals("x86_64") &&
!abi.equals("armeabi-v7a") &&
!abi.equals("arm64-v8a") &&
!abi.equals("mips") &&
!abi.equals("mips64"))
boolean noPIE = Build.VERSION.SDK_INT < 21;
if (abi.equals("x86")) {
} else if (abi.equals("x86_64")) {
noPIE = false;
} else if (abi.equals("armeabi-v7a")) {
} else if (abi.equals("arm64-v8a")) {
noPIE = false;
} else if (abi.equals("mips")) {
} else if (abi.equals("mips64")) {
noPIE = false;
} else {
abi = "armeabi"; // Unknown ABI, assume original ARM
return "stockfish-" + abi;
}
return "stockfish-" + abi + (noPIE ? "-nopie" : "");
}
/** Return true if file "engine" is a network engine. */