darwin: make it possible to compile for iOS

Relocate the include of TargetConditionals.h and fixe the use of
TARGET_OS_IPHONE. Furthermore, uv__fsevents_init() and uv__fsevents_close are
now empty functions for iOS, since the FSEvents API is not available there.
This commit is contained in:
Leonard Hecker 2012-10-25 17:48:17 +02:00 committed by Ben Noordhuis
parent 149b16f123
commit 97c527ac43
5 changed files with 20 additions and 10 deletions

View File

@ -26,6 +26,7 @@
# include <mach/mach.h>
# include <mach/task.h>
# include <mach/semaphore.h>
# include <TargetConditionals.h>
# define UV_PLATFORM_SEM_T semaphore_t
#endif

View File

@ -28,11 +28,7 @@
#include <ifaddrs.h>
#include <net/if.h>
#include <TargetConditionals.h>
#if !TARGET_OS_IPHONE
#include <CoreServices/CoreServices.h>
#endif
#include <CoreFoundation/CFRunLoop.h>
#include <mach/mach.h>
#include <mach/mach_time.h>

View File

@ -21,6 +21,21 @@
#include "uv.h"
#include "internal.h"
#if TARGET_OS_IPHONE
/* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */
int uv__fsevents_init(uv_fs_event_t* handle) {
return 0;
}
int uv__fsevents_close(uv_fs_event_t* handle) {
return 0;
}
#else /* TARGET_OS_IPHONE */
#include <assert.h>
#include <stdlib.h>
#include <CoreServices/CoreServices.h>
@ -278,3 +293,5 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
return 0;
}
#endif /* TARGET_OS_IPHONE */

View File

@ -62,7 +62,7 @@
# define HAVE_KQUEUE 1
#endif
#if defined(__APPLE__) && !defined(TARGET_OS_IPHONE)
#if defined(__APPLE__) && !TARGET_OS_IPHONE
# include <CoreServices/CoreServices.h>
#endif

View File

@ -33,10 +33,6 @@
#include <fcntl.h>
#include <poll.h>
#ifdef __APPLE__
# include <TargetConditionals.h>
#endif
#if defined(__APPLE__) && !TARGET_OS_IPHONE
# include <crt_externs.h>
# define environ (*_NSGetEnviron())