mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-16 15:01:15 +02:00
Merge pull request #3 from RangelReale/mobilefixes
Android and iOS fixes
This commit is contained in:
commit
6d2881ef34
@ -144,6 +144,11 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
|
|||||||
add_definitions( -D_BSD_SOURCE -library=stlport4)
|
add_definitions( -D_BSD_SOURCE -library=stlport4)
|
||||||
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
|
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)
|
IF (ENABLE_TESTS)
|
||||||
add_subdirectory(CppUnit)
|
add_subdirectory(CppUnit)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
@ -69,10 +69,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// compile-time shield against misalignment
|
// compile-time shield against misalignment
|
||||||
|
#ifndef POCO_ANDROID
|
||||||
poco_static_assert (offsetof(Header, code) == 0x01);
|
poco_static_assert (offsetof(Header, code) == 0x01);
|
||||||
poco_static_assert (offsetof(Header, checksum) == 0x02);
|
poco_static_assert (offsetof(Header, checksum) == 0x02);
|
||||||
poco_static_assert (offsetof(Header, id) == 0x04);
|
poco_static_assert (offsetof(Header, id) == 0x04);
|
||||||
poco_static_assert (offsetof(Header, seq) == 0x06);
|
poco_static_assert (offsetof(Header, seq) == 0x06);
|
||||||
|
#endif
|
||||||
|
|
||||||
enum MessageType
|
enum MessageType
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,16 @@
|
|||||||
#ifndef Net_SocketDefs_INCLUDED
|
#ifndef Net_SocketDefs_INCLUDED
|
||||||
#define 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)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#include "Poco/UnWindows.h"
|
#include "Poco/UnWindows.h"
|
||||||
|
@ -1276,7 +1276,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifndef POCO_ANDROID // Android doesn't have <ifaddrs.h>
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
|
#endif
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <net/if_arp.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)
|
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
||||||
{
|
{
|
||||||
struct sockaddr_ll* sdl = (struct sockaddr_ll*) iface->ifa_addr;
|
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));
|
impl.setType(fromNative(sdl->sll_hatype));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||||
{
|
{
|
||||||
|
#ifndef POCO_ANDROID
|
||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
Map result;
|
Map result;
|
||||||
unsigned ifIndex = 0;
|
unsigned ifIndex = 0;
|
||||||
@ -1420,6 +1427,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
if (ifaces) freeifaddrs(ifaces);
|
if (ifaces) freeifaddrs(ifaces);
|
||||||
|
|
||||||
return result;
|
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);
|
void handlePidFile(const std::string& name, const std::string& value);
|
||||||
bool isDaemon(int argc, char** argv);
|
bool isDaemon(int argc, char** argv);
|
||||||
void beDaemon();
|
void beDaemon();
|
||||||
|
#if defined(POCO_ANDROID)
|
||||||
|
static Poco::Event _terminate;
|
||||||
|
#endif
|
||||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
#if !defined(_WIN32_WCE)
|
#if !defined(_WIN32_WCE)
|
||||||
enum Action
|
enum Action
|
||||||
|
@ -84,7 +84,7 @@ SERVICE_STATUS ServerApplication::_serviceStatus;
|
|||||||
SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0;
|
SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(POCO_VXWORKS)
|
#if defined(POCO_VXWORKS) || defined(POCO_ANDROID)
|
||||||
Poco::Event ServerApplication::_terminate;
|
Poco::Event ServerApplication::_terminate;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ void ServerApplication::terminate()
|
|||||||
{
|
{
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
_terminate.set();
|
_terminate.set();
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS) || defined(POCO_ANDROID)
|
||||||
_terminate.set();
|
_terminate.set();
|
||||||
#else
|
#else
|
||||||
Poco::Process::requestTermination(Process::id());
|
Poco::Process::requestTermination(Process::id());
|
||||||
@ -590,6 +590,7 @@ void ServerApplication::defineOptions(OptionSet& options)
|
|||||||
//
|
//
|
||||||
void ServerApplication::waitForTerminationRequest()
|
void ServerApplication::waitForTerminationRequest()
|
||||||
{
|
{
|
||||||
|
#ifndef POCO_ANDROID
|
||||||
sigset_t sset;
|
sigset_t sset;
|
||||||
sigemptyset(&sset);
|
sigemptyset(&sset);
|
||||||
if (!std::getenv("POCO_ENABLE_DEBUGGER"))
|
if (!std::getenv("POCO_ENABLE_DEBUGGER"))
|
||||||
@ -601,6 +602,9 @@ void ServerApplication::waitForTerminationRequest()
|
|||||||
sigprocmask(SIG_BLOCK, &sset, NULL);
|
sigprocmask(SIG_BLOCK, &sset, NULL);
|
||||||
int sig;
|
int sig;
|
||||||
sigwait(&sset, &sig);
|
sigwait(&sset, &sig);
|
||||||
|
#else // POCO_ANDROID
|
||||||
|
_terminate.wait();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
73
build/config/OpenPandora
Normal file
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_OSNAME ?= $(IPHONE_SDK)
|
||||||
POCO_TARGET_OSARCH ?= armv6
|
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)
|
OSFLAGS ?= -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) -mthumb -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user