Merge pull request #707 from Chris00/master

Add Configurator.V1.write_as_sexp
This commit is contained in:
Rudi Grinberg 2018-04-17 22:20:55 +07:00 committed by GitHub
commit 5a89767184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -80,6 +80,11 @@ this flag file using ``:include``:
(c_names (foo))
(c_library_flags (:include (flags.sexp)))))
For this, generate the list of flags for your library — for example
using ``Configurator.V1.Pkg_config`` — and then write them to a file,
in the above example ``flags.sexp``, with
``Configurator.V1.write_flags "flags.sexp" flags``.
Upgrading from the old Configurator
===================================

View File

@ -419,6 +419,10 @@ module Pkg_config = struct
None
end
let write_flags fname s =
let sexp = Usexp.List(List.map ~f:Usexp.atom_or_quoted_string s) in
Io.write_file fname (Usexp.to_string sexp)
let main ?(args=[]) ~name f =
let ocamlc = ref (
match Sys.getenv "DUNE_CONFIGURATOR" with

View File

@ -88,6 +88,11 @@ module Pkg_config : sig
val query : t -> package:string -> package_conf option
end with type configurator := t
val write_flags : string -> string list -> unit
(** [write_flags fname s] write the list of strings [s] to the file
[fname] in an appropriate format so that it can used in jbuild
files with "(:include [fname])". *)
(** Typical entry point for configurator programs *)
val main
: ?args:(Arg.key * Arg.spec * Arg.doc) list