diff --git a/Project.toml b/Project.toml index 3dfff5e8..fe49d50e 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,7 @@ BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232" GAP = "c863536a-3901-11e9-33e7-d5cd0df7b904" Singular = "bcd08a7b-43d2-5ff7-b6d4-c458787f915c" lib4ti2_jll = "1493ae25-0f90-5c0e-a06c-8c5077d6d66f" +cddlib_jll = "f07e07eb-5685-515a-97c8-3014f6152feb" Graphviz_jll = "3c863552-8265-54e4-a6dc-903eb78fde85" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" diff --git a/deps/build.jl b/deps/build.jl index 8ec7d9fa..d43e8db7 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -9,3 +9,5 @@ for pkg in PACKAGES_TO_COMPILE GAP.Packages.install(pkg) end + +CompileCddInterface() diff --git a/deps/homalg-project.jl b/deps/homalg-project.jl index 0ef40936..39ebdd99 100644 --- a/deps/homalg-project.jl +++ b/deps/homalg-project.jl @@ -120,6 +120,7 @@ global PACKAGES_BASED_ON_CAP = [ "CategoryConstructor", "CategoriesWithAmbientObjects", "CatReps", + "CddInterface", "ComplexesCategories", "DerivedCategories", "FinSetsForCAP", @@ -175,6 +176,8 @@ end export RemoveAllPackagesFromHomalgProject + + global PACKAGES_TO_COMPILE = [ "Gauss", #"Browse", ## do not compile browse as it results into GAP raising the error "Error opening terminal: xterm-256color." @@ -186,4 +189,52 @@ global PACKAGES_TO_COMPILE = [ "orb", ] -global PACKAGES_DOWNLOADING_EXTERNAL_CODE = ["CddInterface", "NormalizInterface"] +import cddlib_jll + +function CompileCddInterface(; print_available = true, test_availability = true) + + name = "CddInterface" + + gstr = julia_to_gap( name ) + + if ( test_availability == false ) || ( GAP.Globals.TestPackageAvailability( gstr ) == GAP.Globals.fail ) + pkg = GAP.Globals.PackageInfo( gstr ) + + if GAP.Globals.Length( pkg ) == 0 + dirs = gap_to_julia(GAP.Globals.String( GAP.EvalString("List(DirectoriesLibrary(\"pkg\"), d -> Filename(d, \"\"))"))) + @warn "unable to find package named \"" * name * "\" in " * dirs + return false + end + + pkg = pkg[1] + + path = gap_to_julia( pkg.InstallationPath ) + + @info "Compiling \"" * path * "\"" + + cd(path) + + run(`./autogen.sh`) + run(`./configure --with-gaproot=$(GAP.GAPROOT) --with-cddlib=$(cddlib_jll.artifact_dir)`) + + run(`make -k -j$(Sys.CPU_THREADS)`) ## -k = Keep going when some targets can't be made. + + if GAP.Globals.TestPackageAvailability( gstr ) == GAP.Globals.fail + @warn "Compiling the package \"" * name * "\" failed." + return false + end + + @info "Compiling the package \"" * name * "\" was successful." + return true + + end + + if print_available == true + @info "Package \"" * name * "\" is already installed." + end + + return true + +end + +export CompileCddInterface diff --git a/test/cddlib.jl b/test/cddlib.jl new file mode 100644 index 00000000..a4d2e018 --- /dev/null +++ b/test/cddlib.jl @@ -0,0 +1,10 @@ +@testset "CddInterface" begin + LoadPackage("CddInterface") + C = cdd_PolyhedronByInequalities([ [ 0, 1, 0 ], [ 0, 1, -1 ] ]) + rays = Cdd_GeneratingRays( C ) + @test rays == cdd_prepare_gap_input(rays) + @test rays == GAP.Globals.List( + julia_to_gap([ [ 0, -1 ], [ 1, 1 ] ]), + julia_to_gap, + ) +end diff --git a/test/runtests.jl b/test/runtests.jl index a67a70fd..95e90f1c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,7 @@ DocMeta.setdocmeta!(HomalgProject, :DocTestSetup, :(using HomalgProject); recurs include("packages.jl") include("singular.jl") include("4ti2.jl") +include("cddlib.jl") include("digraphs.jl") include("homalg_project.jl") include("testmanual.jl")