Revision 85aa0c56d081163880171c15481b7436a083afcd authored by Cedric Cellier on 18 February 2013, 21:24:29 UTC, committed by Cedric Cellier on 18 February 2013, 21:24:29 UTC
When linking statically against parmap, one need to link with
parmap_stubs library (since it's not recorded in the cma itself).
Findlib can automatically add the required -cclib option.
1 parent 7596fdc
Raw File
myocamlbuild.ml
open Ocamlbuild_plugin ;;

let _ = dispatch begin function
  | After_rules ->
      dep  ["compile"; "c"] ["config.h"];
      (* flag ["ocaml"; "compile"] & S[A"-ccopt"; A"-O9"]; *)
      flag ["compile"; "c"] & S[ A"-ccopt"; A"-D_GNU_SOURCE"; A"-ccopt"; A"-fPIC" ];

      flag ["link"; "library"; "ocaml"; "byte"; "use_libparmap"] &
        S[A"-dllib"; A"-lparmap_stubs";];
      flag ["link"; "library"; "ocaml"; "native"; "use_libparmap"] &
          S[A"-cclib"; A"-lparmap_stubs"];
      dep ["link"; "ocaml"; "use_libparmap"] ["libparmap_stubs.a"];
      flag ["link"; "ocaml"; "link_libparmap"] (A"libparmap_stubs.a");

  | _ -> ()
end
back to top