From 4bea74ef933a369c4cc8886f1d658754e42cfa23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Thu, 5 Sep 2024 17:29:49 +0200 Subject: [PATCH] Update to Dune 2.0 --- dune-project | 2 +- mccs.opam | 2 +- src/dune | 25 +++--- src/glpk/dune | 194 +++++++++++++++++++++++----------------------- test/dune | 4 +- test/dune.inc | 7 +- test/gen_tests.ml | 7 +- test/mccs_test.ml | 2 +- 8 files changed, 125 insertions(+), 118 deletions(-) diff --git a/dune-project b/dune-project index 14ec411..3c4561a 100644 --- a/dune-project +++ b/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.0) +(lang dune 2.0) (name mccs) diff --git a/mccs.opam b/mccs.opam index 7523470..d056d93 100644 --- a/mccs.opam +++ b/mccs.opam @@ -17,7 +17,7 @@ homepage: "https://www.i3s.unice.fr/~cpjm/misc/" bug-reports: "https://github.com/ocaml-opam/ocaml-mccs/issues" depends: [ "ocaml" {>= "4.02"} - "dune" {>= "1.0"} + "dune" {>= "2.0"} "cudf" {>= "0.7"} "conf-c++" {build} ] diff --git a/src/dune b/src/dune index 360ab22..840d1c2 100644 --- a/src/dune +++ b/src/dune @@ -1,13 +1,15 @@ (library (name mccs) - (cxx_names changed_criteria constraint_generation count_criteria + (foreign_stubs + (language cxx) + (names changed_criteria constraint_generation count_criteria cudf_reductions cudf_tools glpk_solver lp_solver lexagregate_combiner new_criteria notuptodate_criteria removed_criteria mccscudf mccs_stubs) + (flags + :standard + (:include cxxflags.sexp))) (public_name mccs) (modules :standard \ context_flags) - (cxx_flags - :standard - (:include cxxflags.sexp)) (c_library_flags :standard (:include clibs.sexp)) @@ -20,16 +22,19 @@ (select config.h from - (mccs.glpk.internal -> config_internal.h) - (mccs.glpk.shared -> config_external.h) - (mccs.glpk.static -> config_external.h) - (-> _)))) + (mccs.glpk.internal -> config.internal.h) + (mccs.glpk.shared -> config.external.h) + (mccs.glpk.static -> config.external.h) + (_ -> config.empty.h)))) + +(rule + (with-stdout-to config.internal.h (echo "#include \"glpk/glpk.h\""))) (rule - (with-stdout-to config_internal.h (echo "#include \"glpk/glpk.h\""))) + (with-stdout-to config.external.h (echo "#include "))) (rule - (with-stdout-to config_external.h (echo "#include "))) + (with-stdout-to config.empty.h (echo ""))) (executable (name context_flags) diff --git a/src/glpk/dune b/src/glpk/dune index a5dd271..819e757 100644 --- a/src/glpk/dune +++ b/src/glpk/dune @@ -2,102 +2,104 @@ (name mccs_glpk) (public_name mccs.glpk.internal) (modules ocaml_mccs_glpk) - (c_names ; Core GLPK - ; draft - bfd - glpapi06 - glpapi09 - glpapi10 - glpapi12 - glpapi13 - glpios01 - glpios02 - glpios03 - glpios07 - glpios09 - glpios11 - glpios12 - glpscl - ; api - advbas - cpxbas - prob1 - prob2 - prob4 - prob5 -;; wrmip - ; bflib - btf - btfint - fhv - fhvint - fvs - ifu - luf - lufint - scf - scfint - sgf - sva - ; intopt - cfg - cfg1 - cfg2 - clqcut - covgen - fpump - gmicut - gmigen - mirgen - spv - ; env - alloc - dlsup - env - error - stdc - stdout -;; stream - time - tls - ; misc - avl - dmp - gcd - jd - ks - mc13d - mc21a - mt1 - rng - rng1 - round2n - triang - wclique - wclique1 - ; npp - npp1 - npp2 - npp3 - npp4 - npp5 - ; proxy - proxy - proxy1 - ; simplex - spxat - spxchuzc - spxchuzr - spxlp - spxnt - spxprim - spxprob - spychuzc - spychuzr - spydual) - (c_flags - :standard - (:include cflags.sexp)) + (foreign_stubs + (language c) + (names ; Core GLPK + ; draft + bfd + glpapi06 + glpapi09 + glpapi10 + glpapi12 + glpapi13 + glpios01 + glpios02 + glpios03 + glpios07 + glpios09 + glpios11 + glpios12 + glpscl + ; api + advbas + cpxbas + prob1 + prob2 + prob4 + prob5 +;; wrmip + ; bflib + btf + btfint + fhv + fhvint + fvs + ifu + luf + lufint + scf + scfint + sgf + sva + ; intopt + cfg + cfg1 + cfg2 + clqcut + covgen + fpump + gmicut + gmigen + mirgen + spv + ; env + alloc + dlsup + env + error + stdc + stdout +;; stream + time + tls + ; misc + avl + dmp + gcd + jd + ks + mc13d + mc21a + mt1 + rng + rng1 + round2n + triang + wclique + wclique1 + ; npp + npp1 + npp2 + npp3 + npp4 + npp5 + ; proxy + proxy + proxy1 + ; simplex + spxat + spxchuzc + spxchuzr + spxlp + spxnt + spxprim + spxprob + spychuzc + spychuzr + spydual) + (flags + :standard + (:include cflags.sexp))) (wrapped false)) (copy_files# api/*.{c,h}) diff --git a/test/dune b/test/dune index 95e1480..02db989 100644 --- a/test/dune +++ b/test/dune @@ -18,7 +18,7 @@ %{targets} (run ocaml gen_tests.ml)))) -(alias - (name settests) +(rule + (alias settests) (action (diff dune.inc dune.inc.gen))) diff --git a/test/dune.inc b/test/dune.inc index 07ed262..b91df42 100644 --- a/test/dune.inc +++ b/test/dune.inc @@ -1,11 +1,10 @@ -; This file is generated using `MCCS_BACKENDS=jbuilder build @settests --auto-promote` - +; This file is generated using `MCCS_BACKENDS='GLPK' dune build @settests --auto-promote` (rule (with-stdout-to test-glpk.result (run %{exe:mccs_test.exe} %{dep:test.cudf}))) (rule (with-stdout-to test.glpk.reference (cat %{dep:test.output}))) -(alias - (name runtest) +(rule + (alias runtest) (action (system "diff %{dep:test-glpk.result} %{dep:test.glpk.reference}"))) diff --git a/test/gen_tests.ml b/test/gen_tests.ml index 4cfbc0e..fd2ea90 100644 --- a/test/gen_tests.ml +++ b/test/gen_tests.ml @@ -47,12 +47,13 @@ let test name ?solver ?ignore ?(ref="") () = in Printf.printf " -(alias - (name runtest) +(rule + (alias runtest) (action (system \"diff %s%%{dep:test-%s.result} %%{dep:test.%s.reference}\")))\n" ignore_eol name name let () = - print_endline "; This file is generated using `MCCS_BACKENDS=jbuilder build @settests --auto-promote`"; + Printf.printf "; This file is generated using `MCCS_BACKENDS='%s' dune build @settests --auto-promote`" + (String.concat " " backends); let () = try let lp_solver = Sys.getenv "MCCS_LPSOLVER" |> Printf.sprintf "%S" in diff --git a/test/mccs_test.ml b/test/mccs_test.ml index 370e4c6..2703fac 100644 --- a/test/mccs_test.ml +++ b/test/mccs_test.ml @@ -1,6 +1,6 @@ (* usage: mccs_test CUDF_FILE [SOLVER [CRITERIA]] *) -let (preamble, universe, request) as cudf = +let (_preamble, _universe, _request) as cudf = match Cudf_parser.load_from_file Sys.argv.(1) with | Some a, b, Some c -> a, b, c | None, b, Some c -> Cudf.default_preamble, b, c