Is it possible to enable and disable preprocessors with dune actions, profiles, or dune-workspace? My use case is that I would like to use a preprocessor when I compile with dune build --profile=debug
, and not compile with the preprocessor when I use dune build
.
This works, but it causes an error message and I suspect it actually shouldn’t work at all. I also tried expanding environment variables within the preprocess stanza, but that is not allowed. In this example, we only want ppx_yojson_conv
if we are building with the debug profile.
(library
(name my_library)
(public_name my-library)
(libraries
fmt)
(preprocess
(pps
ppx_deriving.std
ppx_yojson_conv))
(enabled_if
(= %{profile} debug)))
(library
(name my_library)
(public_name my-library)
(libraries
fmt)
(preprocess
(pps ppx_deriving.std))
(enabled_if
(= %{profile} dev)))