@@ -382,6 +382,31 @@ module Context = struct
382382 ;;
383383 end
384384
385+ module Cms_cmt_dependency = struct
386+ type t =
387+ | No_dependency
388+ | Depends_on_cms
389+ | Depends_on_cmt
390+
391+ let equal x y =
392+ match x, y with
393+ | No_dependency , No_dependency
394+ | Depends_on_cms , Depends_on_cms
395+ | Depends_on_cmt , Depends_on_cmt -> true
396+ | (No_dependency | Depends_on_cms | Depends_on_cmt ), _ -> false
397+ ;;
398+
399+ let to_dyn : t -> Dyn.t = function
400+ | No_dependency -> String " none"
401+ | Depends_on_cms -> String " cms"
402+ | Depends_on_cmt -> String " cmt"
403+ ;;
404+
405+ let decode =
406+ enum [ " none" , No_dependency ; " cms" , Depends_on_cms ; " cmt" , Depends_on_cmt ]
407+ ;;
408+ end
409+
385410 module Common = struct
386411 type t =
387412 { loc : Loc .t
@@ -396,6 +421,7 @@ module Context = struct
396421 ; dynamically_linked_foreign_archives : bool
397422 ; instrument_with : Lib_name .t list
398423 ; merlin : Merlin .t
424+ ; cms_cmt_dependency : Cms_cmt_dependency .t
399425 }
400426
401427 let to_dyn { name; targets; host_context; _ } =
@@ -419,6 +445,7 @@ module Context = struct
419445 ; dynamically_linked_foreign_archives
420446 ; instrument_with
421447 ; merlin
448+ ; cms_cmt_dependency
422449 }
423450 t
424451 =
@@ -435,6 +462,7 @@ module Context = struct
435462 t.dynamically_linked_foreign_archives
436463 && List. equal Lib_name. equal instrument_with t.instrument_with
437464 && Merlin. equal merlin t.merlin
465+ && Cms_cmt_dependency. equal cms_cmt_dependency t.cms_cmt_dependency
438466 ;;
439467
440468 let fdo_suffix t =
@@ -505,6 +533,12 @@ module Context = struct
505533 field_b
506534 ~check: (Dune_lang.Syntax. since Stanza. syntax (3 , 16 ))
507535 " generate_merlin_rules"
536+ and + cms_cmt_dependency =
537+ field
538+ " cms-cmt-dependency"
539+ ~default: Cms_cmt_dependency. No_dependency
540+ (Dune_lang.Syntax. since Dune_lang.Oxcaml. syntax (0 , 1 )
541+ >>> Cms_cmt_dependency. decode)
508542 in
509543 fun ~profile_default ~instrument_with_default ->
510544 let profile = Option. value profile ~default: profile_default in
@@ -537,6 +571,7 @@ module Context = struct
537571 (match generate_merlin_rules with
538572 | true -> Rules_only
539573 | false -> Not_selected ))
574+ ; cms_cmt_dependency
540575 }
541576 ;;
542577 end
@@ -708,6 +743,7 @@ module Context = struct
708743 ; dynamically_linked_foreign_archives = true
709744 ; instrument_with = Option. value instrument_with ~default: []
710745 ; merlin = Not_selected
746+ ; cms_cmt_dependency = Cms_cmt_dependency. No_dependency
711747 }
712748 }
713749 ;;
0 commit comments