Passage à dune
This commit is contained in:
9
lib/generator/stubs/c_types_generator/dune
Normal file
9
lib/generator/stubs/c_types_generator/dune
Normal file
@ -0,0 +1,9 @@
|
||||
(executable
|
||||
(name c_types_generator)
|
||||
(libraries ctypes.stubs)
|
||||
)
|
||||
|
||||
(rule
|
||||
(targets t.ml)
|
||||
(action (copy ../t.ml t.ml))
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
(executable(
|
||||
(name c_types_generator)
|
||||
(libraries (ctypes.stubs))
|
||||
))
|
||||
|
||||
(rule(
|
||||
(targets (t.ml))
|
||||
(action (copy ../t.ml t.ml))
|
||||
))
|
4
lib/generator/stubs/ctypes_cflags_generator/dune
Normal file
4
lib/generator/stubs/ctypes_cflags_generator/dune
Normal file
@ -0,0 +1,4 @@
|
||||
(executable
|
||||
(name ctypes_cflags_generator)
|
||||
(libraries findlib)
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
(executable(
|
||||
(name ctypes_cflags_generator)
|
||||
(libraries (findlib))
|
||||
))
|
36
lib/generator/stubs/dune
Normal file
36
lib/generator/stubs/dune
Normal file
@ -0,0 +1,36 @@
|
||||
(rule
|
||||
(targets my_types.ml)
|
||||
(deps my_types_generator.exe)
|
||||
(action (with-stdout-to %{targets} (run %{deps})))
|
||||
)
|
||||
|
||||
(rule
|
||||
(targets my_types_generator.exe)
|
||||
(deps my_types_generator.c)
|
||||
(action (run %{cc}
|
||||
-o %{targets}
|
||||
%{read:libusb_cflags}
|
||||
%{read:ctypes_cflags}
|
||||
-I%{ocaml-config:standard_library}
|
||||
%{deps}))
|
||||
)
|
||||
|
||||
(rule
|
||||
(targets my_types_generator.c)
|
||||
(action (with-stdout-to %{targets}
|
||||
(run c_types_generator/c_types_generator.exe)))
|
||||
)
|
||||
|
||||
(rule
|
||||
(targets ctypes_cflags)
|
||||
(action
|
||||
(with-stdout-to %{targets}
|
||||
(run ctypes_cflags_generator/ctypes_cflags_generator.exe)))
|
||||
)
|
||||
|
||||
(rule
|
||||
(targets libusb_cflags)
|
||||
(action
|
||||
(with-stdout-to %{targets}
|
||||
(run libusb_cflags_generator/libusb_cflags_generator.exe)))
|
||||
)
|
@ -1,36 +0,0 @@
|
||||
(rule(
|
||||
(targets (my_types.ml))
|
||||
(deps (my_types_generator.exe))
|
||||
(action (with-stdout-to ${@} (run ${<})))
|
||||
))
|
||||
|
||||
(rule(
|
||||
(targets (my_types_generator.exe))
|
||||
(deps (my_types_generator.c))
|
||||
(action (run ${CC}
|
||||
-o ${@}
|
||||
${read:libusb_cflags}
|
||||
${read:ctypes_cflags}
|
||||
-I${ocaml-config:standard_library}
|
||||
${<}))
|
||||
))
|
||||
|
||||
(rule(
|
||||
(targets (my_types_generator.c))
|
||||
(action
|
||||
(with-stdout-to ${@}
|
||||
(run c_types_generator/c_types_generator.exe)
|
||||
))
|
||||
))
|
||||
|
||||
(rule(
|
||||
(targets (ctypes_cflags))
|
||||
(action (with-stdout-to ${@}
|
||||
(run ctypes_cflags_generator/ctypes_cflags_generator.exe)))
|
||||
))
|
||||
|
||||
(rule(
|
||||
(targets (libusb_cflags))
|
||||
(action (with-stdout-to ${@}
|
||||
(run libusb_cflags_generator/libusb_cflags_generator.exe)))
|
||||
))
|
4
lib/generator/stubs/libusb_cflags_generator/dune
Normal file
4
lib/generator/stubs/libusb_cflags_generator/dune
Normal file
@ -0,0 +1,4 @@
|
||||
(executable
|
||||
(name libusb_cflags_generator)
|
||||
(libraries dune.configurator)
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
(executable(
|
||||
(name libusb_cflags_generator)
|
||||
(libraries (configurator))
|
||||
))
|
@ -1,11 +1,11 @@
|
||||
let (>>|) a f = match a with None -> None | Some a -> f a
|
||||
|
||||
let libusb_c_flags =
|
||||
let open Configurator in
|
||||
let open Configurator.V1 in
|
||||
create "c"
|
||||
|> Pkg_config.get
|
||||
>>| Pkg_config.query ~package:"libusb-1.0"
|
||||
>>| (fun Pkg_config.{cflags} ->
|
||||
>>| (fun Pkg_config.{cflags;_} ->
|
||||
Some (String.concat " " cflags))
|
||||
|> (function
|
||||
| None -> "libusb flag not found"
|
||||
|
Reference in New Issue
Block a user