Skip to content

Commit 19b45a0

Browse files
committed
Updated iOS documentation to use new directory.
1 parent aaf7f54 commit 19b45a0

File tree

4 files changed

+66
-34
lines changed

4 files changed

+66
-34
lines changed
File renamed without changes.

Build iOS/README.md renamed to Build_iOS/README.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ these libraries are Boost and OpenSSL.
99
This document will walk through the steps to build casablanca and its
1010
dependencies into a form suitable for use with iOS applications.
1111

12-
For this walkthrough, we assume you are working within the root directory of the
13-
casablanca project.
12+
For this walkthrough, we assume you are working within the 'Build_iOS'
13+
directory of the casablanca project.
1414

1515
$ git clone https://git01.codeplex.com/casablanca
16-
$ cd casablanca
16+
$ pushd casablanca/Build_iOS
1717

1818

1919
Building OpenSSL
@@ -22,16 +22,16 @@ Building OpenSSL
2222
To build OpenSSL, use the script provided by the OpenSSL-for-iPhone project.
2323

2424
$ git clone --depth=1 https://github.com/x2on/OpenSSL-for-iPhone.git
25-
$ cd OpenSSL-for-iPhone
25+
$ pushd OpenSSL-for-iPhone
2626
$ ./build-libssl.sh
27-
$ cd ..
27+
$ popd
2828

2929
After building the library, move the include files and libraries to
30-
`casablanca/openssl-include` and `casablanca/openssl-ios/lib` respectively.
30+
`Build iOS/openssl/include` and `Build iOS/openssl/lib` respectively.
3131

32-
$ mv OpenSSL-for-iPhone/include openssl-include
33-
$ mkdir openssl-ios
34-
$ mv OpenSSL-for-iPhone/lib openssl-ios/lib
32+
$ mkdir openssl
33+
$ mv OpenSSL-for-iPhone/include openssl
34+
$ mv OpenSSL-for-iPhone/lib openssl
3535

3636
This completes building OpenSSL.
3737

@@ -47,7 +47,7 @@ there are a few actively maintained forks. We recommend using the fork by Joseph
4747
Galbraith.
4848

4949
$ git clone https://git.gitorious.org/boostoniphone/galbraithjosephs-boostoniphone.git boostoniphone
50-
$ cd boostoniphone
50+
$ pushd boostoniphone
5151

5252
The script `boost.sh` provided by the boostoniphone project has a variable at
5353
the top of the file to specify which parts of boost need be compiled. This
@@ -59,14 +59,15 @@ signals, filesystem, regex, program_options, system.
5959

6060
The headers need to be moved to allow inclusion via `"boost/foo.h"`.
6161

62-
$ cd ios/framework/boost.framework/Versions/A
62+
$ pushd ios/framework/boost.framework/Versions/A
6363
$ mkdir Headers2
6464
$ mv Headers Headers2/boost
6565
$ mv Headers2 Headers
66+
$ popd
6667

6768
Finally, the product framework must be moved into place.
6869

69-
$ cd ..
70+
$ popd
7071
$ mv boostoniphone/ios/framework/boost.framework .
7172

7273
This completes building Boost.
@@ -81,9 +82,7 @@ Preparing the Casablanca build
8182
Casablanca uses CMake for cross-platform compatibility. To build on iOS, we
8283
specifically use the toolchain file provided by the ios-cmake project.
8384

84-
$ cd ios
85-
$ hg clone https://code.google.com/p/ios-cmake/
86-
$ cd ..
85+
$ hg clone https://code.google.com/p/ios-cmake/
8786

8887
This completes the preparation for building Casablanca.
8988

@@ -97,29 +96,32 @@ Building Casablanca
9796
Now we are ready to build Casablanca for iOS. Invoke the ios-buildscripts
9897
subproject in the usual CMake fashion:
9998

100-
$ cd ios
10199
$ mkdir build.ios
102-
$ cd build.ios
100+
$ pushd build.ios
103101
$ cmake .. -DCMAKE_BUILD_TYPE=Release
104102
$ make
105-
$ cd ..
106-
$ cd ..
103+
$ popd
107104

108-
This will take a while and produce appropriately lipo'd static libraries.
105+
This will take a while and produce universal static libraries inside
106+
the 'build.ios' directory.
109107

