UbuntuでGNUstepのアプリケーション開発
UbuntuでObjective-c。しかもGUIのアプリケーションを作る方法の備忘録。
Ubuntuのバージョンは8.04。
とりあえず必要なパッケージをapt-getでインストール。
GUIが動くまでに必要なパッケージは最後に一覧で書いてます。
パッケージをインストールした後は環境構築のために
/usr/share/GNUstep/Makefiles/GNUstep.h
を実行(一旦そこのディレクトリに行かないとだめかな)しておく。
ウィンドウを開くサンプルソース
とりあえずソースファイルはこんな感じなのを
#import <Foundation/Foundation.h> #import <AppKit/AppKit.h> int main(int argc, const char* argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [NSApplication sharedApplication]; NSRect rect; rect = NSMakeRect(32,32,800,660); unsigned int winStyle= NSTitledWindowMask| NSClosableWindowMask| NSMiniaturizableWindowMask| NSResizableWindowMask; NSWindow *window = [NSWindow alloc]; [window initWithContentRect:rect styleMask:winStyle backing:NSBackingStoreBuffered defer:NO]; [window makeKeyAndOrderFront:nil]; [window makeMainWindow]; [NSApp run]; return 0; }
Makefile
こんな感じ
GNUSTEP_MAKEFILES=/usr/share/GNUstep/Makefiles include $(GNUSTEP_MAKEFILES)/common.make APP_NAME = GuiApplication GuiApplication_OBJC_FILES = main.m include $(GNUSTEP_MAKEFILES)/application.make
上記を見てもわかる通り,GNUstep用のメイクファイルをインクルードしてます。
APP_NAMEは出来上がる実行ファイルの名前を,***_OBJC_FILESにはコンパイル対象のソースファイルを記述します。
パッケージさえそろっていれば上記Makefileでソースファイルはビルドできます。
ビルドが成功すると,'''実行ファイル名.app'''というディレクトリができるはず。
(つまりこの場合はGuiApplication.app)
必要なパッケージ
- gnustep The GNUstep Development Environment
- gnustep-back-common The GNUstep GUI Backend - common files
- gnustep-back0.12 The GNUstep GUI Backend
- gnustep-back0.12-art The GNUstep GUI Backend
- gnustep-base-common GNUstep Base library - common files
- gnustep-base-runtime GNUstep Base library
- gnustep-common Common files for the core GNUstep environmen
- gnustep-core The GNUstep Development Environment -- core
- gnustep-core-devel The GNUstep Development Environment -- core
- gnustep-devel The GNUstep Development Environment -- devel
- gnustep-dl2 Objective-C Classes needed for Database Acce
- gnustep-gpbs The GNUstep PasteBoard Server
- gnustep-gui-common GNUstep GUI Library - common files
- gnustep-gui-runtime GNUstep GUI Library - runtime files
- gnustep-make Basic GNUstep Makefiles
- libgnustep-base-dev GNUstep Base header files and development
- libgnustep-base1.14 GNUstep Base library
- libgnustep-gui-dev GNUstep GUI header files and static librarie
- libgnustep-gui0.12 GNUstep GUI Library