Merge pull request #3 from RangelReale/mobilefixes

Android and iOS fixes
This commit is contained in:
Aleksandar Fabijanic 2012-12-02 20:28:22 -08:00
Родитель 49a0b4116e 8101b850dc
Коммит 6d2881ef34
8 изменённых файлов: 110 добавлений и 3 удалений

Просмотреть файл

@ -144,6 +144,11 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
add_definitions( -D_BSD_SOURCE -library=stlport4)
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
# iOS
if (IOS)
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES )
endif(IOS)
IF (ENABLE_TESTS)
add_subdirectory(CppUnit)
ENDIF ()

Просмотреть файл

@ -69,10 +69,12 @@ public:
};
// compile-time shield against misalignment
#ifndef POCO_ANDROID
poco_static_assert (offsetof(Header, code) == 0x01);
poco_static_assert (offsetof(Header, checksum) == 0x02);
poco_static_assert (offsetof(Header, id) == 0x04);
poco_static_assert (offsetof(Header, seq) == 0x06);
#endif
enum MessageType
{

Просмотреть файл

@ -39,6 +39,16 @@
#ifndef Net_SocketDefs_INCLUDED
#define Net_SocketDefs_INCLUDED
#ifndef __THROW
# ifndef __GNUC_PREREQ
# define __GNUC_PREREQ(maj, min) (0)
# endif
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
# else
# define __THROW
# endif
#endif
#if defined(POCO_OS_FAMILY_WINDOWS)
#include "Poco/UnWindows.h"

Просмотреть файл

@ -1276,7 +1276,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
#include <sys/types.h>
#ifndef POCO_ANDROID // Android doesn't have <ifaddrs.h>
#include <ifaddrs.h>
#endif
#include <linux/if.h>
#include <linux/if_packet.h>
#include <net/if_arp.h>
@ -1306,6 +1308,8 @@ static NetworkInterface::Type fromNative(unsigned arphrd)
}
}
#ifndef POCO_ANDROID
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
{
struct sockaddr_ll* sdl = (struct sockaddr_ll*) iface->ifa_addr;
@ -1317,11 +1321,14 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
impl.setType(fromNative(sdl->sll_hatype));
}
#endif
}
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
{
#ifndef POCO_ANDROID
FastMutex::ScopedLock lock(_mutex);
Map result;
unsigned ifIndex = 0;
@ -1420,6 +1427,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
if (ifaces) freeifaddrs(ifaces);
return result;
#else
throw Poco::NotImplementedException("Not implemented in Android");
#endif
}

Просмотреть файл

@ -196,6 +196,9 @@ private:
void handlePidFile(const std::string& name, const std::string& value);
bool isDaemon(int argc, char** argv);
void beDaemon();
#if defined(POCO_ANDROID)
static Poco::Event _terminate;
#endif
#elif defined(POCO_OS_FAMILY_WINDOWS)
#if !defined(_WIN32_WCE)
enum Action

Просмотреть файл

@ -84,7 +84,7 @@ SERVICE_STATUS ServerApplication::_serviceStatus;
SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0;
#endif
#endif
#if defined(POCO_VXWORKS)
#if defined(POCO_VXWORKS) || defined(POCO_ANDROID)
Poco::Event ServerApplication::_terminate;
#endif
@ -122,7 +122,7 @@ void ServerApplication::terminate()
{
#if defined(POCO_OS_FAMILY_WINDOWS)
_terminate.set();
#elif defined(POCO_VXWORKS)
#elif defined(POCO_VXWORKS) || defined(POCO_ANDROID)
_terminate.set();
#else
Poco::Process::requestTermination(Process::id());
@ -590,6 +590,7 @@ void ServerApplication::defineOptions(OptionSet& options)
//
void ServerApplication::waitForTerminationRequest()
{
#ifndef POCO_ANDROID
sigset_t sset;
sigemptyset(&sset);
if (!std::getenv("POCO_ENABLE_DEBUGGER"))
@ -601,6 +602,9 @@ void ServerApplication::waitForTerminationRequest()
sigprocmask(SIG_BLOCK, &sset, NULL);
int sig;
sigwait(&sset, &sig);
#else // POCO_ANDROID
_terminate.wait();
#endif
}

73
build/config/OpenPandora Normal file
Просмотреть файл

@ -0,0 +1,73 @@
#
# $Id: //poco/1.4/build/config/Angstrom#2 $
#
# Angstrom
#
# Make settings for Open Embedded/Angstrom
#
#
# General Settings
#
LINKMODE ?= SHARED
POCO_TARGET_OSNAME = Linux
POCO_TARGET_OSARCH = armv5te
TOOL = arm-none-linux-gnueabi
#
# Define Tools
#
CC = $(TOOL)-gcc
CXX = $(TOOL)-g++
LINK = $(CXX)
STRIP = $(TOOL)-strip
LIB = $(TOOL)-ar -cr
RANLIB = $(TOOL)-ranlib
SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -o $@
SHLIBLN = $(POCO_BASE)/build/script/shlibln
DEP = $(POCO_BASE)/build/script/makedepend.gcc
SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
#
# Extension for Shared Libraries
#
SHAREDLIBEXT = .so.$(target_version)
SHAREDLIBLINKEXT = .so
#
# Compiler and Linker Flags
#
CFLAGS = -Isrc
CFLAGS32 =
CFLAGS64 =
CXXFLAGS =
CXXFLAGS32 =
CXXFLAGS64 =
LINKFLAGS =
LINKFLAGS32 =
LINKFLAGS64 =
STATICOPT_CC =
STATICOPT_CXX =
STATICOPT_LINK = -static
SHAREDOPT_CC = -fPIC
SHAREDOPT_CXX = -fPIC
SHAREDOPT_LINK = -Wl,-rpath,$(LIBPATH)
DEBUGOPT_CC = -g -D_DEBUG
DEBUGOPT_CXX = -g -D_DEBUG
DEBUGOPT_LINK = -g
RELEASEOPT_CC = -O3 -DNDEBUG
RELEASEOPT_CXX = -O2 -DNDEBUG
RELEASEOPT_LINK = -O2
#
# System Specific Flags
#
SYSFLAGS = -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE -DPOCO_NO_FPENVIRONMENT
#
# System Specific Libraries
#
SYSLIBS = -lpthread -ldl -lrt

Просмотреть файл

@ -30,7 +30,7 @@ IPHONE_SDK_VERSION_MIN ?= $(patsubst %.sdk,%,$(patsubst $(IPHONE_SDK_ROOT_DIR)%,
POCO_TARGET_OSNAME ?= $(IPHONE_SDK)
POCO_TARGET_OSARCH ?= armv6
TOOL_PREFIX ?= /Developer/Platforms/$(IPHONE_SDK).platform/Developer/usr/bin
TOOL_PREFIX ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/usr/bin
OSFLAGS ?= -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) -mthumb -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN)
#