110108

111109
Using Casablanca
112110
----------------
113-
You will need to add/reference the following from your project:
111+
You will need to link against the following from your project:
114112

115-
* ios/build.ios/libcasablanca.a
113+
* build.ios/libcasablanca.a
116114
* boost.framework
117-
* openssl-include
118-
* openssl-ios/lib/libcrypto.a
119-
* openssl-ios/lib/libssl.a
120-
* Release/include
115+
* openssl/lib/libcrypto.a
116+
* openssl/lib/libssl.a
121117
* libiconv.dylib
122118

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+
123125
This should allow you to reference and use casablanca from your C++ and
124126
Objective-C++ source files. Note: you should change all .m files in your project
125127
to .mm files, because even if the source file itself does not use Casablanca, it

Build_iOS/configure.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
set -e
3+
4+
git clone --depth=1 https://github.com/x2on/OpenSSL-for-iPhone.git
5+
pushd OpenSSL-for-iPhone
6+
./build-libssl.sh
7+
popd
8+
mkdir openssl
9+
mv OpenSSL-for-iPhone/include openssl
10+
mv OpenSSL-for-iPhone/lib openssl
11+
git clone https://git.gitorious.org/boostoniphone/galbraithjosephs-boostoniphone.git boostoniphone
12+
pushd boostoniphone
13+
sed -e 's/\${BOOST_LIBS:=".*"}/\${BOOST_LIBS:="thread filesystem regex locale system"}/g' -i .bak boost.sh
14+
./boost.sh
15+
pushd ios/framework/boost.framework/Versions/A
16+
mkdir Headers2
17+
mv Headers Headers2/boost
18+
mv Headers2 Headers
19+
popd
20+
popd
21+
mv boostoniphone/ios/framework/boost.framework .
22+
hg clone https://code.google.com/p/ios-cmake/
23+
mkdir build.ios
24+
pushd build.ios
25+
cmake .. -DCMAKE_BUILD_TYPE=Release
26+
make
27+
popd
28+
echo "===="
29+
echo "The final library is available in 'build.ios/libcasablanca.a'"

Release/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@ set(WARNINGS)
88

99
# Platform (not compiler) specific settings
1010
if(IOS)
11-
set(Boost_FRAMEWORK "-F ${CMAKE_SOURCE_DIR}/.. -framework boost")
12-
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../boost.framework/Headers")
11+
set(IOS_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../Build_iOS")
12+
set(Boost_FRAMEWORK "-F ${IOS_SOURCE_DIR} -framework boost")
13+
set(Boost_INCLUDE_DIR "${IOS_SOURCE_DIR}/boost.framework/Headers")
1314

1415
set(OPENSSL_FOUND 1)
15-
set(OPENSSL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../openssl-include")
16+
set(OPENSSL_INCLUDE_DIR "${IOS_SOURCE_DIR}/openssl/include")
1617
set(OPENSSL_LIBRARIES
17-
"${CMAKE_SOURCE_DIR}/../openssl-ios/lib/libcrypto.a"
18-
"${CMAKE_SOURCE_DIR}/../openssl-ios/lib/libssl.a"
18+
"${IOS_SOURCE_DIR}/openssl/lib/libcrypto.a"
19+
"${IOS_SOURCE_DIR}/openssl/lib/libssl.a"
1920
)
2021

2122
# The cxx_flags must be set here, because the ios-cmake toolchain file unfortunately sets "-headerpad_max_install_names" which is not a valid clang flag.
2223
set(CMAKE_CXX_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
2324

2425
set(BUILD_SHARED_LIBS OFF)
25-
elseif(UNIX)
26+
elseif(UNIX) # This includes OSX
2627
find_package(Boost COMPONENTS system thread locale regex filesystem REQUIRED)
27-
find_package(Threads)
28+
find_package(Threads REQUIRED)
2829
find_package(OpenSSL REQUIRED)
2930

3031
option(BUILD_SHARED_LIBS "Build shared Libraries." ON)
@@ -48,7 +49,7 @@ if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") OR IOS)
4849
message("-- Setting clang options")
4950

5051
set(WARNINGS "-Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls")
51-
set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32")
52+
set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder")
5253
set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}")
5354

5455
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")

0 commit comments

Comments
 (0)