1
0
mirror of https://github.com/janet-lang/janet synced 2025-01-23 21:56:52 +00:00

jpm updates.

Add better error message if no c compiler detected on windows.
This commit is contained in:
Calvin Rose 2019-08-24 17:36:50 -04:00
parent 95266bdcf8
commit 78b5c94cb0
3 changed files with 17 additions and 0 deletions

View File

@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file.
## Unreleased
- jpm detects if not in a Developer Command prompt on windows for a better error message.
- jpm install git submodules in dependencies
- Change default fiber stack limit to the maximum value of a 32 bit signed integer.
- Some bug fixes with `jpm`
- Add `os/arch` to get ISA that janet was compiled for

View File

@ -37,6 +37,7 @@ Keys are:
--libpath : The directory containing janet C libraries (libjanet.*). Defaults to $JANET_LIBPATH.
--optimize : Optimization level for natives. Defaults to 2.
--compiler : C compiler to use for natives. Defaults to cc (cl on windows).
--archiver : C compiler to use for static libraries. Defaults to ar (lib on windows).
--linker : C linker to use for linking natives. Defaults to cc (link on windows).
--cflags : Extra compiler flags for native modules.
--lflags : Extra linker flags for native modules.

View File

@ -144,6 +144,16 @@
(error (string "option :" key " not set")))
ret)
(defn check-cc
"Ensure we have a c compiler"
[]
(if is-win
(do
(if (os/getenv "INCLUDE") (break))
(error "Run jpm or load cook.janet inside a Developer Command Prompt.
jpm needs a c compiler to compile natives. You can install the MSVC compiler at "))
(do)))
#
# Importing a file
#
@ -269,6 +279,7 @@
(def defines [;(make-defines (opt opts :defines {})) ;entry-defines])
(def headers (or (opts :headers) []))
(rule dest [src ;headers]
(check-cc)
(print "compiling " dest "...")
(if is-win
(shell cc ;defines "/c" ;cflags (string "/Fo" dest) src)
@ -300,6 +311,7 @@
(def lflags [;(opt opts :lflags default-lflags)
;(if (opts :static) [] dynamic-lflags)])
(rule target objects
(check-cc)
(print "linking " target "...")
(if is-win
(shell ld ;lflags (string "/OUT:" target) ;objects (win-import-library))
@ -310,6 +322,7 @@
[opts target & objects]
(def ar (opt opts :archiver default-archiver))
(rule target objects
(check-cc)
(print "creating static library " target "...")
(if is-win
(shell ar "/nologo" (string "/out:" target) ;objects)
@ -357,6 +370,7 @@
# Create executable's janet image
(def cimage_dest (string dest ".c"))
(rule dest [source]
(check-cc)
(print "generating executable c source...")
# Load entry environment and get main function.
(def entry-env (dofile source))