-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preliminary native windows support, part 1: building bach
with MSVC…
#1290
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,19 @@ namespace: gxc | |
(cond-expand (darwin "-Wl,-rpath,") (else "-Wl,-rpath=")) | ||
gerbil-libdir)) | ||
|
||
(def compiler-obj-suffix | ||
(cond-expand | ||
(visualc ".obj") | ||
(else ".o"))) | ||
|
||
(def (path->string-literal path) | ||
(string-append | ||
"\"" | ||
(string-map | ||
(lambda (c) (if (char=? c #\\) #\/ c)) | ||
path) | ||
"\"")) | ||
|
||
(def gerbil-runtime-modules | ||
'("gerbil/runtime/gambit" | ||
"gerbil/runtime/util" | ||
|
@@ -222,23 +235,23 @@ namespace: gxc | |
(libgerbil-scm (map find-static-module-file libgerbil-deps)) | ||
(libgerbil-scm (fold-libgerbil-runtime-scm gerbil-staticdir libgerbil-scm)) | ||
(libgerbil-c (map (cut replace-extension <> ".c") libgerbil-scm)) | ||
(libgerbil-o (map (cut replace-extension <> ".o") libgerbil-scm)) | ||
(libgerbil-o (map (cut replace-extension <> compiler-obj-suffix) libgerbil-scm)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name this function, e.g. |
||
(src-deps (filter userlib-module? deps)) | ||
(src-deps-scm (map find-static-module-file src-deps)) | ||
(src-deps-scm (filter not-file-empty? src-deps-scm)) | ||
(src-deps-scm (map path-expand src-deps-scm)) | ||
(src-deps-c (map (cut replace-extension <> ".c") src-deps-scm)) | ||
(src-deps-o (map (cut replace-extension <> ".o") src-deps-scm)) | ||
(src-deps-o (map (cut replace-extension <> compiler-obj-suffix) src-deps-scm)) | ||
(src-bin-scm (find-static-module-file ctx)) | ||
(src-bin-scm (path-expand src-bin-scm)) | ||
(src-bin-c (replace-extension src-bin-scm ".c")) | ||
(src-bin-o (replace-extension src-bin-scm ".o")) | ||
(src-bin-o (replace-extension src-bin-scm compiler-obj-suffix)) | ||
(output-bin (path-expand output-bin)) | ||
(output-scm (path-expand output-scm)) | ||
(output-c (replace-extension output-scm ".c")) | ||
(output-o (replace-extension output-scm ".o")) | ||
(output-o (replace-extension output-scm compiler-obj-suffix)) | ||
(output_-c (replace-extension output-scm "_.c")) | ||
(output_-o (replace-extension output-scm "_.o")) | ||
(output_-o (replace-extension output-scm (string-append "_" compiler-obj-suffix))) | ||
(gsc-link-opts (gsc-link-options)) | ||
(gsc-cc-opts (gsc-cc-options static: #t)) | ||
(gsc-static-opts (gsc-static-include-options gerbil-staticdir)) | ||
|
@@ -252,7 +265,7 @@ namespace: gxc | |
(cons ctx deps)))))) | ||
|
||
(def (compile-obj scm-path c-path) | ||
(let (o-path (replace-extension c-path ".o")) | ||
(let (o-path (replace-extension c-path compiler-obj-suffix)) | ||
(let* ((lock (string-append o-path ".lock")) | ||
(locked #f) | ||
(unlock | ||
|
@@ -393,17 +406,17 @@ namespace: gxc | |
(gerbil-libdir (path-expand "lib" gerbil-home)) | ||
(runtime (map find-static-module-file gerbil-runtime-modules)) | ||
(gambit-sharp (path-expand "lib/_gambit#.scm" gerbil-home)) | ||
(include-gambit-sharp (string-append "(include \"" gambit-sharp "\")")) | ||
(include-gambit-sharp (string-append "(include " (path->string-literal gambit-sharp) ")")) | ||
(bin-scm (find-static-module-file ctx)) | ||
(deps (find-runtime-module-deps ctx)) | ||
(deps (map find-static-module-file deps)) | ||
(deps (filter (? (not file-empty?)) deps)) | ||
(deps (filter (lambda (f) (not (member f runtime))) deps)) | ||
(output-base (string-append (path-strip-extension output-scm))) | ||
(output-c (string-append output-base ".c")) | ||
(output-o (string-append output-base ".o")) | ||
(output-o (string-append output-base compiler-obj-suffix)) | ||
(output-c_ (string-append output-base "_.c")) | ||
(output-o_ (string-append output-base "_.o")) | ||
(output-o_ (string-append output-base (string-append "_" compiler-obj-suffix))) | ||
(gsc-link-opts (gsc-link-options)) | ||
(gsc-cc-opts (gsc-cc-options static: #t)) | ||
(gsc-static-opts (gsc-static-include-options (path-expand "static" gerbil-libdir))) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is Windows specific, so should either be in a cond-expand, or, preferably, have a name that reflects it is windows-specific. I suspect the 100% correct code is closer to escape-windows-token-within-double-quotes from uiop/launch-program.lisp: https://gitlab.common-lisp.net/asdf/asdf/-/blob/master/uiop/launch-program.lisp
I understand if you don't use the 100% correct version, but then at the very least, there should be a comment in the code that explains within which parameters the function is correct enough that we stick to.
Alternatively,
object->string
might work well enough.