Quantcast
Channel: WebGPU プログラミング
Viewing all articles
Browse latest Browse all 40

Camlkit GNUstep with Gorm

$
0
0

GNUstepでは、gormファイルを読み込んでアプリを起動することができますが、
Camlkitでも可能かトライしてみました。

[実行結果]

アプリの起動時に、gormファイル読み込んだところ。
gormファイルは、Gormアプリの [New Application] で生成したもの。

ファイル構成

gnustep-app
/Resources
    MyApp.gorm(上記のgormファイル)
    Info-gnustep.plist
dune
dune-project
appkit_global.ml
main.ml


Info-gnustep.plist(camlkit-exampleのplist を編集して使用)

{
    ApplicationDescription = "Test GNUStep app.";
    ApplicationName = GSApp;
    ApplicationRelease = "1.0";
    Authors = ( "Boris D. <borisd@gmx.com>" );
    FullVersionID = "1.0";
    GSMainMarkupFile = "";
    NSExecutable = GSApp;
    NSIcon = "";
    NSMainNibFile = "MyApp";
    NSMainStoryboardFile = "";
    NSPrincipalClass = NSApplication;
}

NSMainNibFileにMyAppを設定

dune

(executable
 (name main)
 (flags -ccopt -L/usr/local/GNUstep/System/Library/Libraries  -cclib -lgnustep-gui)
 (libraries camlkit-base.foundation camlkit-gui.appkit camlkit.camlkit))

(subdir GSApp.app
 (rule
  (deps ../main.exe)
  (targets GSApp)
  (action (copy ../main.exe GSApp))))

(subdir GSApp.app/Resources
  (rule
    (deps ../../Resources/Info-gnustep.plist)
    (targets Info-gnustep.plist)
    (action (progn
      (copy ../../Resources/Info-gnustep.plist Info-gnustep.plist))))
)
(subdir GSApp.app/Resources/MyApp.gorm
  (rule
    (deps ../../../Resources/MyApp.gorm/objects.gorm ../../../Resources/MyApp.gorm/data.classes ../../../Resources/MyApp.gorm/data.info)
    (targets objects.gorm data.classes data.info)
    (action (progn
       (copy ../../../Resources/MyApp.gorm/objects.gorm objects.gorm)
       (copy ../../../Resources/MyApp.gorm/data.classes data.classes)
       (copy ../../../Resources/MyApp.gorm/data.info data.info))))
)


dune-project
(lang dune 3.13)

appkit_global.ml

open Runtime
open Objc

let _NSWindowStyleMaskTitled = 1
let _NSWindowStyleMaskClosable = 2
let _NSBackingStoreBuffered = 2

let _NSApplicationMain = Foreign.foreign "NSApplicationMain" (int @-> (ptr string) @-> returning int)


main.ml

(* gnustep-app *)
open Foundation
open Appkit
open Appkit_global
open Runtime

let main () =
    let app = NSApplication._class_ |> NSApplication.C.sharedApplication
    and argc = Array.length Sys.argv
    and argv =
       Sys.argv
       |> Array.to_list
       |> Objc.(CArray.of_list string)
       |> Objc.CArray.start
    in
     app |> NSApplication.activateIgnoringOtherApps true;
     
    _NSApplicationMain argc argv |> exit

let () = main ()


実行
dune build
dune exec ./GSApp.app/GSApp

GSApp.appは、任意の場所に単独で取り出しても実行できる。


Viewing all articles
Browse latest Browse all 40