mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
switch to clang
add option, and invoke it, to build jni code with clang rather than gcc.
This commit is contained in:
parent
a710bdd46e
commit
abf4aa4d80
11 changed files with 52 additions and 28 deletions
|
@ -92,10 +92,11 @@ LOCAL_LDLIBS := -L${SYSROOT}/usr/lib -llog -lz
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
ifneq ($(shell which ccache),)
|
# This recipe doesn't work with clang. Fix if using gcc again
|
||||||
TARGET_CC = ccache $(TOOLCHAIN_PREFIX)gcc
|
# ifneq ($(shell which ccache),)
|
||||||
TARGET_CXX = ccache $(TOOLCHAIN_PREFIX)g++
|
# TARGET_CC = ccache $(TOOLCHAIN_PREFIX)gcc
|
||||||
endif
|
# TARGET_CXX = ccache $(TOOLCHAIN_PREFIX)g++
|
||||||
|
# endif
|
||||||
|
|
||||||
COMMON_SRC_FILES :=
|
COMMON_SRC_FILES :=
|
||||||
COMMON_PATH :=
|
COMMON_PATH :=
|
||||||
|
|
|
@ -104,13 +104,13 @@ andCountSpecials( AndDictionaryCtxt* ctxt )
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
andMakeBitmap( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
andMakeBitmap( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
const XP_U8 const* end, XP_Bitmap* result )
|
const XP_U8* end, XP_Bitmap* result )
|
||||||
{
|
{
|
||||||
XP_Bool success = XP_TRUE;
|
XP_Bool success = XP_TRUE;
|
||||||
XP_U8 const* ptr = *ptrp;
|
XP_U8 const* ptr = *ptrp;
|
||||||
|
jobject bitmap = NULL;
|
||||||
CHECK_PTR( ptr, 1, end );
|
CHECK_PTR( ptr, 1, end );
|
||||||
XP_U8 nCols = *ptr++;
|
XP_U8 nCols = *ptr++;
|
||||||
jobject bitmap = NULL;
|
|
||||||
if ( nCols > 0 ) {
|
if ( nCols > 0 ) {
|
||||||
CHECK_PTR( ptr, 1, end );
|
CHECK_PTR( ptr, 1, end );
|
||||||
XP_U8 nRows = *ptr++;
|
XP_U8 nRows = *ptr++;
|
||||||
|
@ -157,7 +157,7 @@ andMakeBitmap( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
andLoadSpecialData( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
andLoadSpecialData( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
const XP_U8 const* end )
|
const XP_U8* end )
|
||||||
{
|
{
|
||||||
XP_Bool success = XP_TRUE;
|
XP_Bool success = XP_TRUE;
|
||||||
XP_U16 nSpecials = andCountSpecials( ctxt );
|
XP_U16 nSpecials = andCountSpecials( ctxt );
|
||||||
|
@ -305,7 +305,7 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
|
||||||
{
|
{
|
||||||
XP_Bool success = XP_TRUE;
|
XP_Bool success = XP_TRUE;
|
||||||
XP_ASSERT( !!ptr );
|
XP_ASSERT( !!ptr );
|
||||||
const XP_U8 const* end = ptr + dictLength;
|
const XP_U8* end = ptr + dictLength;
|
||||||
XP_U32 offset;
|
XP_U32 offset;
|
||||||
XP_U16 nFaces, numFaceBytes = 0;
|
XP_U16 nFaces, numFaceBytes = 0;
|
||||||
XP_U16 flags;
|
XP_U16 flags;
|
||||||
|
|
|
@ -502,7 +502,7 @@ and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
static void
|
static void
|
||||||
and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg, XP_S16 from )
|
and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR* msg, XP_S16 from )
|
||||||
{
|
{
|
||||||
UTIL_CBK_HEADER( "showChat", "(Ljava/lang/String;ILjava/lang/String;)V" );
|
UTIL_CBK_HEADER( "showChat", "(Ljava/lang/String;ILjava/lang/String;)V" );
|
||||||
jstring jname = NULL;
|
jstring jname = NULL;
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
<arg value="./local.properties" />
|
<arg value="./local.properties" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec dir="." executable="../scripts/ndksetup.sh" output="/dev/null"
|
<exec dir="." executable="../scripts/ndksetup.sh" output="/dev/null"
|
||||||
failonerror="true" >
|
failonerror="true" >
|
||||||
<arg value="${build.target}"/>
|
<arg value="--with-clang"/>
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec dir="." executable="../scripts/ndksetup.sh" output="/dev/null"
|
<exec dir="." executable="../scripts/ndksetup.sh" output="/dev/null"
|
||||||
failonerror="true">
|
failonerror="true" >
|
||||||
<arg value="${build.target}"/>
|
<arg value="--with-clang"/>
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec dir="." executable="../scripts/ndkbuild.sh" failonerror="true">
|
<exec dir="." executable="../scripts/ndkbuild.sh" failonerror="true">
|
||||||
|
|
|
@ -2,13 +2,34 @@
|
||||||
|
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
|
USE_CLANG=''
|
||||||
|
|
||||||
APPMK=./jni/Application.mk
|
APPMK=./jni/Application.mk
|
||||||
TMP_MK=/tmp/tmp_$$_Application.mk
|
TMP_MK=/tmp/tmp_$$_Application.mk
|
||||||
XWORDS_DEBUG_ARMONLY=${XWORDS_DEBUG_ARMONLY:-""}
|
XWORDS_DEBUG_ARMONLY=${XWORDS_DEBUG_ARMONLY:-""}
|
||||||
XWORDS_DEBUG_X86ONLY=${XWORDS_DEBUG_X86ONLYx:-""}
|
XWORDS_DEBUG_X86ONLY=${XWORDS_DEBUG_X86ONLYx:-""}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "usage $0 [--with-clang]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case $1 in
|
||||||
|
--with-clang)
|
||||||
|
USE_CLANG=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage "Unexpected param $1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
echo "# Generated by $0; do not edit!!!" > $TMP_MK
|
echo "# Generated by $0; do not edit!!!" > $TMP_MK
|
||||||
|
|
||||||
|
[ -n "$USE_CLANG" ] && echo "NDK_TOOLCHAIN_VERSION := clang" >> $TMP_MK
|
||||||
|
|
||||||
if [ -n "$XWORDS_DEBUG_ARMONLY" ]; then
|
if [ -n "$XWORDS_DEBUG_ARMONLY" ]; then
|
||||||
echo "APP_ABI := armeabi" >> $TMP_MK
|
echo "APP_ABI := armeabi" >> $TMP_MK
|
||||||
elif [ -n "$XWORDS_DEBUG_X86ONLY" ]; then
|
elif [ -n "$XWORDS_DEBUG_X86ONLY" ]; then
|
||||||
|
@ -24,7 +45,7 @@ fi
|
||||||
|
|
||||||
if [ ! -f $APPMK ]; then
|
if [ ! -f $APPMK ]; then
|
||||||
cp $TMP_MK $APPMK
|
cp $TMP_MK $APPMK
|
||||||
elif ! diff $APPMK $TMP_MK; then
|
elif ! diff -q $APPMK $TMP_MK >/dev/null; then
|
||||||
cp $TMP_MK $APPMK
|
cp $TMP_MK $APPMK
|
||||||
fi
|
fi
|
||||||
rm -f $TMP_MK
|
rm -f $TMP_MK
|
||||||
|
|
|
@ -835,7 +835,7 @@ board_canHint( const BoardCtxt* board )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
board_sendChat( const BoardCtxt* board, const XP_UCHAR const* msg )
|
board_sendChat( const BoardCtxt* board, const XP_UCHAR* msg )
|
||||||
{
|
{
|
||||||
server_sendChat( board->server, msg, board->selPlayer );
|
server_sendChat( board->server, msg, board->selPlayer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ XP_Bool board_canHideRack( const BoardCtxt* board );
|
||||||
XP_Bool board_canTrade( BoardCtxt* board );
|
XP_Bool board_canTrade( BoardCtxt* board );
|
||||||
XP_Bool board_canTogglePending( const BoardCtxt* board );
|
XP_Bool board_canTogglePending( const BoardCtxt* board );
|
||||||
XP_Bool board_canHint( const BoardCtxt* board );
|
XP_Bool board_canHint( const BoardCtxt* board );
|
||||||
void board_sendChat( const BoardCtxt* board, const XP_UCHAR const* msg );
|
void board_sendChat( const BoardCtxt* board, const XP_UCHAR* msg );
|
||||||
|
|
||||||
/* zoomBy: >0: zoom in; < 0: zoom out; 0: query only */
|
/* zoomBy: >0: zoom in; < 0: zoom out; 0: query only */
|
||||||
XP_Bool board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canInOut );
|
XP_Bool board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canInOut );
|
||||||
|
|
|
@ -514,9 +514,8 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
engine->searchHorizontal = XP_FALSE;
|
engine->searchHorizontal = XP_FALSE;
|
||||||
}
|
}
|
||||||
} /* forever */
|
} /* forever */
|
||||||
outer:
|
|
||||||
result = result; /* c++ wants a statement after the label */
|
|
||||||
}
|
}
|
||||||
|
outer:
|
||||||
/* Search is finished. Choose (or just return) the best move found. */
|
/* Search is finished. Choose (or just return) the best move found. */
|
||||||
if ( engine->returnNOW ) {
|
if ( engine->returnNOW ) {
|
||||||
result = XP_FALSE;
|
result = XP_FALSE;
|
||||||
|
|
|
@ -784,11 +784,15 @@ wordScoreFormatterAddTile( WordScoreFormatter* fmtr, Tile tile,
|
||||||
}
|
}
|
||||||
|
|
||||||
fullBufPtr = fmtr->fullBuf + fmtr->bufLen;
|
fullBufPtr = fmtr->fullBuf + fmtr->bufLen;
|
||||||
fmtr->bufLen +=
|
XP_U16 len = sizeof(fmtr->fullBuf) - fmtr->bufLen;
|
||||||
XP_SNPRINTF( fullBufPtr,
|
if ( tileMultiplier > 1 ) {
|
||||||
(XP_U16)(sizeof(fmtr->fullBuf) - fmtr->bufLen),
|
fmtr->bufLen += XP_SNPRINTF( fullBufPtr, len,
|
||||||
(XP_UCHAR*)(tileMultiplier > 1?"%s(%dx%d)":"%s%d"),
|
"%s(%dx%d)", prefix, tileScore,
|
||||||
prefix, tileScore, tileMultiplier );
|
tileMultiplier );
|
||||||
|
} else {
|
||||||
|
fmtr->bufLen += XP_SNPRINTF( fullBufPtr, len,
|
||||||
|
"%s%d", prefix, tileScore );
|
||||||
|
}
|
||||||
|
|
||||||
XP_ASSERT( XP_STRLEN(fmtr->fullBuf) == fmtr->bufLen );
|
XP_ASSERT( XP_STRLEN(fmtr->fullBuf) == fmtr->bufLen );
|
||||||
XP_ASSERT( fmtr->bufLen < sizeof(fmtr->fullBuf) );
|
XP_ASSERT( fmtr->bufLen < sizeof(fmtr->fullBuf) );
|
||||||
|
|
|
@ -636,7 +636,7 @@ server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
static void
|
static void
|
||||||
sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR const* msg,
|
sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR* msg,
|
||||||
XP_S8 from )
|
XP_S8 from )
|
||||||
{
|
{
|
||||||
if ( comms_canChat( server->vol.comms ) ) {
|
if ( comms_canChat( server->vol.comms ) ) {
|
||||||
|
@ -652,7 +652,7 @@ sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR const* msg,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sendChatToClientsExcept( ServerCtxt* server, XP_U16 skip,
|
sendChatToClientsExcept( ServerCtxt* server, XP_U16 skip,
|
||||||
const XP_UCHAR const* msg, XP_S8 from )
|
const XP_UCHAR* msg, XP_S8 from )
|
||||||
{
|
{
|
||||||
XP_U16 devIndex;
|
XP_U16 devIndex;
|
||||||
for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) {
|
for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) {
|
||||||
|
@ -663,7 +663,7 @@ sendChatToClientsExcept( ServerCtxt* server, XP_U16 skip,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg, XP_S16 from )
|
server_sendChat( ServerCtxt* server, const XP_UCHAR* msg, XP_S16 from )
|
||||||
{
|
{
|
||||||
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
|
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
|
||||||
sendChatTo( server, SERVER_DEVICE, msg, from );
|
sendChatTo( server, SERVER_DEVICE, msg, from );
|
||||||
|
|
|
@ -122,8 +122,7 @@ XP_Bool server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
void server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg,
|
void server_sendChat( ServerCtxt* server, const XP_UCHAR* msg, XP_S16 from );
|
||||||
XP_S16 from );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
|
void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
|
||||||
|
|
Loading…
Reference in a new issue