Archived

This forum has been archived. Please start a new discussion on GitHub.

Compile IceE under Android NDK

Who's supposed to, post the make files to compile under android:

Application.mk
APP_OPTIM := release
APP_PLATFORM := android-8
APP_STL := gnustl_static
APP_CPPFLAGS += -frtti -fexceptions
APP_ABI := armeabi
APP_MODULES := IceE

Android.mk
#
# Compile with support for the Ice router facility.
#
HAS_ROUTER				:= yes

#
# Compile with support for the Ice locator facility.
#
HAS_LOCATOR				:= no

#
# Compile with support for batch invocations.
#
HAS_BATCH				:= no

#
# Compile with support for wstring and string conversion.
#
HAS_WSTRING				:= no

#
# Compile with support for opaque endpoints.
#
HAS_OPAQUE_ENDPOINTS	:= no

#
# Compile with support for asynchronous method invocation (AMI).
#
HAS_AMI					:= no

#
# Default Mutex protocol: one of PrioNone or PrioInherit.
#
DEFAULT_MUTEX_PROTOCOL	:= PrioNone 

LOCAL_PATH := $(call my-dir)

SLICE_DIR := slice/IceE
$(shell $(LOCAL_PATH)/../cpp/bin/slice2cppe --ice -Islice --include-dir IceE --dll-export ICE_API --output-dir $(SLICE_DIR) $(SLICE_DIR)/*.ice)
$(shell rm -f $(SLICE_DIR)/*F.cpp)
$(shell mv $(SLICE_DIR)/*.h $(LOCAL_PATH)/../cppe/include/IceE)
$(shell mv $(SLICE_DIR)/*.cpp $(LOCAL_PATH)/../cppe/src/IceE)

$(shell $(LOCAL_PATH)/../cppe/config/features.sh $(LOCAL_PATH)/../cppe/include/IceE/Features.h \
		HAS_ROUTER=$(HAS_ROUTER) \
		HAS_LOCATOR=$(HAS_LOCATOR) \
		HAS_BATCH=$(HAS_BATCH) \
		HAS_WSTRING=$(HAS_WSTRING) \
		HAS_OPAQUE_ENDPOINTS=$(HAS_OPAQUE_ENDPOINTS) \
		HAS_AMI=$(HAS_AMI) \
		DEFAULT_MUTEX_PROTOCOL=$(DEFAULT_MUTEX_PROTOCOL))

include $(CLEAR_VARS)

GLOBAL_C_INCLUDES := $(LOCAL_PATH)/../cppe/include $(LOCAL_PATH)/../cppe/src $(LOCAL_PATH)/../cppe/src/TcpTransport

TRANSPORT_DIR	:= ../cppe/src/TcpTransport
ICE_DIR			:= ../cppe/src/IceE

TRANSPORT_SRCS	:= \
				$(TRANSPORT_DIR)/Acceptor.cpp \
				$(TRANSPORT_DIR)/Connector.cpp \
				$(TRANSPORT_DIR)/EndpointFactory.cpp \
				$(TRANSPORT_DIR)/TcpEndpoint.cpp \
				$(TRANSPORT_DIR)/Transceiver.cpp

ICE_SRCS		:= \
				$(ICE_DIR)/Base64.cpp \
				$(ICE_DIR)/BasicStream.cpp \
				$(ICE_DIR)/Buffer.cpp \
				$(ICE_DIR)/BuiltinSequences.cpp \
				$(ICE_DIR)/Communicator.cpp \
				$(ICE_DIR)/Cond.cpp \
				$(ICE_DIR)/ConnectionI.cpp \
				$(ICE_DIR)/ConnectRequestHandler.cpp \
				$(ICE_DIR)/RequestHandler.cpp \
				$(ICE_DIR)/ConvertUTF.cpp \
				$(ICE_DIR)/Current.cpp \
				$(ICE_DIR)/DefaultsAndOverrides.cpp \
				$(ICE_DIR)/DispatchInterceptor.cpp \
				$(ICE_DIR)/Endpoint.cpp \
				$(ICE_DIR)/EventHandler.cpp \
				$(ICE_DIR)/ExceptionBase.cpp \
				$(ICE_DIR)/FactoryTable.cpp \
				$(ICE_DIR)/FactoryTableDef.cpp \
				$(ICE_DIR)/Identity.cpp \
				$(ICE_DIR)/Incoming.cpp \
				$(ICE_DIR)/IncomingConnectionFactory.cpp \
				$(ICE_DIR)/Initialize.cpp \
				$(ICE_DIR)/Instance.cpp \
				$(ICE_DIR)/LocalException.cpp \
				$(ICE_DIR)/Locator.cpp \
				$(ICE_DIR)/LocatorInfo.cpp \
				$(ICE_DIR)/Logger.cpp \
				$(ICE_DIR)/LoggerI.cpp \
				$(ICE_DIR)/LoggerUtil.cpp \
				$(ICE_DIR)/MutexProtocol.cpp \
				$(ICE_DIR)/Network.cpp \
				$(ICE_DIR)/Object.cpp \
				$(ICE_DIR)/ObjectAdapter.cpp \
				$(ICE_DIR)/ObjectAdapterFactory.cpp \
				$(ICE_DIR)/ObjectFactoryManager.cpp \
				$(ICE_DIR)/ObjectFactoryManagerI.cpp \
				$(ICE_DIR)/OperationMode.cpp \
				$(ICE_DIR)/Outgoing.cpp \
				$(ICE_DIR)/OutgoingAsync.cpp \
				$(ICE_DIR)/OutgoingConnectionFactory.cpp \
				$(ICE_DIR)/Properties.cpp \
				$(ICE_DIR)/Protocol.cpp \
				$(ICE_DIR)/Proxy.cpp \
				$(ICE_DIR)/ProxyFactory.cpp \
				$(ICE_DIR)/Random.cpp \
				$(ICE_DIR)/RecMutex.cpp \
				$(ICE_DIR)/Reference.cpp \
				$(ICE_DIR)/ReferenceFactory.cpp \
				$(ICE_DIR)/RetryQueue.cpp \
				$(ICE_DIR)/Router.cpp \
				$(ICE_DIR)/RouterInfo.cpp \
				$(ICE_DIR)/SafeStdio.cpp \
				$(ICE_DIR)/SelectorThread.cpp \
				$(ICE_DIR)/ServantManager.cpp \
				$(ICE_DIR)/Shared.cpp \
				$(ICE_DIR)/StringConverter.cpp \
				$(ICE_DIR)/StringUtil.cpp \
				$(ICE_DIR)/Thread.cpp \
				$(ICE_DIR)/ThreadException.cpp \
				$(ICE_DIR)/ThreadPool.cpp \
				$(ICE_DIR)/Time.cpp \
				$(ICE_DIR)/Timer.cpp \
				$(ICE_DIR)/TraceLevels.cpp \
				$(ICE_DIR)/TraceUtil.cpp \
				$(ICE_DIR)/UnknownEndpoint.cpp \
				$(ICE_DIR)/Unicode.cpp \
				$(ICE_DIR)/UUID.cpp
				
LOCAL_SRC_FILES := $(TRANSPORT_SRCS) $(ICE_SRCS)

LOCAL_MODULE := IceE

GLOBAL_CFLAGS  := -DICE_API_EXPORTS -D_REENTRANT -DNDEBUG  \
		-DPAGE_SIZE=0x400 -ftemplate-depth-128 -Wall -Os \
		-fdata-sections -ffunction-sections -isystem $(SYSROOT)/usr/include/

LOCAL_CFLAGS := $(GLOBAL_CFLAGS)
LOCAL_C_INCLUDES := $(GLOBAL_C_INCLUDES)

include $(BUILD_STATIC_LIBRARY)

You must also modify Thread.cpp:

from:
            throw ThreadSyscallException(__FILE__, __LINE__, rc);
        }
        pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
    }
    rc = pthread_create(&_thread, &attr, startHook, this);

to:
            throw ThreadSyscallException(__FILE__, __LINE__, rc);
        }
#ifndef ANDROID
        pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
#endif
    }
    rc = pthread_create(&_thread, &attr, startHook, this);

All features work, except wstring support.

Comments

  • bernard
    bernard Jupiter, FL
    Hi Seva,

    Welcome to our forums, and thank you very much for sharing your port of Ice-E to Android NDK.

    Best regards,
    Bernard