Next: , Previous: , Up: The Groveller   [Contents][Index]

13.3 ASDF Integration

An example software project might contain four files; an ASDF file, a package definition file, an implementation file, and a CFFI-Grovel specification file.

The ASDF file defines the system and its dependencies. Notice the use of eval-when to ensure CFFI-Grovel is present and the use of (cffi-grovel:grovel-file name &key cc-flags) instead of (:file name).

  ;;; CFFI-Grovel is needed for processing grovel-file components
  (cl:eval-when (:load-toplevel :execute)
    (asdf:operate 'asdf:load-op 'cffi-grovel))
  (asdf:defsystem example-software
    :depends-on (cffi)
    :serial t
    ((:file "package")
     (cffi-grovel:grovel-file "example-grovelling")
     (:file "example")))

The “package.lisp” file would contain several defpackage forms, to remove circular dependencies and make building the project easier. Note that you may or may not want to :use your internal package.

Implementor’s note: Mention that it’s a not a good idea to :USE when names may clash with, say, CL symbols.

  (defpackage #:example-internal
    (:nicknames #:exampleint))
  (defpackage #:example-software
    (:export ...)
    (:use #:cl #:cffi #:exampleint))

The internal package is created by Lisp code output from the C program written by CFFI-Grovel; if your specification file is exampleint.lisp, the exampleint.cffi.lisp file will contain the CFFI definitions needed by the rest of your project. See Groveller Syntax.