Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(melange): allow to set compiler flags just for melange or for ocaml #6470

Closed
jchavarri opened this issue Nov 14, 2022 · 1 comment · Fixed by #6569
Closed

feature(melange): allow to set compiler flags just for melange or for ocaml #6470

jchavarri opened this issue Nov 14, 2022 · 1 comment · Fixed by #6569
Labels
melange Melange rules and generator

Comments

@jchavarri
Copy link
Collaborator

Currently, flags allow to set both OCaml and Melange flags. But if one wants to set flags for either Melange or OCaml libraries in a shared code setup, it's not possible:

  • For OCaml only flags, one can set ocamlc_flags combined with ocamlopt_flags
  • For Melange only flags, it is not possible

It would be nice to have a way to define flags conditionally, e.g. (flags (if (<> %{modes} melange) ...)). Or alternatively, leave flags only for OCaml compilation, and add a new field melange_flags.

@jchavarri jchavarri added the melange Melange rules and generator label Nov 14, 2022
@jchavarri
Copy link
Collaborator Author

Actually, the description above is not accurate.

For OCaml only flags, one can set ocamlc_flags combined with ocamlopt_flags

At the moment, Melange inherits the flags set for byte compilation (see related PR #6548). So there is no way to set flags for byte compilation without setting them for Melange as well.

I think it could be useful in the future to have this kind of ability. A way to fix this could be:

  • Add new flag melc_flags that would only apply to Melange
  • Stop inheriting flags from ocamlc_flags in Melange compilation
  • Leave flags behavior as it currently is: it would affect all melange, byte and native compilation

This should be much easier to implement than the conditionally enabled flags mentioned earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
melange Melange rules and generator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant