-
Notifications
You must be signed in to change notification settings - Fork 1
/
tecgraf-base.lisp
32 lines (28 loc) · 1.25 KB
/
tecgraf-base.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(defpackage #:tecgraf-base
(:use #:common-lisp)
(:export #:ihandle
#:im-image
#:im-file
#:defalias
#:maybe-add-foreign-library-directory))
(in-package #:tecgraf-base)
(pffft:define-foreign-pointer-wrapper ihandle)
(pffft:define-foreign-pointer-wrapper im-image)
(pffft:define-foreign-pointer-wrapper im-file)
(defmacro defalias (to what &optional documentation (documentation-type 'function))
`(progn
(setf (fdefinition ',to) ,what)
(when ,documentation
(setf (documentation ',to ',documentation-type) ,documentation))))
(defun maybe-add-foreign-library-directory ()
(handler-case
(let ((pathname (asdf:system-relative-pathname "tecgraf-libs" "libs/")))
(pushnew pathname cffi:*foreign-library-directories*)
;; On Windows, we add the tecgraf libraries directory to the
;; PATH environment variable so that support libraries
;; (freetype6.dll, zlib1.dll, etc.) are found.
#+windows
(setf (uiop:getenv "PATH")
(concatenate 'string (uiop:getenv "PATH") ";" (namestring pathname))))
(asdf/find-component:missing-component ()
(warn "System \"tecgraf-libs\" not found. You'll need to install IUP, IM and CD shared libraries manually."))))