Xcodeで最初にprojectを作成した時defaultでは、Debugモードでのbuild設定のようだ。
これをReleaseモードに変更するのに3種類の方法がある。
hello_xcode3というprojectを作ってやってみる。
1)Main Menuより[project]->[Scheme]->[Edit Scheme...]
2)ショートカットキーで[Cmd]+[<]
[<]は[Shift]+[,]なので[Cmd]+[Shift]+[,]も同じ
3)下図の赤枠のところのproject名のところをクリックして[Edit Scheme...]を選択。
で、
のようなwindowが開くのでRunの項目のinfoタブを選択すると
一番上の項目にBuild Configurationという項目があるので
ここでDebugとReleaseを切り替える。
Build後のサイズを確認してみる。
Debugモード時
[hoge]$ pwd
xxxx/Debug
[hoge]$ ls -l
-rwxr-xr-x 1 xxxx xxxx - 18400 9 2 xx:xx hello_xcode3
Releaseモード時
[hoge]$ cd ../Release
[hoge]$ ls -l
-rwxr-xr-x 1 xxxx xxxx - 18480 9 2 xx:xx hello_xcode3
drwxr-xr-x 3 xxxx xxxx - 102 9 2 xx:xx hello_xcode3.dSYM
|
なんだか、Releaseモードの方がfile sizeが大きい。。。
Debugモードの方のDebug情報が他のところに保存されているってこと?
別途、調査だな。
XcodeのProjectとbuildで出力したfileを削除するには、
Xcoceを起動している状態で、まず削除したいProjectを閉じておく。
ここでは、hello_xcode4というProjectを削除してみる。
Main Menuから[Window]^>[Projects]でProjects Windowが開くので
hello_xcode4を選択。

右クリックで[Remove from Projects...]をを選択するか、もしくは
右側のFrameよりDerived Data...の[Delete]ボタンを押す。
[Remove]ボタンを押す。

これで、$HOME/Library//Developer/Xcode/DerivedData/以下にあるhello_xcode4のデータが
削除できた。
source file側は、FinderからかTerminal側からそのProjectのDirectoryごと削除すれば
XcodeのProjectの削除は完了する。
実行形式のファイルの出力先は、$HOME/Library//Developer/Xcode/DerivedData/以下にできる。
ここだと単体での動作確認がしにくい。で出力先を変えてみる。
例としてProject名:hello_xcode5というの作って確認してみる。
出力先を変えるには、
Main Menuより[Xcode]->[Prefernces...]

[Locations]タブを選択

Derived Data:の横のComboBoxからCustomを選択。
横のEditBoxの右端のFolderマークをクリックして出力したいDirectoryを選択。

BuildしてからProjectDirectoryを降りて行ってみて
command lineより実行してみる。
[hoge]$ cd ..../hello_xcode5
[hoge]$ ls -l
drwxr-xr-x@ 5 xxxx xxxx - 170 xx xx xx:xx ModuleCache
drwxr-xr-x 5 xxxx xxxx - 170 xx xx xx:xx hello_xcode5
drwxr-xr-x@ 6 xxxx xxxx - 204 xx xx xx:xx hello_xcode5-xxxxxxxxxxxxxxxxxxxxxxxxxxx
drwxr-xr-x 5 xxxx xxxx - 170 xx xx xx:xx hello_xcode5.xcodeproj
[hoge]$ cd ./hello_xcode5-xxxxxxxxxxxxxxxxxxxxxxxxxxx/Build/Products/Debug
[hoge]$ ls -l
-rwxr-xr-x 1 xxxx xxxx - 18432 xx xx xx:xx hello_xcode5
[hoge]$ ./hello_xcode5
Hello, World!
|