Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Getting Started

bjconlan edited this page Sep 9, 2011 · 37 revisions

Using Leiningen

This is the recommended approach. Create a project.clj that looks like this for 0.5.0:

(defproject your-project-name "your.project.version"
  :description "A description of your project"
  :dependencies [[org.clojure/clojure "1.1.0"]
                 [org.clojure/clojure-contrib "1.1.0"]
                 [penumbra "0.5.0"]]
  :native-dependencies [[lwjgl "2.2.2"]]
  :dev-dependencies [[native-deps "1.0.0"]
                     [leiningen/lein-swank "1.1.0"]])

And this for 0.6.0-SNAPSHOT:

(defproject your-project-name "your.project.version"
  :description "A description of your project"
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]
                 [penumbra "0.6.0-SNAPSHOT"]]
  :native-dependencies [[penumbra/lwjgl "2.4.2"]]
  :dev-dependencies [[native-deps "1.0.5"]
                     [swank-clojure "1.3.2"]])

At the command line, run lein deps followed by lein native-deps. After that, you can run lein swank, and in Emacs, M-x slime-connect to connect to the REPL. To get a REPL at the command line, just use lein repl.

Using a run script.

First, run lein deps, followed by lein native-deps.

Penumbra relies on the following:

  • Current versions of clojure and clojure-contrib.
    • Penumbra targets the master branch of Clojure.
    • clojure-contrib must be pre-compiled. If clojure-contrib.jar doesn’t reside in the root directory, build it using the directions here. Make sure to specify the correct clojure jar (currently named 1.2.0).
  • /src needs to be added to the classpath, and /lib/* (osx, linux, or windows) to the class and library paths.
    • 32-bit libraries are in /x86, 64-bit in /x86_64.

The easiest way to satisfy the last requirement is a script that looks something like this:

java -cp \
/.../clojure/1.2.0-master-SNAPSHOT.jar:\
/.../clojure-contrib/clojure-contrib.jar:\
/.../penumbra/src:\
/.../penumbra/test:\
/.../penumbra/lib/* \
-Djava.library.path=/.../penumbra/native/x86/osx \
clojure.main

Where ‘…’ is the respective path to each of these directories. To run all example programs one by one, enter this at the REPL:

> (require 'examples)
nil
> (examples/run)

Depending on your hardware and drivers, some examples may not work properly. If this is the case, please file a report with your hardware, driver version, and the output of glxinfo at the command line.

Alternate approaches

The above method may not fit well with your preferred workflow. You can also

  • Alter environment variables such that your default class and library paths include the above directories.
  • Put files in a directory already included in your class or library paths. All jar and clj files must be in your class path, all other files must be in your library path.

Methods of altering environment variables vary widely by platform, and are beyond the scope of this article. You can discover the appropriate locations for files at the REPL by entering (System/getProperty "java.library.path") for binary files, and (System/getProperty "java.ext.dirs") for jar and clj files.

Clone this wiki locally