(library
 (name heap_libc)
 (wrapped false)
 (modules)
 (foreign_stubs
  (language c)
  (names hh_shared)
  (flags
   (:standard -I../../src/third-party/lz4)))
 (c_library_flags (:include heap_libc_flags.txt))
 (preprocess
  (pps ppx_deriving.std visitors.ppx))
 (libraries lz4 utils_core))

(rule
  (target heap_libc_flags.txt)
  (enabled_if (= %{system} "linux"))
  (action (with-stdout-to %{target} (echo "(-lrt -latomic)"))))

(rule
  (target heap_libc_flags.txt)
  (enabled_if (or
    (= %{system} "cygwin")
    (= %{system} "mingw64")))
  (action (with-stdout-to %{target} (echo "(-latomic.a)"))))

(rule
  (target heap_libc_flags.txt)
  (enabled_if (and
    (<> %{system} "linux")
    (<> %{system} "cygwin")
    (<> %{system} "mingw64")))
  (action (with-stdout-to %{target} (echo "()"))))

(library
 (name heap_ident)
 (wrapped false)
 (modules ident)
 (libraries collections heap_libc)
 (preprocess
  (pps ppx_deriving.std visitors.ppx)))

(library
 (name heap_shared_mem)
 (wrapped false)
 (modules prefix sharedMem)
 (preprocess
  (pps ppx_deriving.std visitors.ppx))
 (libraries
  common_lz4
  heap_libc
  logging_common
  utils_core
  worker_cancel))

(library
 (name worker_cancel)
 (wrapped false)
 (modules workerCancel)
 (preprocess
  (pps ppx_deriving.std visitors.ppx))
 (libraries heap_libc utils_core))
