cocos2d-x の static ライブラリを CocoaPod にする

# 環境

1. Mac OS X 10.11.5 (英語)
2. Xcode 7.3.1
3. Cocos2d-x 3.12
4. CocoaPods 1.0.0

# 方針

1. とりあえず OneDrive へアップロード
    1. Google Driver は 25MB を超えると出るウィルススキャンの警告ページを飛ばせない

# CocoaPod 作成手順

1. ヘッダーファイルとライブラリを cocos2d-x からコピー

		$ mkdir pod-cocos2d-x-kenichi-3.12.0
		$ cd pod-cocos2d-x-kenichi-3.12.0
		$ mkdir Headers
		$ (cd ../cocos2d-x-3.12/cocos; tar cf - `find . -name '*.h' -not -path '*/android/*'`) | (cd Headers; tar xzf -)
		$ (cd ../cocos2d-x-3.12/cocos; tar cf - `find . -name '*.inl'`) | (cd Headers; tar xzf -)
		$ (cd ../cocos2d-x-3.12/cocos/audio/include; tar cf - `find . -name '*.h' -not -path '*/android/*'`) | (cd Headers; tar xzf -)


		$ mkdir Libraries
		$ cp -p "../cocos2d-x-3.12/build/libcocos2d iOS.a" Libraries/libcocos2d-iOS.a

2. zip してアップロード

		$ cd ..
		$ tar cjf pod-cocos2d-x-kenichi-3.12.0.tar.bz2 pod-cocos2d-x-kenichi-3.12.0

3. podspec を作成してアップロード

		Pod::Spec.new do |s|
		  s.name         = "cocos2d-x-kenichi"
		  s.version      = "3.12.0"
		  s.summary      = "cocos2d-x prebuild libraries for armv7, armv7s, arm64, i386, x86_64"
		  s.author       = "Kenichi"
		  s.license      = "MIT"
		  s.homepage     = "https://1drv.ms/f/s!AtQVANcwd1Kfa4ReirIu1L6VHiQ"
		  s.platform     = :ios, "8.0"
		  s.source       = { :http => "https://onedrive.live.com/download?cid=9F527730D70015D4&resid=9F527730D70015D4%21110&authkey=AAH5SrDI3FrGlxM", :type => :tbz }
		  s.preserve_paths = "Headers/**/*.{h,inl}"
		  s.public_header_files = "Headers/**/*.{h,inl}"
		  s.header_mappings_dir = "Headers"
		  s.vendored_libraries = 'Libraries/libcocos2d-iOS.a' # CocoaPods-1.0.0 messes up OTHER_LDFLAGS in xcconfig if the path contains a space
		  s.frameworks = [ "AudioToolbox", "CoreMotion", "AVFoundation", "GameController", "MediaPlayer", "OpenAL" ] # AVFoundation, GameController, MediaPlayer, OpenAL are needed because CocoaPods adds -ObjC flag
		  s.libraries = [ "z", "iconv" ]
		  s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FILE32API CC_ENABLE_CHIPMUNK_INTEGRATION=1' } # TODO: COCOS2D_DEBUG=1 should also be added for Debug configuration
		end

  1. [cocos2d-x の static ライブラリをビルド](http://qiita.com/ken1ma/items/d1b39378e10df65fe10e)したものを使った
  2. ライブラリファイル名がスペースを含むと CocoaPods-1.0.0 は間違った xcconfig ファイルを生成してしまうので ```-``` に置換した
  3. source の :type を指定しないと ```Unsupported file type``` エラー

# CocoaPod 利用手順

1. Podfile を作成

		platform :ios, '8.0'
		use_frameworks!

		target 'ios-storyboard-cocos2dx' do
		  pod 'cocos2d-x-kenichi', :podspec => 'https://onedrive.live.com/download?cid=9F527730D70015D4&resid=9F527730D70015D4%21109&authkey=AAQFXJwi2CGgHO0'
		end

2. Pod をインストール

		$ pod install
		Analyzing dependencies
		Fetching podspec for `cocos2d-x-kenichi` from `https://onedrive.live.com/download?cid=9F527730D70015D4&resid=9F527730D70015D4%21109&authkey=AAQFXJwi2CGgHO0`
		Downloading dependencies
		Installing cocos2d-x-kenichi (3.12.0)
		Generating Pods project
		Integrating client project

		[!] Please close any current Xcode sessions and use `ios-storyboard-cocos2dx.xcworkspace` for this project from now on.
		Sending stats
		Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

3. おまけ: Podfile に以下を追加して Debug 時に COCOS2D_DEBUG=1 を定義したかったが、効かなかった

		post_install do |installer|
		  installer.pods_project.targets.each do |target|
		    target.build_configurations.each do |config|
			  config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['COCOS2D_DEBUG=1']
		    end
		  end
		end