diff --git a/Project.toml b/Project.toml index 9308813..dd908bb 100644 --- a/Project.toml +++ b/Project.toml @@ -4,13 +4,12 @@ repo = "https://github.com/jump-dev/DSDP.jl.git" version = "0.1.0" [deps] -BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee" -Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +DSDP_jll = "1065e140-e56c-5613-be8b-7480bf7138df" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" [compat] -BinDeps = "1" +DSDP_jll = "0.0.1" MathOptInterface = "1" julia = "1.6" diff --git a/deps/.gitignore b/deps/.gitignore deleted file mode 100644 index 51efe72..0000000 --- a/deps/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -deps.jl -downloads/* -src/* -usr/* -build.log diff --git a/deps/apple.patch b/deps/apple.patch deleted file mode 100644 index f2b08aa..0000000 --- a/deps/apple.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- make.include -+++ make.include -@@ -48,7 +48,7 @@ CLINKER = ${CC} ${OPTFLAGS} - #CLINKER = ${CXX} ${OPTFLAGS} -static - #CLINKER = link /out:dsdp5.exe - --SH_LD = ${CC} -shared -Wl,-soname, -+SH_LD = ${CC} -shared -Wl,-install_name, - - # STEP 5: - # Location of BLAS AND LAPACK libraries. -@@ -69,7 +69,7 @@ DSDPMATLABDIR = ${DSDPROOT}/matlab - - # Location of the DSDP library - DSDPLIB = ${DSDPROOT}/lib/libdsdp.a --DSDPLIBSO = ${DSDPROOT}/lib/libdsdp.so -+DSDPLIBSO = ${DSDPROOT}/lib/libdsdp.dylib - - # Link drivers to the following libraries. - # EXAMPLE_LIBS = ${DSDPLIB} ${LAPACKBLAS} diff --git a/deps/build.jl b/deps/build.jl deleted file mode 100644 index b893811..0000000 --- a/deps/build.jl +++ /dev/null @@ -1,41 +0,0 @@ -using Libdl, BinDeps - -@BinDeps.setup - -@static if Sys.isunix() - libdsdp = library_dependency("libdsdp", aliases=["libdsdp.a", "libdsdp.so", "libdsdp.dylib"]) -end - -DSDPname = "DSDP5.8" - -provides(Sources, URI("http://www.mcs.anl.gov/hs/software/DSDP/$DSDPname.tar.gz"), - [libdsdp], os = :Unix, unpacked_dir="$DSDPname") - -patchdir=BinDeps.depsdir(libdsdp) -srcdir = joinpath(patchdir,"src",DSDPname) -libdir = joinpath(srcdir,"lib") -usrdir = BinDeps.usrdir(libdsdp) - -provides(SimpleBuild, - (@build_steps begin - GetSources(libdsdp) - CreateDirectory(joinpath(usrdir,"lib")) - @build_steps begin - ChangeDirectory(srcdir) - pipeline(`echo "DSDPROOT=$srcdir"`, stdout="make.include", append=true) - pipeline(`patch -N -p0`, stdin="$patchdir/malloc.patch") - pipeline(`patch -N -p0`, stdin="$patchdir/matlab.patch") - pipeline(`patch -N -p0`, stdin="$patchdir/g2c_1.patch") - pipeline(`patch -N -p0`, stdin="$patchdir/g2c_2.patch") - pipeline(`patch -N -p0`, stdin="$patchdir/shared.patch") - pipeline(`patch -N -p0`, stdin="$patchdir/rm.patch") - @static if Sys.isapple() - pipeline(`patch -N -p0`, stdin="$patchdir/apple.patch") - end - `make` - `make oshared` - `mv $libdir/libdsdp.$(Libdl.dlext) $usrdir/lib/libdsdp.$(Libdl.dlext)` - end - end),[libdsdp], os = :Unix) - -@BinDeps.install Dict(:libdsdp => :libdsdp) diff --git a/deps/g2c_1.patch b/deps/g2c_1.patch deleted file mode 100644 index 0677588..0000000 --- a/deps/g2c_1.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- make.include 2014-02-16 13:41:38.000000000 -0500 -+++ make.include-tmp 2014-02-16 13:43:46.000000000 -0500 -@@ -55,7 +55,7 @@ - # Not needed to compile library or matlab executable - # Needed to link DSDP library to the driver ( read SDPA files, maxcut example, ...) - # Also include the math library and other libraries needed to link the BLAS to the C files that call them. --LAPACKBLAS = -llapack -lblas -lg2c -lm -+LAPACKBLAS = -llapack -lblas -lm - #LAPACKBLAS = -L/usr/lib/ -llapack -lblas -lg2c -lm - #LAPACKBLAS = -L/home/benson/ATLAS/Linux_P4SSE2/lib -llapack -lcblas -lf77blas -latlas -lg2c -lm - #LAPACKBLAS = -L/sandbox/benson/ATLAS-3.6/lib/Linux_P4SSE2 -llapack -lcblas -lf77blas -latlas -lg2c -lm diff --git a/deps/g2c_2.patch b/deps/g2c_2.patch deleted file mode 100644 index 4fe5c63..0000000 --- a/deps/g2c_2.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- pdsdp/PLAPPACK/Makefile 2005-10-21 15:31:14.000000000 -0400 -+++ pdsdp/PLAPPACK/Makefile-tmp 2014-02-16 13:44:26.000000000 -0500 -@@ -12,7 +12,7 @@ - - OBJS = readsdpa.o pdsdpplapack.o - --LIBLAPACK = /usr/lib/liblapack.a -lblas -lg2c -lm -+LIBLAPACK = /usr/lib/liblapack.a -lblas -lm - - dsdpsdpa: ${OBJS} - ${LINKER} -o pdsdp5 ${OBJS} ${DSDPLIB} ${PLAPACKLIB} ${LIBLAPACK} diff --git a/deps/malloc.patch b/deps/malloc.patch deleted file mode 100644 index fbcb488..0000000 --- a/deps/malloc.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- src/sys/dsdploginfo.c 2005-10-21 15:31:15.000000000 -0400 -+++ src/sys/dsdploginfo.c-tmp 2014-02-16 13:45:54.000000000 -0500 -@@ -6,7 +6,6 @@ - #include - #include - #include --#include - #include "dsdpsys.h" - #include "dsdpbasictypes.h" - diff --git a/deps/matlab.patch b/deps/matlab.patch deleted file mode 100644 index af1ce7b..0000000 --- a/deps/matlab.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- Makefile 2005-10-21 15:31:14.000000000 -0400 -+++ Makefile-tmp 2014-02-16 13:43:02.000000000 -0500 -@@ -33,7 +33,6 @@ - make dsdplibrary - make example - make test -- make dmatlab - - all: - make install diff --git a/deps/rm.patch b/deps/rm.patch deleted file mode 100644 index 88ea96c..0000000 --- a/deps/rm.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- make.include -+++ make.include -@@ -82,7 +82,7 @@ EXECDIR = ${DSDPROOT}/bin/ - ARCH = ar cr - RANLIB = ranlib - #RANLIB = echo --RM = rm -f -+RM = rm -rf - MV = mv - CP = cp - diff --git a/deps/shared.patch b/deps/shared.patch deleted file mode 100644 index 1cc15a2..0000000 --- a/deps/shared.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- Makefile -+++ Makefile -@@ -54,6 +54,6 @@ oshared: - cd tmp; \ - echo "building ${DSDPLIBSO}"; \ - ${AR} x ${DSDPLIB} ;\ -- ${SH_LD} ${DSDPLIBSO} *.o -o ${DSDPLIBSO}; \ -+ ${SH_LD}${DSDPLIBSO} *.o -o ${DSDPLIBSO} ${LAPACKBLAS}; \ - cd ../ ; \ - ${RM} tmp ---- make.include -+++ make.include -@@ -43,12 +43,12 @@ DSDPCFLAGS = - - - # STEP 4. Set Linker and FLAGS: Link the DSDP library to application --CFLAGS = ${OPTFLAGS} -I. -I${DSDPROOT}/include ${DSDPCFLAGS} -+CFLAGS = ${OPTFLAGS} -I. -I${DSDPROOT}/include -fPIC ${DSDPCFLAGS} - CLINKER = ${CC} ${OPTFLAGS} - #CLINKER = ${CXX} ${OPTFLAGS} -static - #CLINKER = link /out:dsdp5.exe - --#SH_LD = ${CC} -shared -W1,-soname, -+SH_LD = ${CC} -shared -Wl,-soname, - - # STEP 5: - # Location of BLAS AND LAPACK libraries. - diff --git a/src/DSDP.jl b/src/DSDP.jl index 254fefd..b689187 100644 --- a/src/DSDP.jl +++ b/src/DSDP.jl @@ -1,17 +1,12 @@ module DSDP -using Libdl, LinearAlgebra - -if isfile(joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")) - include("../deps/deps.jl") -else - error("DSDP not properly installed. Please run Pkg.build(\"DSDP\")") -end +import DSDP_jll +using LinearAlgebra macro dsdp_ccall(f, args...) quote # QuoteNode prevents the interpretion of the symbol # and leave it as a symbol - info = ccall(($(QuoteNode(f)), libdsdp), Cint, $(esc.(args)...)) + info = ccall(($(QuoteNode(f)), DSDP_jll.libdsdp), Cint, $(esc.(args)...)) if !iszero(info) error("DSDP call $($(QuoteNode(f))) returned nonzero status $info.") end