|
1 |
| -Instructions to use Casablanca on iOS |
2 |
| -===================================== |
| 1 | +Please consult the codeplex documentation for iOS compilation: |
3 | 2 |
|
4 |
| -Casablanca depends on Boost and OpenSSL when used on iOS. It is a non-trivial |
5 |
| -task to cross-compile libraries for iOS, however there are scripts available |
6 |
| -online with nonrestrictive licenses to compile many popular libraries -- among |
7 |
| -these libraries are Boost and OpenSSL. |
8 |
| - |
9 |
| -This document will walk through the steps to build casablanca and its |
10 |
| -dependencies into a form suitable for use with iOS applications. |
11 |
| - |
12 |
| -For this walkthrough, we assume you are working within the 'Build_iOS' |
13 |
| -directory of the casablanca project. |
14 |
| - |
15 |
| - $ git clone https://git01.codeplex.com/casablanca |
16 |
| - $ pushd casablanca/Build_iOS |
17 |
| - |
18 |
| - |
19 |
| -Building OpenSSL |
20 |
| ----------------- |
21 |
| - |
22 |
| -To build OpenSSL, use the script provided by the OpenSSL-for-iPhone project. |
23 |
| - |
24 |
| - $ git clone --depth=1 https://github.com/x2on/OpenSSL-for-iPhone.git |
25 |
| - $ pushd OpenSSL-for-iPhone |
26 |
| - $ ./build-libssl.sh |
27 |
| - $ popd |
28 |
| - |
29 |
| -After building the library, move the include files and libraries to |
30 |
| -`Build iOS/openssl/include` and `Build iOS/openssl/lib` respectively. |
31 |
| - |
32 |
| - $ mkdir openssl |
33 |
| - $ mv OpenSSL-for-iPhone/include openssl |
34 |
| - $ mv OpenSSL-for-iPhone/lib openssl |
35 |
| - |
36 |
| -This completes building OpenSSL. |
37 |
| - |
38 |
| -[project link](https://github.com/x2on/OpenSSL-for-iPhone) |
39 |
| - |
40 |
| - |
41 |
| -Building Boost |
42 |
| --------------- |
43 |
| - |
44 |
| -To build Boost, use the script provided by the boostoniphone project. The main |
45 |
| -project author seems to have not continued maintaining the project, however |
46 |
| -there are a few actively maintained forks. We recommend using the fork by Joseph |
47 |
| -Galbraith. |
48 |
| - |
49 |
| - $ git clone https://git.gitorious.org/boostoniphone/galbraithjosephs-boostoniphone.git boostoniphone |
50 |
| - $ pushd boostoniphone |
51 |
| - |
52 |
| -The script `boost.sh` provided by the boostoniphone project has a variable at |
53 |
| -the top of the file to specify which parts of boost need be compiled. This |
54 |
| -variable must be changed to include the parts needed for Casablanca: thread, |
55 |
| -signals, filesystem, regex, program_options, system. |
56 |
| - |
57 |
| - $ sed -e 's/\${BOOST_LIBS:=".*"}/\${BOOST_LIBS:="thread filesystem regex locale system"}/g' -i .bak boost.sh |
58 |
| - $ ./boost.sh |
59 |
| - |
60 |
| -The headers need to be moved to allow inclusion via `"boost/foo.h"`. |
61 |
| - |
62 |
| - $ pushd ios/framework/boost.framework/Versions/A |
63 |
| - $ mkdir Headers2 |
64 |
| - $ mv Headers Headers2/boost |
65 |
| - $ mv Headers2 Headers |
66 |
| - $ popd |
67 |
| - |
68 |
| -Finally, the product framework must be moved into place. |
69 |
| - |
70 |
| - $ popd |
71 |
| - $ mv boostoniphone/ios/framework/boost.framework . |
72 |
| - |
73 |
| -This completes building Boost. |
74 |
| - |
75 |
| -[project link](https://gitorious.org/boostoniphone) |
76 |
| -[fork link](https://gitorious.org/boostoniphone/galbraithjosephs-boostoniphone) |
77 |
| - |
78 |
| - |
79 |
| -Preparing the Casablanca build |
80 |
| ------------------------------- |
81 |
| - |
82 |
| -Casablanca uses CMake for cross-platform compatibility. To build on iOS, we |
83 |
| -specifically use the toolchain file provided by the ios-cmake project. |
84 |
| - |
85 |
| - $ hg clone https://code.google.com/p/ios-cmake/ |
86 |
| - |
87 |
| -This completes the preparation for building Casablanca. |
88 |
| - |
89 |
| -[project link](http://code.google.com/p/ios-cmake/) |
90 |
| -[source link](http://ios-cmake.googlecode.com/files/ios-cmake.tar.gz) |
91 |
| - |
92 |
| - |
93 |
| -Building Casablanca |
94 |
| -------------------- |
95 |
| - |
96 |
| -Now we are ready to build Casablanca for iOS. Invoke the ios-buildscripts |
97 |
| -subproject in the usual CMake fashion: |
98 |
| - |
99 |
| - $ mkdir build.ios |
100 |
| - $ pushd build.ios |
101 |
| - $ cmake .. -DCMAKE_BUILD_TYPE=Release |
102 |
| - $ make |
103 |
| - $ popd |
104 |
| - |
105 |
| -This will take a while and produce universal static libraries inside |
106 |
| -the 'build.ios' directory. |
107 |
| - |
108 |
| - |
109 |
| -Using Casablanca |
110 |
| ----------------- |
111 |
| -You will need to link against the following from your project: |
112 |
| - |
113 |
| - * build.ios/libcpprest.a |
114 |
| - * boost.framework |
115 |
| - * openssl/lib/libcrypto.a |
116 |
| - * openssl/lib/libssl.a |
117 |
| - * libiconv.dylib |
118 |
| - |
119 |
| -You will also need to add the following paths as additional include directories: |
120 |
| - |
121 |
| - * ../Release/include |
122 |
| - * boost.framework/Headers |
123 |
| - * openssl/include |
124 |
| - |
125 |
| -This should allow you to reference and use casablanca from your C++ and |
126 |
| -Objective-C++ source files. Note: you should change all .m files in your project |
127 |
| -to .mm files, because even if the source file itself does not use Casablanca, it |
128 |
| -is possible that some c++ code will be pulled in via header includes. To avoid |
129 |
| -trivial errors later, it is easiest to simply rename all your project sources to |
130 |
| -use '.mm'. |
| 3 | +[](https://casablanca.codeplex.com/wikipage?title=Setup%20and%20Build%20on%20IOS) |
0 commit comments