package dune-build-info

  1. Overview
  2. Docs
Embed build information inside executable

Install

dune-project
 Dependency

Authors

Maintainers

Sources

dune-3.23.0.tbz
sha256=e92987ffe4bc7956b18b2251b0f9844d55dfa387035ce60a3f0fd5ac4e2617d4
sha512=ef42c7ac24f300c00c429ea0e7e152bb46f7bbb1e81cf1dad225c4f41598f744b83d404a8ac949c2da074288f5560c8770421ba474a5751a20090b2f9cfa2435

doc/index.html

dune-build-info - access information generated at build time.

Introduction

This library exposes some functions to query pieces of information generated at build time, in particular:

  • the version of the project being built. You can use dune-build-info to implement a --version flag.
  • the list of libraries an executable is linked against. You can use dune-build-info to write a --build-info flag that will display a software bill of materials listing the libraries used to build an executable.

Example

This displays the version number and the libraries the executable is statically linked with:

  let version_string v =
    match Build_info.V1.version v with
    | None -> "n/a"
    | Some v -> Build_info.V1.Version.to_string v
  in
  let version = Build_info.V1.version ();
  Printf.printf "version: %s\n" (version_string version);
  let libs = Build_info.V1.Statically_linked_libraries.to_list () in
  Printf.printf "statically linked libraries:\n";
  List.iter
    (fun lib ->
       let name = Build_info.V1.Statically_linked_library.name lib in
       let version = Build_info.V1.Statically_linked_library.version lib in
       Printf.printf "- %s (%s)\n" name (version_string version)
    ) libs

API documentation

The entry point for this library is Build_info.V1.