mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Allow C compiler/linker options from a library to be expanded via cond-expand
This commit is contained in:
parent
c82e69a997
commit
209050b2d4
3 changed files with 18 additions and 10 deletions
|
@ -6,6 +6,7 @@ Features
|
|||
|
||||
- Arthur Maciel added `opaque?` and `opaque-null?` predicates to `(cyclone foreign)`.
|
||||
- Added `import-shared-object` to `(scheme eval)` to allow loading a third party C shared library.
|
||||
- Allow C compiler/linker options from a library to be expanded via `cond-expand`.
|
||||
|
||||
Bug Fixes
|
||||
|
||||
|
|
|
@ -741,7 +741,7 @@
|
|||
'()))
|
||||
;; Read all linker options from dependent libs
|
||||
(c-linker-options
|
||||
(let ((lib-options (lib:get-all-c-linker-options lib-deps append-dirs prepend-dirs)))
|
||||
(let ((lib-options (lib:get-all-c-linker-options lib-deps append-dirs prepend-dirs expander)))
|
||||
(if program?
|
||||
(string-append ;; Also read from current program
|
||||
(string-join (program-c-linker-opts! in-prog) " ")
|
||||
|
@ -791,7 +791,8 @@
|
|||
(lib:get-all-c-linker-options
|
||||
lib-deps
|
||||
append-dirs
|
||||
prepend-dirs))
|
||||
prepend-dirs
|
||||
expander))
|
||||
;; Return new deps
|
||||
lib-deps)
|
||||
in-file
|
||||
|
|
|
@ -434,37 +434,43 @@
|
|||
(close-input-port fp)
|
||||
includes))
|
||||
|
||||
(define (lib:read-c-linker-options import append-dirs prepend-dirs)
|
||||
(define (lib:read-c-linker-options import append-dirs prepend-dirs expander)
|
||||
(let* ((lib-name (lib:import->library-name import))
|
||||
(dir (lib:import->filename lib-name ".sld" append-dirs prepend-dirs))
|
||||
(fp (open-input-file dir))
|
||||
(lib (read-all fp))
|
||||
(options (lib:c-linker-options (car lib))))
|
||||
(lib* (if expander
|
||||
(list (lib:cond-expand (car lib) expander))
|
||||
lib))
|
||||
(options (lib:c-linker-options (car lib*))))
|
||||
(close-input-port fp)
|
||||
(string-join options " ")))
|
||||
|
||||
(define (lib:get-all-c-linker-options imports append-dirs prepend-dirs)
|
||||
(define (lib:get-all-c-linker-options imports append-dirs prepend-dirs expander)
|
||||
(string-join
|
||||
(map
|
||||
(lambda (import)
|
||||
(lib:read-c-linker-options import append-dirs prepend-dirs))
|
||||
(lib:read-c-linker-options import append-dirs prepend-dirs expander))
|
||||
imports)
|
||||
" "))
|
||||
|
||||
(define (lib:read-c-compiler-options import append-dirs prepend-dirs)
|
||||
(define (lib:read-c-compiler-options import append-dirs prepend-dirs expander)
|
||||
(let* ((lib-name (lib:import->library-name import))
|
||||
(dir (lib:import->filename lib-name ".sld" append-dirs prepend-dirs))
|
||||
(fp (open-input-file dir))
|
||||
(lib (read-all fp))
|
||||
(options (lib:c-compiler-options (car lib))))
|
||||
(lib* (if expander
|
||||
(list (lib:cond-expand (car lib) expander))
|
||||
lib))
|
||||
(options (lib:c-compiler-options (car lib*))))
|
||||
(close-input-port fp)
|
||||
(string-join options " ")))
|
||||
|
||||
(define (lib:get-all-c-compiler-options imports append-dirs prepend-dirs)
|
||||
(define (lib:get-all-c-compiler-options imports append-dirs prepend-dirs expander)
|
||||
(string-join
|
||||
(map
|
||||
(lambda (import)
|
||||
(lib:read-c-compiler-options import append-dirs prepend-dirs))
|
||||
(lib:read-c-compiler-options import append-dirs prepend-dirs expander))
|
||||
imports)
|
||||
" "))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue