Skip to content

Commit

Permalink
Install headers, allow local ladspa
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Dec 4, 2020
1 parent 86d6547 commit 654e78d
Show file tree
Hide file tree
Showing 5 changed files with 632 additions and 16 deletions.
27 changes: 13 additions & 14 deletions src/config/discover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ module C = Configurator.V1

let () =
C.main ~name:"ladspa-header" (fun c ->
try
let defined =
C.C_define.import c ~includes:["ladspa.h"]
[("LADSPA_VERSION", C.C_define.Type.String)]
in
match defined with
| [("LADSPA_VERSION", C.C_define.Value.String _)] ->
C.C_define.gen_header_file c ~fname:"config.h"
[("HAS_LADSPA", C.C_define.Value.String "true")]
| _ -> assert false
with _ ->
failwith
"Cannot find ladspa.h, please install the LADSPA_SDK, or put \
ladspa.h somewhere it can be found")
let has_ladspa =
try
let defined =
C.C_define.import c ~includes:["ladspa.h"]
[("LADSPA_VERSION", C.C_define.Type.String)]
in
match defined with
| [("LADSPA_VERSION", C.C_define.Value.String _)] -> true
| _ -> false
with _ -> false
in
C.C_define.gen_header_file c ~fname:"ocaml_ladspa_config.h"
[("HAS_LADSPA", C.C_define.Value.Switch has_ladspa)])
5 changes: 3 additions & 2 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
(public_name ladspa)
(synopsis "OCaml bindings for ladspa")
(libraries unix)
(install_c_headers ladspa ocaml_ladspa_config ocaml_ladspa)
(foreign_stubs
(language c)
(names ladspa_stubs)
(extra_deps config.h)))
(extra_deps ocaml_ladspa_config.h)))

(rule
(targets config.h)
(targets ocaml_ladspa_config.h)
(action
(run ./config/discover.exe)))
Loading

0 comments on commit 654e78d

Please sign in to comment.