1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
3 ;;; cffi-tests.asd --- ASDF system definition for CFFI unit tests.
5 ;;; Copyright (C) 2005-2006, James Bielman <jamesjb@jamesjb.com>
6 ;;; Copyright (C) 2005-2011, Luis Oliveira <loliveira@common-lisp.net>
8 ;;; Permission is hereby granted, free of charge, to any person
9 ;;; obtaining a copy of this software and associated documentation
10 ;;; files (the "Software"), to deal in the Software without
11 ;;; restriction, including without limitation the rights to use, copy,
12 ;;; modify, merge, publish, distribute, sublicense, and/or sell copies
13 ;;; of the Software, and to permit persons to whom the Software is
14 ;;; furnished to do so, subject to the following conditions:
16 ;;; The above copyright notice and this permission notice shall be
17 ;;; included in all copies or substantial portions of the Software.
19 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 ;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 ;;; DEALINGS IN THE SOFTWARE.
29 (load-systems "trivial-features" "cffi-grovel")
31 (defclass c-test-lib (c-source-file)
34 (defmethod perform ((o load-op) (c c-test-lib))
37 (defmethod perform ((o load-source-op) (c c-test-lib))
40 (defmethod output-files ((o compile-op) (c c-test-lib))
41 (let ((p (component-pathname c)))
43 (list (make-pathname :defaults p :type (asdf/bundle:bundle-pathname-type :object))
44 (make-pathname :defaults p :type (asdf/bundle:bundle-pathname-type :shared-library)))
47 (defmethod perform ((o compile-op) (c c-test-lib))
48 (let ((cffi-toolchain:*cc-flags* `(,@cffi-toolchain:*cc-flags* "-Wall" "-std=c99" "-pedantic")))
49 (destructuring-bind (obj dll) (output-files o c)
50 (cffi-toolchain:cc-compile obj (input-files o c))
51 (cffi-toolchain:link-shared-library dll (list obj)))))
53 (defsystem "cffi-tests"
54 :description "Unit tests for CFFI."
55 :depends-on ("cffi-grovel" "cffi-libffi" "bordeaux-threads" #-ecl "rt" #+ecl (:require "rt"))
59 ((:c-test-lib "libtest")
60 (:c-test-lib "libtest2")
61 (:c-test-lib "libfsbv")
63 (:file "bindings" :depends-on ("package" "libtest" "libtest2" "libfsbv"))
64 (:file "funcall" :depends-on ("bindings"))
65 (:file "defcfun" :depends-on ("bindings"))
66 (:file "callbacks" :depends-on ("bindings"))
67 (:file "foreign-globals" :depends-on ("package"))
68 (:file "memory" :depends-on ("package"))
69 (:file "strings" :depends-on ("package"))
70 (:file "arrays" :depends-on ("package"))
71 (:file "struct" :depends-on ("package"))
72 (:file "union" :depends-on ("package"))
73 (:file "enum" :depends-on ("package"))
74 (:file "fsbv" :depends-on ("bindings" "enum"))
75 (:file "misc-types" :depends-on ("bindings"))
76 (:file "misc" :depends-on ("bindings"))
77 (:file "test-asdf" :depends-on ("package"))
78 (:file "grovel" :depends-on ("package")))))
79 :perform (test-op (o c) (symbol-call :cffi-tests '#:run-all-cffi-tests)))
81 (defsystem "cffi-tests/example"
82 :defsystem-depends-on ("cffi-grovel")
83 :entry-point "cffi-example::entry-point"
85 ((:module "examples" :components
87 (:cffi-wrapper-file "wrapper-example" :depends-on ("package"))
88 (:cffi-grovel-file "grovel-example" :depends-on ("package"))
89 (:file "main-example" :depends-on ("package"))))))