Issue #494 - Pass path options when compiling libs

Pass append/prepend path options when compiling dependent libraries, avoiding any issues with include directives in the libraries.
This commit is contained in:
Justin Ethier 2022-11-28 22:16:20 -05:00
parent 5e509495be
commit 427845cbaf
2 changed files with 19 additions and 0 deletions

View file

@ -1,5 +1,11 @@
# Changelog # Changelog
## 0.36.0 - TBD
Bug Fixes
- Pass append and prepend directories when compiling dependent libraries of a program. This prevents issues where the directories are not made available to any `include` directives within such libraries.
## 0.35.0 - August 25, 2022 ## 0.35.0 - August 25, 2022
Features Features

View file

@ -295,6 +295,8 @@
(when (recompile? lib-dep append-dirs prepend-dirs) (when (recompile? lib-dep append-dirs prepend-dirs)
(let ((result (system (string-append (let ((result (system (string-append
(calling-program) " " (calling-program) " "
(dirs->args "-A" append-dirs) " "
(dirs->args "-I" prepend-dirs) " "
(lib:import->filename lib-dep ".sld" append-dirs prepend-dirs))))) (lib:import->filename lib-dep ".sld" append-dirs prepend-dirs)))))
(when (> result 0) (when (> result 0)
(error "Unable to compile library" lib-dep))))) (error "Unable to compile library" lib-dep)))))
@ -986,6 +988,17 @@
(list #f) (list #f)
args))) args)))
;; Convert a list of directories to a string of arguments.
;; EG: (dirs->args "-I" '("dir-1" "dir-2")) =>
;; " -I dir-1 -I dir-2 "
(define (dirs->args prefix dirs)
(apply
string-append
(map
(lambda (dir)
(string-append " " prefix " " dir " "))
dirs)))
;; Handle command line arguments ;; Handle command line arguments
(let* ((args (command-line-arguments)) (let* ((args (command-line-arguments))
(non-opts (non-opts