Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a target for build.sh to generate iOS framework #22

Merged
merged 2 commits into from
Feb 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ project.xcworkspace
examples/tutorial.d
examples/tutorial.o
examples/tutorial

# sh build.sh ios-framework
/Tightdb.framework
tightdb-ios.zip
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ can be tested via the Xcode project in:

test-iphone/

To ease the development using Xcode, you can generate a framework using
the command:

sh build.sh ios-framework

The framework is stored in the `tightdb-ios.zip` file.

Configuration
-------------
Expand Down
19 changes: 19 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,24 @@ EOF
exit 0
;;

"ios-framework")
if [ "$OS" != "Darwin" ]; then
echo "Framework for iOS can only be generated under Mac OS X"
exit 0
fi
FRAMEWORK=Tightdb.framework
rm -rf "$FRAMEWORK" Tightdb-ios.zip || exit 1
mkdir -p "$FRAMEWORK/Headers" || exit 1
cp iphone-lib/libtightdb-objc-ios.a "$FRAMEWORK/Tightdb" || exit 1
cp iphone-lib/include/tightdb/objc/*.h "$FRAMEWORK/Headers" || exit 1
(cd "$FRAMEWORK/Headers" && mv tightdb.h Tightdb.h) || exit 1
find "$FRAMEWORK/Headers" -name '*.h' -exec sed -i '' -e 's/import <tightdb\/objc\/\(.*\)>/import "\1"/g' {} \; || exit 1
find "$FRAMEWORK/Headers" -name '*.h' -exec sed -i '' -e 's/include <tightdb\/objc\/\(.*\)>/include "\1"/g' {} \; || exit 1
zip -r -q tightdb-ios.zip $FRAMEWORK || exit 1
echo "Framwork for iOS can be found in tightdb-ios.zip"
exit 0
;;

"test")
require_config || exit 1
$MAKE test-norun || exit 1
Expand Down Expand Up @@ -557,6 +575,7 @@ EOF
echo "Unspecified or bad mode '$MODE'" 1>&2
echo "Available modes are: config clean build build-iphone test test-debug test-gdb show-install install uninstall test-installed" 1>&2
echo "As well as: install-prod install-devel uninstall-prod uninstall-devel dist-copy" 1>&2
echo "As wall as: ios-framework"
exit 1
;;

Expand Down