summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
Diffstat (limited to 'sal')
-rw-r--r--sal/cppunittester/makefile.mk4
-rw-r--r--sal/inc/sal/main.h57
-rw-r--r--sal/osl/unx/salinit.cxx1
3 files changed, 61 insertions, 1 deletions
diff --git a/sal/cppunittester/makefile.mk b/sal/cppunittester/makefile.mk
index 938b63d90ae9..7c43bab6b743 100644
--- a/sal/cppunittester/makefile.mk
+++ b/sal/cppunittester/makefile.mk
@@ -35,6 +35,10 @@ ENABLE_EXCEPTIONS = TRUE
CFLAGSCXX += $(CPPUNIT_CFLAGS)
+.IF "$(OS)" == "IOS"
+CFLAGSCXX += -x objective-c++ -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300
+.ENDIF
+
OBJFILES = $(APP1OBJS)
APP1OBJS = $(OBJ)/cppunittester.obj
diff --git a/sal/inc/sal/main.h b/sal/inc/sal/main.h
index 536bf328a43a..0415d04ac0ea 100644
--- a/sal/inc/sal/main.h
+++ b/sal/inc/sal/main.h
@@ -41,6 +41,60 @@ extern "C" {
void SAL_CALL sal_detail_initialize(int argc, char ** argv);
void SAL_CALL sal_detail_deinitialize();
+#ifdef IOS
+
+#include <premac.h>
+#import <UIKit/UIKit.h>
+#include <postmac.h>
+
+static int sal_argc;
+static char **sal_argv;
+
+#define SAL_MAIN_WITH_ARGS_IMPL \
+int SAL_CALL main(int argc, char ** argv) \
+{ \
+ sal_argc = argc; \
+ sal_argv = argv; \
+ sal_detail_initialize(argc, argv); \
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \
+ int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"salAppDelegate"); \
+ \
+ [pool release]; \
+ \
+ sal_detail_deinitialize(); \
+ return retVal; \
+}
+
+#define SAL_MAIN_IMPL \
+SAL_MAIN_WITH_ARGS_IMPL \
+ \
+int \
+sal_main_with_args(int argc, char ** argv) \
+{ \
+ return sal_main(); \
+}
+
+@interface salAppDelegate : NSObject <UIApplicationDelegate> {
+}
+@end
+
+int sal_main_with_args(int argc, char **argv);
+
+@implementation salAppDelegate
+
+- (BOOL)application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
+{
+ UIWindow *uiw = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ uiw.backgroundColor = [UIColor redColor];
+ [uiw release];
+
+ sal_main_with_args(sal_argc, sal_argv);
+}
+
+@end
+
+#else
+
#define SAL_MAIN_WITH_ARGS_IMPL \
int SAL_CALL main(int argc, char ** argv) \
{ \
@@ -61,6 +115,9 @@ int SAL_CALL main(int argc, char ** argv) \
return ret; \
}
+#endif
+
+
/* Definition macros for CRT entries */
#ifdef SAL_W32
diff --git a/sal/osl/unx/salinit.cxx b/sal/osl/unx/salinit.cxx
index 1ed1363500e9..e62bdab890eb 100644
--- a/sal/osl/unx/salinit.cxx
+++ b/sal/osl/unx/salinit.cxx
@@ -30,7 +30,6 @@
#include "sal/config.h"
#include "osl/process.h"
-#include "sal/main.h"
#include "sal/types.h"
extern "C" {