mirror of
https://github.com/janet-lang/janet
synced 2025-02-09 05:20:03 +00:00
jpm updates.
Add better error message if no c compiler detected on windows.
This commit is contained in:
parent
95266bdcf8
commit
78b5c94cb0
@ -2,6 +2,8 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unreleased
|
## 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.
|
- Change default fiber stack limit to the maximum value of a 32 bit signed integer.
|
||||||
- Some bug fixes with `jpm`
|
- Some bug fixes with `jpm`
|
||||||
- Add `os/arch` to get ISA that janet was compiled for
|
- Add `os/arch` to get ISA that janet was compiled for
|
||||||
|
@ -37,6 +37,7 @@ Keys are:
|
|||||||
--libpath : The directory containing janet C libraries (libjanet.*). Defaults to $JANET_LIBPATH.
|
--libpath : The directory containing janet C libraries (libjanet.*). Defaults to $JANET_LIBPATH.
|
||||||
--optimize : Optimization level for natives. Defaults to 2.
|
--optimize : Optimization level for natives. Defaults to 2.
|
||||||
--compiler : C compiler to use for natives. Defaults to cc (cl on windows).
|
--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).
|
--linker : C linker to use for linking natives. Defaults to cc (link on windows).
|
||||||
--cflags : Extra compiler flags for native modules.
|
--cflags : Extra compiler flags for native modules.
|
||||||
--lflags : Extra linker flags for native modules.
|
--lflags : Extra linker flags for native modules.
|
||||||
|
@ -144,6 +144,16 @@
|
|||||||
(error (string "option :" key " not set")))
|
(error (string "option :" key " not set")))
|
||||||
ret)
|
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
|
# Importing a file
|
||||||
#
|
#
|
||||||
@ -269,6 +279,7 @@
|
|||||||
(def defines [;(make-defines (opt opts :defines {})) ;entry-defines])
|
(def defines [;(make-defines (opt opts :defines {})) ;entry-defines])
|
||||||
(def headers (or (opts :headers) []))
|
(def headers (or (opts :headers) []))
|
||||||
(rule dest [src ;headers]
|
(rule dest [src ;headers]
|
||||||
|
(check-cc)
|
||||||
(print "compiling " dest "...")
|
(print "compiling " dest "...")
|
||||||
(if is-win
|
(if is-win
|
||||||
(shell cc ;defines "/c" ;cflags (string "/Fo" dest) src)
|
(shell cc ;defines "/c" ;cflags (string "/Fo" dest) src)
|
||||||
@ -300,6 +311,7 @@
|
|||||||
(def lflags [;(opt opts :lflags default-lflags)
|
(def lflags [;(opt opts :lflags default-lflags)
|
||||||
;(if (opts :static) [] dynamic-lflags)])
|
;(if (opts :static) [] dynamic-lflags)])
|
||||||
(rule target objects
|
(rule target objects
|
||||||
|
(check-cc)
|
||||||
(print "linking " target "...")
|
(print "linking " target "...")
|
||||||
(if is-win
|
(if is-win
|
||||||
(shell ld ;lflags (string "/OUT:" target) ;objects (win-import-library))
|
(shell ld ;lflags (string "/OUT:" target) ;objects (win-import-library))
|
||||||
@ -310,6 +322,7 @@
|
|||||||
[opts target & objects]
|
[opts target & objects]
|
||||||
(def ar (opt opts :archiver default-archiver))
|
(def ar (opt opts :archiver default-archiver))
|
||||||
(rule target objects
|
(rule target objects
|
||||||
|
(check-cc)
|
||||||
(print "creating static library " target "...")
|
(print "creating static library " target "...")
|
||||||
(if is-win
|
(if is-win
|
||||||
(shell ar "/nologo" (string "/out:" target) ;objects)
|
(shell ar "/nologo" (string "/out:" target) ;objects)
|
||||||
@ -357,6 +370,7 @@
|
|||||||
# Create executable's janet image
|
# Create executable's janet image
|
||||||
(def cimage_dest (string dest ".c"))
|
(def cimage_dest (string dest ".c"))
|
||||||
(rule dest [source]
|
(rule dest [source]
|
||||||
|
(check-cc)
|
||||||
(print "generating executable c source...")
|
(print "generating executable c source...")
|
||||||
# Load entry environment and get main function.
|
# Load entry environment and get main function.
|
||||||
(def entry-env (dofile source))
|
(def entry-env (dofile source))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user