feat: package for msat-bin, with gzip input

This commit is contained in:
Simon Cruanes 2019-04-03 16:55:39 -05:00
parent 338a84bf3a
commit f199dd50a6
5 changed files with 37 additions and 3 deletions

1
dune
View file

@ -1,6 +1,7 @@
(alias (alias
(name runtest) (name runtest)
(package msat)
(deps README.md src/core/msat.cma src/sat/msat_sat.cma src/sudoku/sudoku_solve.exe) (deps README.md src/core/msat.cma src/sat/msat_sat.cma src/sudoku/sudoku_solve.exe)
(locks test) (locks test)
(action (progn (action (progn

22
msat-bin.opam Normal file
View file

@ -0,0 +1,22 @@
opam-version: "2.0"
name: "msat-bin"
synopsis: "SAT solver binary based on the msat library"
license: "Apache"
version: "0.8"
author: ["Simon Cruanes" "Guillaume Bury"]
maintainer: ["guillaume.bury@gmail.com" "simon.cruanes.2007@m4x.org"]
build: [
["dune" "build" "@install" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs]
]
depends: [
"ocaml" { >= "4.03" }
"dune" {build}
"msat" { >= "0.8" < "0.9" }
"camlzip"
]
tags: [ "sat" ]
homepage: "https://github.com/Gbury/mSAT"
dev-repo: "git+https://github.com/Gbury/mSAT.git"
bug-reports: "https://github.com/Gbury/mSAT/issues/"

View file

@ -2,8 +2,9 @@
; main binary ; main binary
(executable (executable
(name main) (name main)
;(package msat) (public_name msat)
(libraries containers msat msat_sat msat.backend) (package msat-bin)
(libraries containers camlzip msat msat.sat msat.backend)
(flags :standard -warn-error -3 -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Msat) (flags :standard -warn-error -3 -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Msat)
(ocamlopt_flags :standard -O3 -color always (ocamlopt_flags :standard -O3 -color always
-unbox-closures -unbox-closures-factor 20) -unbox-closures -unbox-closures-factor 20)

View file

@ -73,7 +73,13 @@ let parse_file f =
let module L = Lexing in let module L = Lexing in
CCIO.with_in f CCIO.with_in f
(fun ic -> (fun ic ->
let buf = L.from_channel ic in let buf =
if CCString.suffix ~suf:".gz" f
then (
let gic = Gzip.open_in_chan ic in
L.from_function (fun bytes len -> Gzip.input gic bytes 0 len)
) else L.from_channel ic
in
buf.L.lex_curr_p <- {buf.L.lex_curr_p with L.pos_fname=f;}; buf.L.lex_curr_p <- {buf.L.lex_curr_p with L.pos_fname=f;};
Dimacs_parse.file Dimacs_lex.token buf) Dimacs_parse.file Dimacs_lex.token buf)

View file

@ -9,24 +9,28 @@
(alias (alias
(name runtest) (name runtest)
(package msat)
(deps test_api.exe) (deps test_api.exe)
(locks test) (locks test)
(action (run %{deps}))) (action (run %{deps})))
(alias (alias
(name runtest) (name runtest)
(package msat)
(deps ./icnf-solve/icnf_solve.exe Makefile (source_tree regression)) (deps ./icnf-solve/icnf_solve.exe Makefile (source_tree regression))
(locks test) (locks test)
(action (run make test-icnf))) (action (run make test-icnf)))
(alias (alias
(name runtest) (name runtest)
(package msat)
(deps ./../src/sudoku/sudoku_solve.exe Makefile (source_tree sudoku)) (deps ./../src/sudoku/sudoku_solve.exe Makefile (source_tree sudoku))
(locks test) (locks test)
(action (run make test-sudoku))) (action (run make test-sudoku)))
(alias (alias
(name runtest) (name runtest)
(package msat-bin)
(deps ./../src/main/main.exe ./run (source_tree .)) (deps ./../src/main/main.exe ./run (source_tree .))
(locks test) (locks test)
(action (run /usr/bin/time -f "%e" ./run sat))) (action (run /usr/bin/time -f "%e" ./run sat)))