Skip to content

obazl/llvm_ocaml_sdk

Repository files navigation

ocaml-llvm

Warning
Experimental. Used solely for developing a Bazel build of the bindings.

This is not a fork; the source in this repo was copied from the llvm-project, so it is not kept up to date. The subdirectories of llvm/bindings/ocaml are under lib/.

See branch llvm/15.0.7 for the most recent code.

Note
Status as of Sept 22, 2023: each subdir in src/ has a BUILD.bazel file; most targets build on MacOS 13.5.2. Not tested on Linux yet. Will not work for you - the build depends on the configuration of my local workstation, because some of the elements (such as Bazel/OPAM integration) involved are still under development. I expect to publish the stuff in the next few weeks, at which point I’ll add more detailed information here; until then, you’ll have to settle for reading the (Bazel) code, which fortunately is very simple.

testing

No testsuite atm, only a simple build test targets that verify the builds succeed:

$ bazel test test

(in test/BUILD.bazel)

resources

Pointers Opaque, Pointers Naked "Contributing to the OCaml bindings to LLVM" (March 6, 2023)

rules_ocaml - latest is on the 'dev' branch.

coswitch will give you some idea of how OPAM/Bazel integration is achieved.

grailbio/bazel-toolchain is a Bazel module that constructs Bazel toolchains for pre-compiled llvm compilers (which it downloads). This is what is used by this repo.

The llvm-project supports Bazel builds via unofficial Bazel code at llvm-project/tree/main/utils/bazel. I have not worked with this.

llvm-bazel is an obsolete project, superceded by the above, but possibly still of interest.