Kaydet (Commit) 13eca862 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

More hacking on an iOS "Viewer" app that doesn't do much anything yet

The Viewer app is intended to eventually resemble the experimental
Android DocumentLoader app.

Build using the gbuild mechanism, which is also invoked from an Xcode
project. This seems to work out fine, the resulting app installs at
least on the simulator, and you can debug all the LO code involved
even if Xcode (obviously) has no knowledge of the LO source
files/classes/etc.

Change-Id: Ic96178d80b8d6467cac969b29e37f0d39513acf9
üst f6c44ad3
......@@ -287,6 +287,9 @@ endif
ifeq ($(OS),ANDROID)
cd android && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
endif
ifeq ($(OS),IOS)
cd ios && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
endif
build-nocheck : export SKIP_TESTS := YES
build-nocheck : build
......
......@@ -208,6 +208,14 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
))
endif
ifeq ($(OS),IOS)
$(eval $(call gb_Helper_register_executables,NONE,\
Viewer \
))
endif
ifeq ($(OS),MACOSX)
$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
......
......@@ -98,6 +98,7 @@ $(eval $(call gb_Module_add_moduledirs,ooo,\
idl \
$(call gb_Helper_optional,DESKTOP,idlc) \
io \
ios \
javaunohelper \
$(call gb_Helper_optional,JFREEREPORT,jfreereport) \
jurt \
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
$(eval $(call gb_CustomTarget_CustomTarget,ios/Viewer_app))
# We distinguish between builds for the simulator and device by
# looking for the "iarmv7" or "i386" in the -arch option that is part
# of $(CC)
ifneq ($(filter i386,$(CC)),)
xcode_sdk=iphonesimulator
xcode_arch=i386
else
xcode_sdk=iphoneos
xcode_arch=armv7
endif
ifeq ($(debug),)
xcode_config := Release
else
xcode_config := Debug
endif
# If run from Xcode, check that its configuration (device or
# simulator) matches that of gbuild. We detect being run from Xcode by
# looking for $(XCODE_VERSION_ACTUAL)
ifneq ($(XCODE_VERSION_ACTUAL),)
export CCACHE_CPP2=y
ifneq ($(CURRENT_ARCH),$(xcode_arch))
$(error Xcode platform (device or simulator) does not match that of this build tree)
endif
ifneq ($(CONFIGURATION),$(xcode_config))
$(error Xcode configuration (release or debug) does not match that of this build tree)
endif
endif
APP := Viewer
ios_Viewer_app_DIR := $(SRC_ROOT)/ios/experimental/Viewer/DerivedData/$(APP)/Build/Products/$(xcode_config)-$(xcode_sdk)/$(APP).app
ios_Viewer_app_EXE := $(ios_Viewer_app_DIR)/Viewer
$(call gb_CustomTarget_get_target,ios/Viewer_app) : $(ios_Viewer_app_EXE)
$(ios_Viewer_app_EXE): $(call gb_Executable_get_target,Viewer)
mkdir -p $(ios_Viewer_app_DIR)
cp $(call gb_Executable_get_target,Viewer) $(ios_Viewer_app_DIR)
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
$(eval $(call gb_Executable_Executable,Viewer))
$(eval $(call gb_Executable_use_api,Viewer,\
udkapi \
offapi \
))
$(eval $(call gb_Executable_use_externals,Viewer,\
iconv \
zlib \
))
$(eval $(call gb_Executable_set_include,Viewer,\
$$(INCLUDE) \
))
$(eval $(call gb_Executable_use_system_darwin_frameworks,Viewer,\
Foundation \
CoreFoundation \
CoreGraphics \
CoreText \
UIKit \
))
$(eval $(call gb_Executable_add_objcxxobjects,Viewer,\
ios/experimental/Viewer/Viewer/lo-viewer \
ios/experimental/Viewer/Viewer/LOViewerAppDelegate \
ios/experimental/Viewer/Viewer/main \
))
# vim: set ts=4 sw=4 et:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../solenv/gbuild/partial_build.mk
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
$(eval $(call gb_Module_Module,ios))
ifeq ($(OS),IOS)
$(eval $(call gb_Module_add_targets,ios,\
Executable_Viewer \
CustomTarget_Viewer_app \
))
endif
# vim: set noet sw=4 ts=4:
include ../../../config_host.mk
APP=LODocumentLoader
# If run from Xcode, check the CURRENT_ARCH env var for which platform we are
# building, device or simulator
ifneq (,$(filter i386,$(CC)))
PLATFORM=iphonesimulator
else
PLATFORM=iphoneos
endif
APPDIR=build/Debug-$(PLATFORM)/$(APP).app
# Stuff lifted from solenv/gbuild
COMMA := ,
gb_CPUDEFS := -DARM32
gb_CPUDEFS += -D$(CPUNAME)
gb_OSDEFS := \
-D$(OS) \
-D_PTHREADS \
-DUNIX \
-DUNX \
-D_REENTRANT \
-DNO_PTHREAD_PRIORITY \
$(EXTRA_CDEFS) \
gb_CPPU_ENV := gcc3
gb_COMPILERDEFS := \
-D$(COM) \
-DCPPU_ENV=$(gb_CPPU_ENV) \
gb_DEBUGLEVEL := 1
gb_GLOBALDEFS := \
-D_REENTRANT \
-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
-DSUPD=$(UPD) \
$(gb_OSDEFS) \
$(gb_COMPILERDEFS) \
$(gb_CPUDEFS) \
-DDISABLE_DYNLOADING \
gb_OBJC_OBJCXX_COMMON_FLAGS := -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -g
gb_OBJCFLAGS := -x objective-c $(gb_OBJC_OBJCXX_COMMON_FLAGS)
gb_OBJCXXFLAGS := -x objective-c++ $(gb_OBJC_OBJCXX_COMMON_FLAGS)
gb_Library__FRAMEWORKS := \
Foundation \
CoreFoundation \
CoreGraphics \
CoreText \
UIKit \
SRCS = docloader.mm
CFLAGS = $(SOLARINC)
MOREINCLUDES = -I$(OUTDIR)/inc/udkapi -I$(OUTDIR)/inc/offapi
LIBS = \
$(addprefix -Wl$(COMMA),$(wildcard $(OUTDIR)/lib/*.a)) \
$(addprefix -framework , $(gb_Library__FRAMEWORKS)) \
-lz \
-liconv
all: $(APPDIR)/$(APP) stuff
$(APPDIR)/$(APP): $(SRCS)
mkdir -p $(APPDIR)
$(CXX) -v -miphoneos-version-min=4.3 -fobjc-link-runtime -Wl,-map,$(APP).map.mangled -Wl,-dead_strip -o $@ $(gb_GLOBALDEFS) $(CFLAGS) $(gb_OBJCXXFLAGS) $(MOREINCLUDES) $(SRCS) $(LIBS)
c++filt <$(APP).map.mangled >$(APP).map && rm $(APP).map.mangled
stuff:
# inifile:
echo 'URE_BOOTSTRAP=$${ORIGIN}/fundamentalrc' >$(APPDIR)/rc
#
# URE_BOOTSTRAP file, fundamentalrc:
( \
echo '[Bootstrap]'; \
echo 'BRAND_BASE_DIR=$${ORIGIN}'; \
echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/registry module:$${BRAND_BASE_DIR}/registry/modules res:$${BRAND_BASE_DIR}/registry' \
) >$(APPDIR)/fundamentalrc
#
# An unorc is *mandatory*, sigh. We leave it empty except for the
# [Bootstrap} section header, though, and set all the stuff using
# -env: options in docloader.m. Whether that makes sense or not,
# no idea. The ideal would clearly be if *none* of the various rc
# files was mandatory, and the code would automatically use sane
# defaults. (Sane for the particular platform, that is.)
( \
echo '[Bootstrap]' \
) >$(APPDIR)/unorc
#
# hmm, once again, a hodgepodge of stuff, I don't really know which
# files of which are actually needed...
mkdir -p $(APPDIR)/registry/res
cp $(OUTDIR)/xml/*.xcd $(APPDIR)/registry
mv $(APPDIR)/registry/fcfg_langpack_en-US.xcd $(APPDIR)/registry/res
cp -R $(OUTDIR)/xml/registry/* $(APPDIR)/registry
#
# .rdb files
cp $(OUTDIR)/bin/udkapi.rdb $(OUTDIR)/bin/types.rdb $(OUTDIR)/xml/ure/services.rdb $(APPDIR)
mkdir -p $(APPDIR)/ure
cp $(OUTDIR)/bin/ure/types.rdb $(APPDIR)/ure
#
# a bunch of .component files
for F in framework/util/fwk i18npool/util/i18npool sfx2/util/sfx ucb/source/core/ucb1 ucb/source/ucp/file/ucpfile1 unoxml/source/service/unoxml configmgr/source/configmgr basic/util/sb chart2/source/controller/chartcontroller chart2/source/chartcore comphelper/util/comphelp eventattacher/source/evtatt fileaccess/source/fileacc filter/source/config/cache/filterconfig1 oox/util/oox package/source/xstor/xstor package/util/package2 sax/source/expatwrap/expwrap sax/source/fastparser/fastsax sc/util/sc sc/util/scfilt scaddins/source/analysis/analysis scaddins/source/datefunc/date sot/util/sot svl/util/svl toolkit/util/tk ucb/source/ucp/tdoc/ucptdoc1 unotools/util/utl unoxml/source/rdf/unordf; do \
mkdir -p $(APPDIR)/ComponentTarget/`dirname $$F`; \
cp $(WORKDIR)/ComponentTarget/$$F.component $(APPDIR)/ComponentTarget/$$F.component; \
done
#
# .res files
#
# $BRAND_BASE_DIR/program/resource hardcoded in
# ResMgrContainer::init() in tools/source/rc/resmgr.cxx, so let's use
# that.
mkdir -p $(APPDIR)/program/resource
for F in $(OUTDIR)/bin/*.res; do \
cp $$F $(APPDIR)/program/resource; \
done
#
# Test documents
cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt $(APPDIR)
clean:
rm -rf $(APPDIR)
.DS_Store
DerivedData
Viewer.xcodeproj/project.xcworkspace
Viewer.xcodeproj/xcuserdata
//
// LOViewerAppDelegate.h
// Viewer
//
// Created by Tor Lillqvist on 2012-11-27.
// Copyright (c) 2012 Tor Lillqvist. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LOViewerAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
#include <stdlib.h>
#import <UIKit/UIKit.h>
#import "LOViewerAppDelegate.h"
#include "lo-viewer.h"
@implementation LOViewerAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
(void) application;
(void) launchOptions;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
lo_initialize();
// Do something here
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
(void) application;
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
(void) application;
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
(void) application;
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
(void) application;
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
(void) application;
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
// vim:set shiftwidth=4 softtabstop=4 expandtab:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.libreoffice.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>CFBundleIconFile</key>
<string></string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon-72.png</string>
<string>Icon@2x.png</string>
</array>
</dict>
</plist>
//
// Prefix header for all source files of the 'Viewer' target in the 'Viewer' project
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
#ifndef LO_VIEWER_H
#define LO_VIEWER_H
void lo_initialize(void);
#endif // LO_VIEWER_H
// vim:set shiftwidth=4 softtabstop=4 expandtab:
/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
#include <stdlib.h>
......@@ -119,37 +119,9 @@ lo_get_libmap(void)
return map;
}
int
main(int argc, char ** argv)
void
lo_initialize(void)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"loAppDelegate");
[pool release];
return retVal;
}
@interface loAppDelegate : NSObject <UIApplicationDelegate> {
}
@property (nonatomic, retain) UIWindow *window;
@end
@implementation loAppDelegate
@synthesize window=_window;
- (BOOL)application: (UIApplication *) application
didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
{
int i;
(void) application;
(void) launchOptions;
UIWindow *uiw = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
uiw.backgroundColor = [UIColor redColor];
self.window = uiw;
[uiw release];
// See unotest/source/cpp/bootstrapfixturebase.cxx
const char *app_root = [[[NSBundle mainBundle] bundlePath] UTF8String];
setenv("SRC_ROOT", app_root, 1);
......@@ -158,15 +130,7 @@ didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
setenv("SAL_LOG", "yes", 1);
const char *argv[] = {
"lo-qa-sc-filters-test",
"dummy-testlib",
"--headless",
"--protector",
"dummy-libunoexceptionprotector",
"unoexceptionprotector",
"--protector",
"dummy-libunobootstrapprotector",
"unobootstrapprotector",
"Viewer",
"-env:URE_INTERNAL_LIB_DIR=file:///",
"placeholder-uno-types",
"placeholder-uno-services"
......@@ -227,7 +191,7 @@ didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
"ComponentTarget/ucb/source/ucp/file/ucpfile1.component"
};
for (i = 0; i < sizeof(services)/sizeof(services[0]); i++) {
for (unsigned i = 0; i < sizeof(services)/sizeof(services[0]); i++) {
uno_services = [uno_services stringByAppendingString: @"file://"];
uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: [NSString stringWithUTF8String: services[i]]]];
if (i < sizeof(services)/sizeof(services[0]) - 1)
......@@ -239,22 +203,17 @@ didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
osl_setCommandArgs(argc, (char **) argv);
try {
Reference< XComponentContext > xComponentContext(::cppu::defaultBootstrap_InitialComponentContext());
Reference< XMultiComponentFactory > xMultiComponentFactoryClient(
xComponentContext->getServiceManager() );
Reference< XMultiComponentFactory > xMultiComponentFactoryClient( xComponentContext->getServiceManager() );
Reference< XInterface > xInterface =
xMultiComponentFactoryClient->createInstanceWithContext(
OUString("com.sun.star.frame.Desktop"),
xMultiComponentFactoryClient->createInstanceWithContext( OUString("com.sun.star.frame.Desktop"),
xComponentContext );
// Do something here
[self.window makeKeyAndVisible];
return YES;
}
catch (Exception e) {
SAL_WARN("Viewer", e.Message);
}
}
@end
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
#import <UIKit/UIKit.h>
#import "LOViewerAppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([LOViewerAppDelegate class]));
}
}
// vim:set shiftwidth=4 softtabstop=4 expandtab:
ios ios :: packimages postprocess NULL
ios ios\prj nmake - all an_prj NULL
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment