Common to all solutions is compiling you CLOG application to an executable. See demos/make-snake and the source of the 01-demo.lisp file.
make-snake produces a native app that launches a browser. When snake game exist the executable quits.
or better yet use CLOGFRAME - see clogframe/README.md and the built in browser control on your OS.
-
Open app using chrome in app mode (not exactly native but looks it)
-
Use MacGap on Mac
-
Native app using (ql:quickload :ceramic) (works well for Windows and Linux)
-
Native iOS and Android using Cordova and ECL
-
Webview.h
To open a chrome window in app mode use -app="URL" for example to start the builder as an app:
On Mac:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome -app="http://127.0.0.1:8080/builder"
On Linux:
google-chrome-stable --new-window --app="http://127.0.0.1:8080/builder"
On Windows
chrome --new-window --app="http://127.0.0.1:8080/builder"
https://github.com/MacGapProject/MacGap2
git clone https://github.com/MacGapProject/MacGap2.git
open MacGap2/MG.xcodeproj/
In public/index.html in Xcode you use: MacGap.launch(appName) to launch your app. Then connect to it on the port you have chosen.
The documentation for ceramic is at: http://ceramic.github.io/
Complete project at - https://github.com/rabbibotton/elect
- (ql:quickload :ceramic)
- (ceramic:setup)
Now that ceramic is installed. We create a new project using CLOG Builder:
- (ql:quickload :clog/tools)
- (clog-tools:clog-builder)
In CLOG Builder:
- Choose Builder->New Application Template
- Choose a template for your project - I will use CLOG-GUI
- Give the new project a name - I am using elect as the project name
- Choose the default directory ~/common-lisp or another that works for you
In the REPL let's load the new project:
- Let's open ~/common-lisp/elect/elect.asd
- Add to depends-on #:ceramic
- Let's open ~/common-lisp/elect/elect.lisp
- Replace start-app with:
(defvar *window* nil)
(defun start-app (&key (port 8080))
(ceramic:start)
(initialize 'on-new-window
:port port
:static-root (ceramic:resource-directory 'www))
(setf *window*
(ceramic:make-window :url (format nil "http://127.0.0.1:~D/" port)))
(ceramic:show *window*))
(ceramic:define-resources :elect ()
(www #p"www/"))
(ceramic:define-entry-point :elect ()
(start-app))
- We need to add to the botton of on-new-window code to shutdown app.
(clog:run body) ; wait while body is running
(ceramic:quit) ; quit ceramic/electron
(clog:shutdown) ; shutdown clog
- I suggest starting from scratch at this point: M-x slime-restart-inferior-lisp
- (ql:quickload :elect)
- (elect:start-app)
That should start up a native application with your CLOG app
To package you applicaton use:
- (ceramic:bundle :elect)
https://github.com/webview/webview
See clogframe for working external example