Convert link_flags to the ordered set DSL
This commit is contained in:
parent
ec29651cff
commit
13b0eb9f2b
|
@ -226,6 +226,9 @@ binary at the same place as where ``ocamlc`` was found, or when there is a
|
|||
- ``(libraries (<library-dependencies>))`` specifies the library dependencies.
|
||||
See the section about `Library dependencies`_ for more details
|
||||
|
||||
- ``(link_flags <flags>)`` specifies additional flags to pass to the linker.
|
||||
This field supports ``(:include ...)`` forms
|
||||
|
||||
- ``(modules <modules>)`` specifies which modules in the current directory
|
||||
Jbuilder should consider when building this executable. Modules not listed
|
||||
here will be ignored and cannot be used inside the executable described by
|
||||
|
|
|
@ -418,10 +418,10 @@ module Gen(P : Params) = struct
|
|||
let build_exe ~js_of_ocaml ~flags ~dir ~requires ~name ~mode ~modules ~dep_graph
|
||||
~link_flags ~force_custom_bytecode =
|
||||
let exe_ext = Mode.exe_ext mode in
|
||||
let mode, link_flags, compiler =
|
||||
let mode, link_custom, compiler =
|
||||
match force_custom_bytecode, Context.compiler ctx mode with
|
||||
| false, Some compiler -> (mode, link_flags, compiler)
|
||||
| _ -> (Byte, "-custom" :: link_flags, ctx.ocamlc)
|
||||
| false, Some compiler -> (mode, [], compiler)
|
||||
| _ -> (Byte, ["-custom"], ctx.ocamlc)
|
||||
in
|
||||
let dep_graph = Ml_kind.Dict.get dep_graph Impl in
|
||||
let exe = Path.relative dir (name ^ exe_ext) in
|
||||
|
@ -441,13 +441,15 @@ module Gen(P : Params) = struct
|
|||
SC.add_rule sctx
|
||||
(libs_and_cm
|
||||
&&&
|
||||
Build.fanout
|
||||
(Ocaml_flags.get flags mode)
|
||||
(SC.expand_and_eval_set ~dir link_flags ~standard:[])
|
||||
>>>
|
||||
Build.run ~context:ctx
|
||||
(Dep compiler)
|
||||
[ Dyn (fun (_, flags) -> As flags)
|
||||
[ Dyn (fun (_, (flags,_)) -> As flags)
|
||||
; A "-o"; Target exe
|
||||
; As link_flags
|
||||
; Dyn (fun (_, (_, link_flags)) -> As (link_custom @ link_flags))
|
||||
; Dyn (fun ((libs, _), _) -> Lib.link_flags libs ~mode)
|
||||
; Dyn (fun ((_, cm_files), _) -> Deps cm_files)
|
||||
]);
|
||||
|
|
|
@ -635,15 +635,15 @@ module Executables = struct
|
|||
type t =
|
||||
{ names : string list
|
||||
; link_executables : bool
|
||||
; link_flags : string list
|
||||
; link_flags : Ordered_set_lang.Unexpanded.t
|
||||
; modes : Mode.Dict.Set.t
|
||||
; buildable : Buildable.t
|
||||
}
|
||||
|
||||
let common_v1 pkgs names public_names ~multi =
|
||||
Buildable.v1 >>= fun buildable ->
|
||||
field "link_executables" bool ~default:true >>= fun link_executables ->
|
||||
field "link_flags" (list string) ~default:[] >>= fun link_flags ->
|
||||
field "link_executables" bool ~default:true >>= fun link_executables ->
|
||||
field_oslu "link_flags" >>= fun link_flags ->
|
||||
map_validate (field "modes" Mode.Dict.Set.t ~default:Mode.Dict.Set.all)
|
||||
~f:(fun modes ->
|
||||
if Mode.Dict.Set.is_empty modes then
|
||||
|
|
|
@ -170,7 +170,7 @@ module Executables : sig
|
|||
type t =
|
||||
{ names : string list
|
||||
; link_executables : bool
|
||||
; link_flags : string list
|
||||
; link_flags : Ordered_set_lang.Unexpanded.t
|
||||
; modes : Mode.Dict.Set.t
|
||||
; buildable : Buildable.t
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue