Hi Antonio,

This is actually an interesting question and in looking into this I realised it 
doesn’t currently work properly with our current build configuration. For my 
own iOS app I actually still maintain a separate Xcode project file (for 
historical reasons). I’ve just gone through the process of trying to use a 
CMake-generated project file, and here’s what I had to do:

1. First create the Corinthia.xproject file by running CMake:

    mkdir ~/code/incubator-corinthia/build
    cd ~/code/incubator-corinthia/build
    cmake -G Xcode ..
    open Corinthia.xcodeproj

2. Once Xcode is open, there should be a yellow warning symbol shown near the 
center-top of the window. Click this, and then on the “Validate Project 
Settings” warning, and click “Perform Changes” (this apples the “automatically 
select architectures” setting). Say no if it subsequently asks you about 
snapshots.

3. In the view where it has the list containing the Corinthia project followed 
by all the targets (ALL_BUILD, ZERO_CHECK, DocFormats etc.), select the 
Corinthia project, and the “Build Settings” near the top of the window. Change 
Supported Platforms to “iOS”, and Base SDK to “Latest iOS (iOS 8.2)”. The 
architectures should be listed as “Standard architectures (armv7, arm64)”, at 
least if you have an iOS device plugged into your machine.

4. Delete the dftest, dfbuild, and dfutil targets. These are command-line tools 
which won’t work on iOS and will cause errors while compiling.

5. Go to Product -> Build

This should compile everything without errors.

Now, to use this library in your iOS app:

6. Close the Corinthia project window, and then open your app’s project file.

7. In the left-most pane, click on your app project, and then drag 
Corinthia.xcodeproj on top of it, so the blue line appears just underneath it. 
This will add it as a sub-project.

8. Under “Build Phases" for your app project, go to “Link Binary with 
Libraries”, click add, then “add other”,  browse to the 
incubator-corinthia/build/lib directory, and select libDocFormats.a. Then add 
libz.dylib, libxml2.dylib, and ImageIO.framework.

9. Under “Build Settings” for your app project, go to “Header Search Paths”, 
and add the following two absolute paths (adjusting for the location where you 
have the repository):

    /Users/peter/code/incubator-corinthia/DocFormats/headers
    /Users/peter/code/incubator-corinthia/DocFormats/api/headers

10. In the .m source file where you want to call the library API functions, add 
the following two lines:

    #import <DFPlatform.h>
    #import <DocFormats/DocFormats.h>

11. Now you should be able to make API calls like the following:

    DFGetFile("concrete.docx","abstract.html",NULL);

Summary: I realise this is a *lot* to do, and there’s plenty of opportunities 
to do the wrong option here. We need to make this a lot smoother, ideally 
supporting this use case in the CMake-generated project files (which presently 
cater for OS X but not iOS). This is actually the first time I’ve tried 
building the library on iOS without using my existing, separately-maintained 
project file, and in going through the process I’ve realised how complex it is 
in practice.

Let me know how you go with these instructions; if you get stuck I’ll try to 
help further.

—
Dr Peter M. Kelly
[email protected]

PGP key: http://www.kellypmk.net/pgp-key <http://www.kellypmk.net/pgp-key>
(fingerprint 5435 6718 59F0 DD1F BFA0 5E46 2523 BAA1 44AE 2966)

> On 19 Mar 2015, at 6:41 pm, António Soares <[email protected]> wrote:
> 
> Hi there,
> I'm a student doing master in Informatics engineer and I would like to
> implement a type of your DFConverter in my iOS app. After trying to compile
> your work with xcode on MACOSX 10.10 I finally had success compiling,
> before that it failed when I used the UNIX option because didn't found
> tree.h header.
> Now i'm trying to do a static library with a public header that i can use
> in my iOS project.
> 
> Is possible to get any kind of documentation or instruction how to do that?
> I had many problema compiling a static library or framework in the pass
> days.
> 
> Any help would be appreciated.
> 
> Thanks for your time,
> 
> António Soares

Reply via email to