From 3f19b593019a62d97c8739e38c32902d7e19d790 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Sun, 24 Sep 2017 19:59:28 +0200 Subject: iOS, static library. First attempt to prelink all LO libraries into 1 static library. With all libraries directly linking to the swift module, link time is about 12 minutes. Experiments let to be believe this can be reduced to 1-2 minutes by doing prelinking, which will solve all symbols between the libraries. Because work will continue on the swift module, while the LoKit is a pretty stable interface, this will save much developer time Change-Id: I69b63481fc657f2188476f53c5b4d49abe59c5f6 --- .../LibreOfficeKit.xcodeproj/project.pbxproj | 306 +++++++++++++++++++++ .../LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.h | 8 + .../LibreOfficeKit/LibreOfficeKit.mm | 59 ++++ .../LibreOfficeLight.xcodeproj/project.pbxproj | 6 +- 4 files changed, 377 insertions(+), 2 deletions(-) create mode 100644 ios/experimental/LibreOfficeKit/LibreOfficeKit.xcodeproj/project.pbxproj create mode 100644 ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.h create mode 100644 ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.mm diff --git a/ios/experimental/LibreOfficeKit/LibreOfficeKit.xcodeproj/project.pbxproj b/ios/experimental/LibreOfficeKit/LibreOfficeKit.xcodeproj/project.pbxproj new file mode 100644 index 000000000000..ccff1022393c --- /dev/null +++ b/ios/experimental/LibreOfficeKit/LibreOfficeKit.xcodeproj/project.pbxproj @@ -0,0 +1,306 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 39B5D21A1F78130F008FB162 /* LibreOfficeKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39B5D2191F78130F008FB162 /* LibreOfficeKit.mm */; }; + 39B5D21B1F78130F008FB162 /* LibreOfficeKit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 39B5D2181F78130F008FB162 /* LibreOfficeKit.h */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 39B5D2131F78130F008FB162 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + 39B5D21B1F78130F008FB162 /* LibreOfficeKit.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 3969A8CA1F7826EB006F06A9 /* lo.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = lo.xcconfig; path = ../../ioswork/ios/generated/lo.xcconfig; sourceTree = ""; }; + 39B5D2151F78130F008FB162 /* libLibreOfficeKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLibreOfficeKit.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 39B5D2181F78130F008FB162 /* LibreOfficeKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LibreOfficeKit.h; sourceTree = ""; }; + 39B5D2191F78130F008FB162 /* LibreOfficeKit.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LibreOfficeKit.mm; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 39B5D2121F78130F008FB162 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3969A8C91F782610006F06A9 /* Support files */ = { + isa = PBXGroup; + children = ( + 3969A8CA1F7826EB006F06A9 /* lo.xcconfig */, + ); + name = "Support files"; + sourceTree = ""; + }; + 39B5D20C1F78130F008FB162 = { + isa = PBXGroup; + children = ( + 39B5D2171F78130F008FB162 /* LibreOfficeKit */, + 39B5D2161F78130F008FB162 /* Products */, + 3969A8C91F782610006F06A9 /* Support files */, + ); + sourceTree = ""; + }; + 39B5D2161F78130F008FB162 /* Products */ = { + isa = PBXGroup; + children = ( + 39B5D2151F78130F008FB162 /* libLibreOfficeKit.a */, + ); + name = Products; + sourceTree = ""; + }; + 39B5D2171F78130F008FB162 /* LibreOfficeKit */ = { + isa = PBXGroup; + children = ( + 39B5D2181F78130F008FB162 /* LibreOfficeKit.h */, + 39B5D2191F78130F008FB162 /* LibreOfficeKit.mm */, + ); + path = LibreOfficeKit; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 39B5D2141F78130F008FB162 /* LibreOfficeKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 39B5D21E1F78130F008FB162 /* Build configuration list for PBXNativeTarget "LibreOfficeKit" */; + buildPhases = ( + 39B5D2111F78130F008FB162 /* Sources */, + 39B5D2121F78130F008FB162 /* Frameworks */, + 39B5D2131F78130F008FB162 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LibreOfficeKit; + productName = LibreOfficeKit; + productReference = 39B5D2151F78130F008FB162 /* libLibreOfficeKit.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 39B5D20D1F78130F008FB162 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = jani; + TargetAttributes = { + 39B5D2141F78130F008FB162 = { + CreatedOnToolsVersion = 8.3; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 39B5D2101F78130F008FB162 /* Build configuration list for PBXProject "LibreOfficeKit" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 39B5D20C1F78130F008FB162; + productRefGroup = 39B5D2161F78130F008FB162 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 39B5D2141F78130F008FB162 /* LibreOfficeKit */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 39B5D2111F78130F008FB162 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 39B5D21A1F78130F008FB162 /* LibreOfficeKit.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 39B5D21C1F78130F008FB162 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(LO_BUILDDIR)/config_host", + "$(LO_SRCDIR)/include", + "$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive", + "$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive", + "$(LO_WORKDIR)/UnpackedTarball/icu/source/common", + "$(LO_WORKDIR)/ios/generated", + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ( + "$(LINK_LDFLAGS)", + "-lstdc++", + ); + SDKROOT = iphoneos; + VALID_ARCHS = arm64; + }; + name = Debug; + }; + 39B5D21D1F78130F008FB162 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(LO_BUILDDIR)/config_host", + "$(LO_SRCDIR)/include", + "$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive", + "$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive", + "$(LO_WORKDIR)/UnpackedTarball/icu/source/common", + "$(LO_WORKDIR)/ios/generated", + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ( + "$(LINK_LDFLAGS)", + "-lstdc++", + ); + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = arm64; + "VALID_ARCHS[sdk=*]" = arm64; + }; + name = Release; + }; + 39B5D21F1F78130F008FB162 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 39B5D2201F78130F008FB162 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 39B5D2101F78130F008FB162 /* Build configuration list for PBXProject "LibreOfficeKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 39B5D21C1F78130F008FB162 /* Debug */, + 39B5D21D1F78130F008FB162 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 39B5D21E1F78130F008FB162 /* Build configuration list for PBXNativeTarget "LibreOfficeKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 39B5D21F1F78130F008FB162 /* Debug */, + 39B5D2201F78130F008FB162 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 39B5D20D1F78130F008FB162 /* Project object */; +} diff --git a/ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.h b/ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.h new file mode 100644 index 000000000000..3d4366495382 --- /dev/null +++ b/ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.h @@ -0,0 +1,8 @@ +// +// 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/. +// + diff --git a/ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.mm b/ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.mm new file mode 100644 index 000000000000..5c15360ae28b --- /dev/null +++ b/ios/experimental/LibreOfficeKit/LibreOfficeKit/LibreOfficeKit.mm @@ -0,0 +1,59 @@ +// +// 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 "LibreOfficeKit.h" + +#include +#include +#define LOK_USE_UNSTABLE_API +#include + +#include + +#include +#include + +// generated by solenv/bin/native-code.py: +#include "native-code.mm" + + +// Force reference to libreofficekit_hook +#ifdef LINK_LOKIT +extern "C" __attribute__((used)) void *libreofficekit_hook(const char *); +static __attribute__((used)) void *(*foop)(const char *) = libreofficekit_hook; + +// pointers to our instance +static LibreOfficeKit* kit; +static LibreOfficeKitDocument* document; +#endif + + + +// Bridge functions to LibreOfficeKit +extern "C" int BridgeLOkit_Init(const char *path) +{ +#ifdef LINK_LOKIT + char bufUserPath[200]; + strcpy(bufUserPath, path); + strcpy(bufUserPath + strlen(path), "/user"); + + // Initialize LibreOfficeKit + if (!kit) + kit = lok_init_2(path, bufUserPath); +#endif + return 0; +} + +int LOkit_open(char *file) +{ +#ifdef LINK_LOKIT + document = kit->pClass->documentLoad(kit, file); + document->pClass->initializeForRendering(document, ""); +#endif + return 0; +} + diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj b/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj index d485ec26b603..cecc1c8a1d15 100644 --- a/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj @@ -357,7 +357,8 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; - VALID_ARCHS = "$(ARCHS_STANDARD)"; + VALID_ARCHS = arm64; + "VALID_ARCHS[sdk=*]" = arm64; }; name = Debug; }; @@ -428,7 +429,8 @@ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; - VALID_ARCHS = "$(ARCHS_STANDARD)"; + VALID_ARCHS = arm64; + "VALID_ARCHS[sdk=*]" = arm64; }; name = Release; }; -- cgit