Skip to content

Commit eae7b85

Browse files
committed
Add jbuild file for gpumon interface
Signed-off-by: Rob Hoes <[email protected]>
1 parent 84c7e11 commit eae7b85

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

gpumon/jbuild

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
(* -*- tuareg -*- *)
2+
#require "unix"
3+
4+
let flags = function
5+
| [] -> ""
6+
| pkgs ->
7+
let cmd = "ocamlfind ocamlc -verbose" ^ (
8+
List.fold_left (fun acc pkg -> acc ^ " -package " ^ pkg) "" pkgs
9+
) in
10+
let ic = Unix.open_process_in
11+
(cmd ^ " | grep -oEe '-ppx? (\"([^\"\\]|\\.)+\"|\\w+)'")
12+
in
13+
let rec go ic acc =
14+
try go ic (acc ^ " " ^ input_line ic) with End_of_file -> close_in ic; acc
15+
in
16+
go ic ""
17+
18+
let coverage_rewriter =
19+
let is_coverage = try Unix.getenv "BISECT_ENABLE" = "YES" with Not_found -> false in
20+
if is_coverage then
21+
"(preprocess (pps (bisect_ppx -conditional)))"
22+
else
23+
""
24+
25+
let rewriters_camlp4 = ["rpclib.idl -syntax camlp4o"]
26+
let rewriters_ppx = ["ppx_deriving_rpc"; "ppx_sexp_conv"]
27+
28+
let () = Printf.ksprintf Jbuild_plugin.V1.send {|
29+
(jbuild_version 1)
30+
31+
(library
32+
((name xapi_gpumon_interface)
33+
(public_name xcp.gpumon.interface)
34+
(modules (gpumon_interface))
35+
(flags (:standard -w -39 %s))
36+
(libraries
37+
(rpclib
38+
threads
39+
xcp))
40+
(wrapped false)
41+
%s))
42+
43+
(library
44+
((name xapi_gpumon)
45+
(public_name xcp.gpumon)
46+
(modules (:standard \ gpumon_interface))
47+
(flags (:standard -w -39-33 %s))
48+
(libraries
49+
(rpclib
50+
threads
51+
xcp
52+
xapi_gpumon_interface))
53+
(wrapped false)
54+
%s))
55+
56+
|} (flags rewriters_camlp4) coverage_rewriter (flags rewriters_ppx) coverage_rewriter

0 commit comments

Comments
 (0)