Skip to content

Instantly share code, notes, and snippets.

@wusticality
Created January 8, 2019 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wusticality/13de141a7236d7b392235fb129ace236 to your computer and use it in GitHub Desktop.
Save wusticality/13de141a7236d7b392235fb129ace236 to your computer and use it in GitHub Desktop.
;; We need this to determine the os.
(require 'leiningen.core.eval)
(def os
;; The os we're using.
(leiningen.core.eval/get-os))
(def jvm
;; Our JVM options.
{:common []
:macosx ["-XstartOnFirstThread" "-Djava.awt.headless=true"]
:linux []
:windows []})
(def modules
;; All regular modules.
'[[org.clojure/clojure "1.9.0"]])
(def lwjgl
;; Our LWJGL options.
{:ns "org.lwjgl"
:version "3.2.1"
:modules {"lwjgl" :native
"lwjgl-glfw" :native
"lwjgl-opengl" :native}})
(def jvm-opts
"The final JVM options for the current os."
(vec (set (concat (get jvm :common)
(get jvm os)))))
(def lwjgl-modules
"The final LWJGL dependencies for the current os."
(let [ns (:ns lwjgl)
version (:version lwjgl)]
(apply concat
(for [[module native] (:modules lwjgl)]
(let [prefix [(symbol ns module) version]]
(into [prefix]
(if (not= native :native)
[]
[(into prefix
[:classifier (str "natives-" (name os))
:native-prefix])])))))))
(def dependencies
"The final dependencies for the current os."
(into modules lwjgl-modules))
(defproject megachurch "0.0.0"
:description "The source for my experimental game."
:dependencies ~dependencies
:jvm-opts ^:replace ~jvm-opts
:repl-options {:init-ns game.core}
:main game.core)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment