(executable
 (name bench)
 (modules bench)
 (foreign_stubs
  (language c)
  (names mclock bs))
 (enabled_if
  (= %{profile} benchmark))
 (preprocess
  (pps ppx_deriving_yojson))
 (libraries
  bigarray-compat
  unix
  fmt
  decompress.de
  decompress.zl
  cmdliner
  yojson
  ppx_deriving_yojson))

(executable
 (name run)
 (modules run)
 (enabled_if
  (= %{profile} benchmark))
 (libraries cmdliner fpath rresult bos))

(rule
 (targets zpipe)
 (deps
  (:zpipe zpipe.c))
 (action
  (run %{cc} %{zpipe} -lz -o %{targets})))

(rule
 (targets output.csv)
 (enabled_if
  (= %{profile} benchmark))
 (deps
  (:run run.exe)
  (:zpipe zpipe)
  (:bench bench.exe))
 (action
  (chdir
   %{workspace_root}
   (run %{run} -o %{targets}))))

(library
 (name lz_landmarks)
 (optional)
 (modules lz_landmarks)
 (enabled_if
  (= %{profile} benchmark))
 (libraries bigarray-compat checkseum optint landmarks de)
 (preprocess
  (pps landmarks.ppx --auto)))

(rule
 (copy ../lib/lz.ml lz_landmarks.ml))

(rule
 (copy ../lib/lz.mli lz_landmarks.mli))

(executable
 (name lzld)
 (modules lzld)
 (enabled_if
  (= %{profile} benchmark))
 (libraries decompress.de lz_landmarks))

(library
 (name de_landmarks)
 (optional)
 (modules de_landmarks)
 (enabled_if
  (= %{profile} benchmark))
 (libraries bigarray-compat checkseum optint landmarks de)
 (flags
  (:standard -w -55))
 (preprocess
  (pps landmarks.ppx --auto)))

(rule
 (copy ../lib/de.ml de_landmarks.ml))

(rule
 (copy ../lib/de.mli de_landmarks.mli))

(executable
 (name densld)
 (modules densld)
 (enabled_if
  (= %{profile} benchmark))
 (libraries cmdliner de_landmarks bigstringaf))
