Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AliSoftware committed Oct 2, 2013
2 parents 362f9fa + 02a906c commit becfc94
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
11 changes: 11 additions & 0 deletions OHAttributedLabel/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

default:
xcodebuild -target OHAttributedLabel -configuration Release -sdk iphonesimulator build
xcodebuild -target OHAttributedLabel -configuration Release -sdk iphoneos build
./scripts/combine-libs.sh build Release

clean:
-rm -rf build/*



2 changes: 2 additions & 0 deletions OHAttributedLabel/OHAttributedLabel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "i386 armv7 armv7s";
};
name = Debug;
};
Expand All @@ -320,6 +321,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "i386 armv7 armv7s";
};
name = Release;
};
Expand Down
29 changes: 29 additions & 0 deletions OHAttributedLabel/scripts/combine-libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
# thank you gabriel ttps://github.com/gabriel

LIB_NAME="libOHAttributedLabel.a"
BUILD_DIR="./$1"
CONFIGURATION="$2"
LIB_DIR="${BUILD_DIR}/${CONFIGURATION}-Combined"

if [ ! -d "${LIB_DIR}" ]; then
mkdir -p "${LIB_DIR}"
fi

# Combine lib files
lipo -create "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${LIB_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${LIB_NAME}" -output "${LIB_DIR}/${LIB_NAME}"
cp -r "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${LIB_DIR}"

# in lieu of a version number
VERSION_FILE="${LIB_DIR}/provenance.txt"
WHO=`whoami`
echo "who: ${WHO}" > "${VERSION_FILE}"
DATE=$( /bin/date +"%Y-%m-%d %H:%M:%S" )
echo "date: ${DATE}" >> "${VERSION_FILE}"
gitpath=`which git`
GITREV_SHORT=`$gitpath rev-parse --short HEAD`
GITREV_SHA=`$gitpath rev-parse HEAD`
echo "git rev (short): ${GITREV_SHORT}" >> "${VERSION_FILE}"
echo "git rev: ${GITREV_SHA}" >> "${VERSION_FILE}"

open "${LIB_DIR}"
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,27 @@ For example, your could implement this in your `application:didFinishLoadingWith
# How to use in your project
There are two possible methods to include these classes in your project:
There are three possible methods to include these classes in your project:
1. Using [Cocoapods](http://cocoapods.org):
* add `pod "OHAttributedLabel"` to your Podfile
2. Manually:
2. Include OHAttributedLabel in your project:
* Include the `OHAttributedLabel.xcodeproj` project in your Xcode4 workspace
* Build this `OHAttributedLabel.xcodeproj` project once for the "iOS Device" (not the simulator) _(1)_
* Add `libOHAttributedLabel.a` **and `CoreText.framework`** to your **"Link Binary With Libraries"** Build Phase of your app project.
* Select the `libOHAttributedLabel.a` that has just been added to your app project in your Project Navigator on the left, and change the "Location" dropdown in the File Inspector to **"Relative to Build Products"** _(1)_
* Add the **`-ObjC` flag in the "Other Linker Flags"** Build Setting (if not present already)
3. Add `libOHAttributedLabel.a` and headers in your project
* `cd OHAttributedLabel`
* `make clean && make` (nb. **rvm** users may need to ```CC= && make clean && make```)
* copy the contents of the `build/Release-Combined` directory to you project (eg. `ThirdParty/OHAttributedLabel`)
* Add `libOHAttributedLabel.a` **and `CoreText.framework`** to your **"Link Binary With Libraries"** Build Phase of your app project.
* Add the OHAttributedLabel headers to your **"Header Search Path"** in Build Settings (eg. `"$(SRCROOT)/ThirdParty/OHAttributedLabel/include/**"`)
* Add the **`-ObjC` flag in the "Other Linker Flags"** Build Setting (if not present already)
Then in your application code, when you want to make use of OHAttributedLabel methods, you only need to import the headers with `#import <OHAttributedLabel/OHAttributedLabel.h>` or `#import <OHAttributedLabel/NSAttributedString+Attributes.h>` etc.
> _(1) Note: These two steps are only necessary to avoid a bug in Xcode4 that would otherwise make Xcode fail to detect implicit dependencies between your app and the lib._
Expand Down

0 comments on commit becfc94

Please sign in to comment.