mirror of
https://github.com/janet-lang/janet
synced 2024-06-26 07:03:16 +00:00
Address #670 - Allow modifying jpm to link to extra libraries.
This commit is contained in:
parent
cbe92bb985
commit
b4ddbd0097
|
@ -2,6 +2,7 @@
|
||||||
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
|
||||||
|
- Expose `JANET_OUT_OF_MEMORY` as part of the Janet API.
|
||||||
- Add `native-deps` option to `decalre-native` in `jpm`. This lets native libraries link to other
|
- Add `native-deps` option to `decalre-native` in `jpm`. This lets native libraries link to other
|
||||||
native libraries when building with jpm.
|
native libraries when building with jpm.
|
||||||
- Remove the `tarray` module. The functionality of typed arrays will be moved to an external module
|
- Remove the `tarray` module. The functionality of typed arrays will be moved to an external module
|
||||||
|
|
18
jpm
18
jpm
|
@ -51,6 +51,12 @@
|
||||||
:libpath (try-real (string exe-dir "/../lib"))
|
:libpath (try-real (string exe-dir "/../lib"))
|
||||||
:binpath exe-dir})
|
:binpath exe-dir})
|
||||||
|
|
||||||
|
# If janetconf.h has been modified such that core janet functions and macros require
|
||||||
|
# linking to external libraries, modify this.
|
||||||
|
#
|
||||||
|
# Example - (def- extra-lflags ["-lmimalloc"])
|
||||||
|
(def- extra-lflags [])
|
||||||
|
|
||||||
###END###
|
###END###
|
||||||
|
|
||||||
# Default based on janet binary location
|
# Default based on janet binary location
|
||||||
|
@ -363,10 +369,10 @@
|
||||||
# executables.
|
# executables.
|
||||||
(def janet-lflags
|
(def janet-lflags
|
||||||
(case (os/which)
|
(case (os/which)
|
||||||
:macos ["-ldl" "-lm" ;thread-flags]
|
:macos ["-ldl" "-lm" ;thread-flags ;extra-lflags]
|
||||||
:windows [;thread-flags]
|
:windows [;thread-flags ;extra-lflags]
|
||||||
:linux ["-lm" "-ldl" "-lrt" ;thread-flags]
|
:linux ["-lm" "-ldl" "-lrt" ;thread-flags ;extra-lflags]
|
||||||
["-lm" ;thread-flags]))
|
["-lm" ;thread-flags ;extra-lflags]))
|
||||||
(def janet-ldflags [])
|
(def janet-ldflags [])
|
||||||
(def janet-cflags [])
|
(def janet-cflags [])
|
||||||
|
|
||||||
|
@ -534,13 +540,15 @@
|
||||||
;(if (opts :static) [] dynamic-lflags)])
|
;(if (opts :static) [] dynamic-lflags)])
|
||||||
(def deplibs (get opts :native-deps []))
|
(def deplibs (get opts :native-deps []))
|
||||||
(def dep-ldflags (seq [x :in deplibs] (string (dyn :modpath JANET_MODPATH) sep x modext)))
|
(def dep-ldflags (seq [x :in deplibs] (string (dyn :modpath JANET_MODPATH) sep x modext)))
|
||||||
|
# Use import libs on windows - we need an import lib to link natives to other natives.
|
||||||
|
(def dep-importlibs (seq [x :in deplibs] (string (dyn :modpath JANET_MODPATH) sep x ".lib")))
|
||||||
(def ldflags [;(opt opts :ldflags []) ;dep-ldflags])
|
(def ldflags [;(opt opts :ldflags []) ;dep-ldflags])
|
||||||
(rule target objects
|
(rule target objects
|
||||||
(check-cc)
|
(check-cc)
|
||||||
(print "linking " target "...")
|
(print "linking " target "...")
|
||||||
(create-dirs target)
|
(create-dirs target)
|
||||||
(if is-win
|
(if is-win
|
||||||
(shell linker ;ldflags (string "/OUT:" target) ;objects (win-import-library) ;lflags)
|
(shell linker ;ldflags (string "/OUT:" target) ;objects (win-import-library) ;dep-importlibs ;lflags)
|
||||||
(shell linker ;cflags ;ldflags `-o` target ;objects ;lflags))))
|
(shell linker ;cflags ;ldflags `-o` target ;objects ;lflags))))
|
||||||
|
|
||||||
(defn- archive-c
|
(defn- archive-c
|
||||||
|
|
Loading…
Reference in New Issue
Block a user