Skip to content

Commit

Permalink
Merge pull request #1224 from prometheansacrifice/docs-configurator-v…
Browse files Browse the repository at this point in the history
…1-example

Use Configurator.V1 in the docs as example for cstubs
  • Loading branch information
rgrinberg authored Sep 5, 2018
2 parents 753da98 + f643fea commit c08f39a
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions doc/quick-start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
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))
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)
Using a custom code generator
=============================
Expand Down

0 comments on commit c08f39a

Please sign in to comment.