cffi-tests.asd 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
  2. ;;;
  3. ;;; cffi-tests.asd --- ASDF system definition for CFFI unit tests.
  4. ;;;
  5. ;;; Copyright (C) 2005-2006, James Bielman <jamesjb@jamesjb.com>
  6. ;;; Copyright (C) 2005-2011, Luis Oliveira <loliveira@common-lisp.net>
  7. ;;;
  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:
  15. ;;;
  16. ;;; The above copyright notice and this permission notice shall be
  17. ;;; included in all copies or substantial portions of the Software.
  18. ;;;
  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.
  27. ;;;
  28. (load-systems "trivial-features" "cffi-grovel")
  29. (defclass c-test-lib (c-source-file)
  30. ())
  31. (defmethod perform ((o load-op) (c c-test-lib))
  32. nil)
  33. (defmethod perform ((o load-source-op) (c c-test-lib))
  34. nil)
  35. (defmethod output-files ((o compile-op) (c c-test-lib))
  36. (let ((p (component-pathname c)))
  37. (values
  38. (list (make-pathname :defaults p :type (asdf/bundle:bundle-pathname-type :object))
  39. (make-pathname :defaults p :type (asdf/bundle:bundle-pathname-type :shared-library)))
  40. t)))
  41. (defmethod perform ((o compile-op) (c c-test-lib))
  42. (let ((cffi-toolchain:*cc-flags* `(,@cffi-toolchain:*cc-flags* "-Wall" "-std=c99" "-pedantic")))
  43. (destructuring-bind (obj dll) (output-files o c)
  44. (cffi-toolchain:cc-compile obj (input-files o c))
  45. (cffi-toolchain:link-shared-library dll (list obj)))))
  46. (defsystem "cffi-tests"
  47. :description "Unit tests for CFFI."
  48. :depends-on ("cffi-grovel" "cffi-libffi" "bordeaux-threads" #-ecl "rt" #+ecl (:require "rt"))
  49. :components
  50. ((:module "tests"
  51. :components
  52. ((:c-test-lib "libtest")
  53. (:c-test-lib "libtest2")
  54. (:c-test-lib "libfsbv")
  55. (:file "package")
  56. (:file "bindings" :depends-on ("package" "libtest" "libtest2" "libfsbv"))
  57. (:file "funcall" :depends-on ("bindings"))
  58. (:file "defcfun" :depends-on ("bindings"))
  59. (:file "callbacks" :depends-on ("bindings"))
  60. (:file "foreign-globals" :depends-on ("package"))
  61. (:file "memory" :depends-on ("package"))
  62. (:file "strings" :depends-on ("package"))
  63. (:file "arrays" :depends-on ("package"))
  64. (:file "struct" :depends-on ("package"))
  65. (:file "union" :depends-on ("package"))
  66. (:file "enum" :depends-on ("package"))
  67. (:file "fsbv" :depends-on ("bindings" "enum"))
  68. (:file "misc-types" :depends-on ("bindings"))
  69. (:file "misc" :depends-on ("bindings"))
  70. (:file "test-asdf" :depends-on ("package"))
  71. (:file "grovel" :depends-on ("package")))))
  72. :perform (test-op (o c) (symbol-call :cffi-tests '#:run-all-cffi-tests)))
  73. (defsystem "cffi-tests/example"
  74. :defsystem-depends-on ("cffi-grovel")
  75. :entry-point "cffi-example::entry-point"
  76. :components
  77. ((:module "examples" :components
  78. ((:file "package")
  79. (:cffi-wrapper-file "wrapper-example" :depends-on ("package"))
  80. (:cffi-grovel-file "grovel-example" :depends-on ("package"))
  81. (:file "main-example" :depends-on ("package"))))))
  82. ;;; vim: ft=lisp et