add support for c_library_flags
This commit is contained in:
parent
614dbc6f6b
commit
9e4a83bf48
|
@ -24,15 +24,6 @@ type t =
|
|||
|
||||
let root t = t.root
|
||||
|
||||
let always_ignore =
|
||||
String_set.of_list
|
||||
[ ""
|
||||
; "_build"
|
||||
; ".git"
|
||||
; ".hg"
|
||||
; "_darcs"
|
||||
]
|
||||
|
||||
let ignore_file = function
|
||||
| ""
|
||||
| "_build"
|
||||
|
|
|
@ -785,7 +785,7 @@ module Gen(P : Params) = struct
|
|||
~modules
|
||||
~mode
|
||||
(String_map.keys modules)))
|
||||
(expand_and_eval_set ~dir lib.c_libraries ~standard:[])
|
||||
(expand_and_eval_set ~dir lib.c_library_flags ~standard:[])
|
||||
>>>
|
||||
Build.run (Dep compiler)
|
||||
~extra_targets:(
|
||||
|
@ -797,7 +797,7 @@ module Gen(P : Params) = struct
|
|||
; As stubs_flags
|
||||
; Dyn (fun (_, cclibs) ->
|
||||
S (List.map cclibs ~f:(fun flag ->
|
||||
Arg_spec.S [A "-cclib"; A ("-l" ^ flag)])))
|
||||
Arg_spec.S [A "-cclib"; A flag])))
|
||||
; As (List.map lib.library_flags ~f:(expand_vars ~dir))
|
||||
; As (match lib.kind with
|
||||
| Normal -> []
|
||||
|
@ -979,7 +979,7 @@ module Gen(P : Params) = struct
|
|||
| None ->
|
||||
let targets = [ stubs_archive lib ~dir; dll lib ~dir ] in
|
||||
add_rule
|
||||
(expand_and_eval_set ~dir lib.c_libraries ~standard:[]
|
||||
(expand_and_eval_set ~dir lib.c_library_flags ~standard:[]
|
||||
>>>
|
||||
Build.run
|
||||
~extra_targets:targets
|
||||
|
@ -988,8 +988,7 @@ module Gen(P : Params) = struct
|
|||
; A "-o"
|
||||
; Path (Path.relative dir (sprintf "%s_stubs" lib.name))
|
||||
; Deps o_files
|
||||
; Dyn (fun cclibs ->
|
||||
As (List.map cclibs ~f:((^) "-l")))
|
||||
; Dyn (fun cclibs -> As cclibs)
|
||||
]);
|
||||
end;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ type conf =
|
|||
|
||||
let load fn ~dir = (dir, Sexp_load.many fn Stanza.t)
|
||||
|
||||
let load ftree =
|
||||
let load () =
|
||||
let rec walk dir stanzas =
|
||||
let path = File_tree.Dir.path dir in
|
||||
let files = File_tree.Dir.files dir in
|
||||
|
|
|
@ -329,7 +329,7 @@ module Library = struct
|
|||
; cxx_names : string list
|
||||
; includes : String_with_vars.t list
|
||||
; library_flags : String_with_vars.t list
|
||||
; c_libraries : Ordered_set_lang.Unexpanded.t
|
||||
; c_library_flags : Ordered_set_lang.Unexpanded.t
|
||||
; preprocess : Preprocess_map.t
|
||||
; preprocessor_deps : Dep_conf.t list
|
||||
; self_build_stubs_archive : string option
|
||||
|
@ -358,7 +358,8 @@ module Library = struct
|
|||
; field "c_names" (list string) ~default:[]
|
||||
; field "cxx_names" (list string) ~default:[]
|
||||
; field "library_flags" (list String_with_vars.t) ~default:[]
|
||||
; field_oslu "c_libraries"
|
||||
; field "c_libraries" (list string) ~default:[]
|
||||
; field_oslu "c_library_flags"
|
||||
; field_pp "preprocess"
|
||||
; field "preprocessor_deps" (list Dep_conf.t) ~default:[]
|
||||
; field "self_build_stubs_archive" (option string) ~default:None
|
||||
|
@ -374,7 +375,8 @@ module Library = struct
|
|||
; field_osl "ocamlopt_flags"
|
||||
]
|
||||
(fun name public_name synopsis public_headers libraries ppx_runtime_libraries
|
||||
modules c_flags cxx_flags c_names cxx_names library_flags c_libraries preprocess
|
||||
modules c_flags cxx_flags c_names cxx_names library_flags c_libraries
|
||||
c_library_flags preprocess
|
||||
preprocessor_deps self_build_stubs_archive js_of_ocaml virtual_deps modes
|
||||
includes kind wrapped optional flags ocamlc_flags ocamlopt_flags ->
|
||||
{ name
|
||||
|
@ -392,7 +394,11 @@ module Library = struct
|
|||
; cxx_flags
|
||||
; includes
|
||||
; library_flags
|
||||
; c_libraries
|
||||
; c_library_flags =
|
||||
Ordered_set_lang.Unexpanded.append
|
||||
(Ordered_set_lang.Unexpanded.t
|
||||
(Sexp.To_sexp.(list string (List.map c_libraries ~f:((^) "-l")))))
|
||||
c_library_flags
|
||||
; preprocess
|
||||
; preprocessor_deps
|
||||
; self_build_stubs_archive
|
||||
|
|
|
@ -60,6 +60,8 @@ module Unexpanded = struct
|
|||
let t t = t
|
||||
let standard = standard
|
||||
|
||||
let append a b = Sexp.List [a; b]
|
||||
|
||||
let files t =
|
||||
let rec loop acc : t -> _ = function
|
||||
| Atom _ -> acc
|
||||
|
|
|
@ -19,6 +19,8 @@ module Unexpanded : sig
|
|||
val t : Sexp.t -> t
|
||||
val standard : t
|
||||
|
||||
val append : t -> t -> t
|
||||
|
||||
(** List of files needed to expand this set *)
|
||||
val files : t -> String_set.t
|
||||
|
||||
|
|
Loading…
Reference in New Issue