7월, 2014의 게시물 표시

HowTo compile native C codes to a library for iOS development in Xcode

이미지
HowTo compile native C codes to a library for iOS development in Xcode Posted on 2011/10/30 by allen For iOS development, sometimes you want to use a existed native C codes for help. Objective-C is a superset of C so it’s easy to combine C codes in your Objective-C project. But for a library usage, it only support compiling C code to a static library by now. In this tutorial, I take an open source project MQTT message broker Mosquitto as an example to demo how to compile it into a static library in Xcode. Environments * Xcode 4.1 * MacOSX Lion * mosquitto 0.13 Tutorial 1. Download mosquito form < http://mosquitto.org/files/source/mosquitto-0.13.tar.gz >. Here is the whole directory structure: 2. Create a new project by template C/C++ Library * Choose static type 3. Import(or just drap and drop) C codes(include .h and .c) to the project 4. Check the “Build settings” in project * “Base SDK” => Latest iOS * “Architecture

Creating iOS plugins for Unity

from  ← Introducing Rain’s Hack Upstate    Creating iOS plugins for Unity This is just a quick starter tutorial on making a simple iOS plugin for Unity. In your Unity project, create a folder Assets/Plugin/iOS. Files directly in that folder (can’t be in a subfolder) automatically get added to your iOS project when you have Unity create an iOS build. We’ll create a testplugin.mm file in that folder. In that file, we put the code for the iOS side of the plugin. Unity needs the plugins to be c named. So, we wrap it in an extern “C”. Here is an example plugin:        extern "C" { int _pow2 ( int x ) { // Just a simple example of returning an int value return x * x ; } // Returns a char* (a string to Unity) char * _helloWorldString () { // We can use NSString and go to the c string that Unity wants NSString * helloString = @ "Hello World" ; // UTF8String met

ffmpeg ios build

이미지
After a couple of days I have made step by step instructions for this install: FFmpeg Build Instructions MAC 10.8 or better Copy ffmpeg-2.0.tar.bz2 ( https://ffmpeg.org/releases/ffmpeg-1.0.7.tar.bz2 , https://ffmpeg.org/download.html ) and Unzip to Documents folder Make sure you have the latest Command Line Tools under Xcode >; Preferences >; Downloads >; Components Install gas-preprocessor Click on the ZIP icon to download https://github.com/mansr/gas-preprocessor . Copy gas-preprocessor.pl to /usr/bin directory. Change permission of gas-preprocessor.pl by setting the privilege to Read & Write for all. Bug in xcrun starting in version 10.8 open terminal and paste in following command and press enter: export DEVELOPER_DIR = "/Applications/Xcode.app/Contents/Developer/" cd to ffmpeg-2 folder and paste in following command and press enter: mkdir armv7 mkdir armv7s mkdir i386 mkdir - p universal / lib To config armv