The "foreign-test.rktl" finally work on both windows machines.
To get the expected contents of the various environment variables, I used a similar approach to what the build does in `grab_batch_vars': * Start a cmd.exe shell (not a real shell) * Dump the env into a buffer * Run "... Studio/VC/vcvarsall.bat" (modifies envvars, which is why cmd is needed) * Dump new env into a new buffer * Sort both buffers and compare Hopefully it still works also on Matthew's setup. Two other small things: * Use ".obj" suffix on windows to avoid warning. * Catch error when trying to delete the .so file, since on the x86_64 machine it throws an error. (I'm not sure how it *doesn't* do that with the i386 machine.)
This commit is contained in:
parent
f5a8c62823
commit
76ab851d2a
|
@ -20,27 +20,51 @@
|
|||
(flush-output)
|
||||
|
||||
(when (eq? 'windows (system-type))
|
||||
(let* ([concat string-append]
|
||||
[studio "c:/Program Files/Microsoft Visual Studio 10.0"]
|
||||
[scommon (concat studio "/Common7")]
|
||||
[vc (concat studio "/VC")])
|
||||
(when (directory-exists? studio)
|
||||
(putenv "PATH" (concat (getenv "PATH")
|
||||
";" vc "/bin"
|
||||
";" scommon "/IDE"
|
||||
";" scommon "/Tools"
|
||||
";" scommon "/Tools/bin"))
|
||||
(putenv "INCLUDE" (concat ";" vc "/include"
|
||||
";" vc "/atlmfc/include"
|
||||
";" vc "/PlatformSDK/Include"))
|
||||
(putenv "LIB" (concat ";" vc "/lib"
|
||||
";" vc "/atlmfc/lib"
|
||||
";" vc "/PlatformSDK/lib")))))
|
||||
(define concat string-append)
|
||||
(define 64bit? (= 8 (compiler-sizeof '(* void))))
|
||||
(define (find-dir . dirs)
|
||||
(for/or ([d (in-list dirs)]) (and (directory-exists? d) d)))
|
||||
(define progfiles
|
||||
(find-dir "C:/Program Files (x86)" "C:/Program Files"))
|
||||
(define studio
|
||||
(and progfiles (concat progfiles "/Microsoft Visual Studio 10.0")))
|
||||
(when (and studio (directory-exists? studio))
|
||||
(define (paths-env var . ps)
|
||||
(define val
|
||||
(apply concat (for/list ([p (in-list ps)]
|
||||
#:when (and p (directory-exists? p)))
|
||||
(concat p ";"))))
|
||||
(printf ">>> $~a = ~s\n" var val)
|
||||
(putenv var val))
|
||||
(define (vc p) (concat studio "/VC/" p))
|
||||
(define (common p) (concat studio "/Common7/" p))
|
||||
(define (winsdk p) (concat progfiles "/Microsoft SDKs/Windows/v7.0A/" p))
|
||||
(paths-env "PATH"
|
||||
(getenv "PATH")
|
||||
(vc (if 64bit? "BIN/amd64" "BIN"))
|
||||
(vc "IDE") (vc "Tools") (vc "Tools/bin")
|
||||
(common "Tools") (common "IDE"))
|
||||
(paths-env "INCLUDE"
|
||||
(vc "INCLUDE") (vc "ATLMFC/INCLUDE") (vc "PlatformSDK/INCLUDE")
|
||||
(winsdk "include"))
|
||||
(paths-env "LIB"
|
||||
(vc (if 64bit? "LIB/amd64" "LIB"))
|
||||
(vc (if 64bit? "ATLMFC/LIB" "ATLMFC/LIB/amd64"))
|
||||
(vc "PlatformSDK/LIB")
|
||||
(winsdk (if 64bit? "Lib/x64" "Lib")))
|
||||
(putenv "LIBPATH" (getenv "LIB"))
|
||||
(define tmp (getenv "TEMP"))
|
||||
(unless (and tmp (directory-exists tmp))
|
||||
(putenv "TEMP" (or (find-dir "C:/Temp" "C:/tmp")
|
||||
(error "Could not find a temporary directory"))))
|
||||
(when 64bit? (putenv "Platform" "X64"))))
|
||||
|
||||
(require dynext/compile dynext/link mzlib/etc)
|
||||
(define delete-test-files
|
||||
(let ([c (build-path (this-expression-source-directory) "foreign-test.c")]
|
||||
[o (build-path (current-directory) "foreign-test.o")]
|
||||
[o (build-path (current-directory)
|
||||
(if (eq? 'windows (system-type))
|
||||
"foreign-test.obj" "foreign-test.o"))]
|
||||
[so (build-path (current-directory)
|
||||
(bytes->path (bytes-append #"foreign-test"
|
||||
(system-type 'so-suffix))))])
|
||||
|
@ -51,7 +75,11 @@
|
|||
(link-extension #t (list o) so))
|
||||
(lambda ()
|
||||
(when (file-exists? o) (delete-file o))
|
||||
(when (file-exists? so) (delete-file so)))))
|
||||
(when (file-exists? so)
|
||||
(with-handlers ([exn:fail:filesystem?
|
||||
(lambda (e)
|
||||
(eprintf "warning: could not delete ~e\n" so))])
|
||||
(delete-file so))))))
|
||||
|
||||
;; Test arrays
|
||||
(define _c7_list (_array/list _byte 7))
|
||||
|
|
Loading…
Reference in New Issue
Block a user