Quick notes on using CEPL on macOS
Just jotting down some notes while trying to get CEPL working on my oldish MacBook Pro running El Capitan.
- Use SBCL. I usually default to ClozureCL, but for the moment I can’t get
swank:*communication-style* nil
to work with it, and things will just break horribly if you end up off the main thread in CEPL. SBCL works fine. - To make sure that Swank starts up with the right communication style, I stuck this in
~/.swank.lisp
:#+sbcl (setf swank:*communication-style* nil)
- My (old) Macs only support up to version 3.3 OpenGL contexts, but the version of CEPL that’s available in Quicklisp uses 4.1 contexts. The current HEAD on Github lets you choose your context version, so you’ll need to clone the CEPL repository and some of its dependencies locally in your Quicklisp local-projects directory. (list below)
- Download the runtime frameworks for SDL2 and SDL2_image and stick
them in
~/Libraries/Frameworks
. - I’m haven’t been able to get the examples running directly yet: it seems like cepl.sdl2’s host step function is getting clobbered by the one in cepl.skitter.sdl2, so you need to avoid loading that.
Repositories you’ll need to clone locally:
- cepl - https://github.com/cbaggers/cepl.git
- cepl.sdl2 - https://github.com/cbaggers/cepl.sdl2.git
- cepl.skitter - https://github.com/cbaggers/cepl.skitter.git
- rtg-math - https://github.com/cbaggers/rtg-math.git
- varjo - https://github.com/cbaggers/varjo.git
Actually running it in SLIME:
- Once you have your
.swank.lisp
set up, and Emacs configured to use SBCL, start SLIME as normal. (e.g. M-x slime) - Load cepl.sdl2:
(ql:quickload "cepl.sdl2")
- Initialize CEPL, passing it a window size and the OpenGL context version you need:
(cepl:repl 480 320 3.3)
- If everything went well, you should have a blank, untitled window somewhere on your desktop, probably behind your Emacs window. Clicking on the SBCL icon on your dock won’t bring it forward, you’ll have to go looking for it.
Again, I can’t get the examples to run directly, but you can run the triangle example below by:
- Loading livesupport:
(ql:quickload "livesupport")
. The examples use it to keep your REPL usable while Swank is in single-threaded mode. - Load the example listed below.
- Run
(triangle::run-loop)
to start it, and hit enter an extra time to get your REPL back. - Run
(triangle::stop-loop)
to stop it.