Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 532

How to specify flags in dune that is conditional on c compilers and platforms?

$
0
0

It may be a trivial question, but I can’t figure out how to write it, after reading a dune document and trial and error for a while.

e.g. I have a dune like this (simplified from torch/src/wrapper/dune, for this issue)

(library
 (foreign_stubs
  (language cxx)
  (names torch_api)
 (name torch_core)
 (public_name torch.core)
 (c_library_flags :standard -lstdc++)
 (flags
  :standard
  (:include flags.sexp))
 (libraries ctypes.foreign ctypes torch_bindings))

I want to add in the flags saying if using GCC, add a flag -Wincompatible-pointer-types and if using clang, add a flag -Wno-error=incompatible-function-pointer-types. One example on conditioning on platform e.g. macos or linux will also be helpful.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 532

Trending Articles