Use Configurator.V1 in the docs as example for cstubs

Signed-off-by: Manas <prometheansacrifice@gmail.com>
This commit is contained in:
Manas 2018-09-05 15:11:48 +05:30
parent 753da98784
commit f643fea885
1 changed files with 19 additions and 19 deletions

View File

@ -207,29 +207,29 @@ as well as this ``discover.ml`` file:
.. code:: ocaml
open Base
open Stdio
module C = Configurator
let write_sexp fn sexp =
Out_channel.write_all fn ~data:(Sexp.to_string sexp)
module C = Configurator.V1
let () =
C.main ~name:"mylib" (fun c ->
let default : C.Pkg_config.package_conf =
{ libs = ["-lblah"]
; cflags = []
}
in
let conf =
match C.Pkg_config.get c with
| None -> default
| Some pc ->
Option.value (C.Pkg_config.query pc ~package:"blah") ~default
in
C.main ~name:"foo" (fun c ->
let default : C.Pkg_config.package_conf =
{ libs = ["-lgst-editing-services-1.0"]
; cflags = []
}
in
let conf =
match C.Pkg_config.get c with
| None -> default
| Some pc ->
match (C.Pkg_config.query pc ~package:"gst-editing-services-1.0") with
| None -> default
| Some deps -> deps
in
C.Flags.write_sexp "c_flags.sexp" conf.cflags;
C.Flags.write_sexp "c_library_flags.sexp" conf.libs)
write_sexp "c_flags.sexp" (sexp_of_list sexp_of_string conf.cflags);
write_sexp "c_library_flags.sexp" (sexp_of_list sexp_of_string conf.libs))
Using a custom code generator
=============================