Draft
Conversation
Signed-off-by: Arthur Wendling <arthur@tarides.com>
art-w
commented
Jan 28, 2026
| (chdir | ||
| %{workspace_root} | ||
| (run %{bin:cppo} -V OCAML:%{ocaml_version} -D "OXCAML" %{x} -o %{targets})))) | ||
|
|
Contributor
Author
There was a problem hiding this comment.
The rules duplication, here and in src/loader/dune, are rather inconvenient but I didn't find how to avoid it: cppo only accepts variables with integer values in conditionals, but dune %{ocaml-config:ox} is a boolean with no way to cast it to an int (?). I tried cppo -D "OXCAML %{ocaml-config:ox} but then the variable can't be used in #if. Please let me know if you know a better way!
80bf1f1 to
bb20ded
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(builds on top of #1398 which provides
ocaml-config:oxto detect OxCaml)This PR is a rebase of @lukemaurer 's patches from oxcaml/odoc (+ small fixes from #22). I hope this will make it easier to keep everything uptodate, and that it isn't too much of a stretch as Odoc already supports multiple versions of the OCaml AST using
cppo. (Note that the preprocessor was originally usingOCAML_VERSION=(5,2,0)as a heuristic to check for OxCaml, but since dune 3.21 we can be exact.)