سؤال

I figure that oasis is a way to replace the usual autoconf toolchain for building ocaml projects, and I like that approach very much.

Unfortunately, I have to link my project against a C-library on different systems, so I need to figure out where that library actually is. On my dev system the following setup works:

Executable e2bench
  Path:    .    
  CompiledObject: best
  BuildTools: ocamlbuild
  BuildDepends: e2lang, core, core_bench
  CCLib:        -ltnp -L/home/choeger/local/lib/
  DllLib:   libtnp
  DllPath:  /home/choeger/local/lib
  MainIs: e2bench.ml

But obviously (even if I don't know why ;) ), not everybody will install the library to /home/choeger/local - so I basically need to add a flag to setup.ml that asks for the library path and sets an oasis variable accordingly (pretty much autoconf-like). How do I do that?

As a bonus question: How can I test linking against this path to provide an early bail-out (like a configure-script) instead of an ocamlbuild error?

Second bonus: How can I invoke pkg-config to achieve this?

هل كانت مفيدة؟

المحلول

I believe there is no straightforward way to do it in oasis currently, but pkg-config integration is in the works, and generic argument passing is an often-requested feature, so hopefully it will be supported one day (patches welcome!). On the other hand requiring user of the library to setup environment so that libraries are available to the linker doesn't sound overly restrictive to me, especially considering that library should be available at runtime too..

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top