Skip to content

Commit

Permalink
Properly upgrade Dependencies
Browse files Browse the repository at this point in the history
1. Fixes: Broken Linux Build
2. Added: Support for OSX build of dependencies
3. Merges from official Repo.
  • Loading branch information
souvikdas95 committed Jul 7, 2017
1 parent b9378d7 commit bd110a8
Show file tree
Hide file tree
Showing 100 changed files with 35,727 additions and 857 deletions.
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,37 @@

# Configuration of make process in ecos.mk
include ecos.mk
CFLAGS += -Iinclude -Iexternal/ldl/include -Iexternal/amd/include -Iexternal/SuiteSparse_config
CFLAGS += -Iinclude -Iexternal/ldl/Include -Iexternal/amd/Include -Iexternal/SuiteSparse_config
TEST_INCLUDES = -Itest -Itest/generated

# Compile all C code, including the C-callable routine
.PHONY: all
all: libecos.a libecos_bb.a runecos runecosexp

# build Tim Davis' SuiteSparse_config package
$(SuiteSparse_config):
( cd external/SuiteSparse_config ; $(MAKE) static )
$(AR) -x external/SuiteSparse_config/libsuitesparseconfig.a

# build Tim Davis' sparse LDL package
$(LDL):
( cd external/ldl ; $(MAKE) )
$(AR) -x external/ldl/libldl.a
( cd external/ldl ; $(MAKE) static )
$(AR) -x external/ldl/Lib/libldl.a

# build Tim Davis' AMD package
$(AMD):
( cd external/amd ; $(MAKE) )
$(AR) -x external/amd/libamd.a
( cd external/amd ; $(MAKE) static )
$(AR) -x external/amd/Lib/libamd.a

# build ECOS
ECOS_OBJS = ecos.o kkt.o cone.o spla.o ctrlc.o timer.o preproc.o splamm.o equil.o expcone.o wright_omega.o
libecos.a: $(ECOS_OBJS) $(LDL) $(AMD)
libecos.a: $(ECOS_OBJS) $(SuiteSparse_config) $(LDL) $(AMD)
$(ARCHIVE) $@ $^
- $(RANLIB) $@

# build ECOS branch-and-bound
ECOS_BB_OBJS = $(ECOS_OBJS) ecos_bb_preproc.o ecos_bb.o
libecos_bb.a: $(ECOS_BB_OBJS) $(LDL) $(AMD)
libecos_bb.a: $(ECOS_BB_OBJS) $(SuiteSparse_config) $(LDL) $(AMD)
$(ARCHIVE) $@ $^
- $(RANLIB) $@

Expand Down Expand Up @@ -69,7 +74,7 @@ runecosexp: src/runecos_exp.c libecos.a
# Shared library
.PHONY: shared
shared: $(SHAREDNAME)
$(SHAREDNAME): $(LDL) $(AMD) $(ECOS_OBJS)
$(SHAREDNAME): $(SuiteSparse_config) $(LDL) $(AMD) $(ECOS_OBJS)
$(CC) $(CFLAGS) -shared -o $@ $^ $(LDFLAGS)

# ECOS tester
Expand All @@ -92,13 +97,15 @@ ecos_bb_test: test/bb_test.c libecos_bb.a
# remove object files, but keep the compiled programs and library archives
.PHONY: clean
clean:
( cd external/SuiteSparse_config ; $(MAKE) clean )
( cd external/ldl ; $(MAKE) clean )
( cd external/amd ; $(MAKE) clean )
- $(RM) $(CLEAN)

# clean, and then remove compiled programs and library archives
.PHONY: purge
purge: clean
( cd external/SuiteSparse_config ; $(MAKE) purge )
( cd external/ldl ; $(MAKE) purge )
( cd external/amd ; $(MAKE) purge )
- $(RM) libecos.a libecos_bb.a runecos runecosexp
2 changes: 2 additions & 0 deletions ecos.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ USE_LONG = 1
CFLAGS += -O2 -Wall -DCTRLC=1 -Wextra -fPIC #-ansi -Werror #-ipo
ifdef USE_LONG
CFLAGS += -DLDL_LONG -DDLONG
SuiteSparse_config = SuiteSparse_config.o
LDL = ldll.o
AMD = amd_l*.o amd_global.o
else
CFLAGS +=
SuiteSparse_config = SuiteSparse_config.o
LDL = ldl.o
AMD = amd_i*.o amd_global.o
endif
Expand Down
70 changes: 70 additions & 0 deletions external/SuiteSparse_config/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#-------------------------------------------------------------------------------
# SuiteSparse_config Makefile
#-------------------------------------------------------------------------------

SUITESPARSE ?= $(realpath $(CURDIR)/..)
export SUITESPARSE

# version of SuiteSparse_config is also version of SuiteSparse meta-package
LIBRARY = libsuitesparseconfig
VERSION = 4.5.5
SO_VERSION = 4

default: library

include SuiteSparse_config.mk

ccode: all

all: library

# compile and install in SuiteSparse/lib
library: $(AR_TARGET)
$(MAKE) install INSTALL=$(SUITESPARSE)

OBJ = SuiteSparse_config.o

SuiteSparse_config.o: SuiteSparse_config.c SuiteSparse_config.h
$(CC) $(CF) -c SuiteSparse_config.c

static: $(AR_TARGET)

$(AR_TARGET): $(OBJ)
$(ARCHIVE) $(AR_TARGET) SuiteSparse_config.o
$(RANLIB) $(AR_TARGET)

distclean: purge

purge: clean
- $(RM) -r $(PURGE)

clean:
- $(RM) -r $(CLEAN)

# install SuiteSparse_config
install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET)

$(INSTALL_LIB)/$(SO_TARGET): $(OBJ)
@mkdir -p $(INSTALL_LIB)
@mkdir -p $(INSTALL_INCLUDE)
@mkdir -p $(INSTALL_DOC)
$(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS)
( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) )
( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) )
$(CP) SuiteSparse_config.h $(INSTALL_INCLUDE)
$(CP) README.txt $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt
chmod 755 $(INSTALL_LIB)/$(SO_TARGET)
chmod 755 $(INSTALL_LIB)/$(SO_PLAIN)
chmod 644 $(INSTALL_INCLUDE)/SuiteSparse_config.h
chmod 644 $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt

# uninstall SuiteSparse_config
uninstall:
$(RM) $(INSTALL_LIB)/$(SO_TARGET)
$(RM) $(INSTALL_LIB)/$(SO_PLAIN)
$(RM) $(INSTALL_LIB)/$(SO_MAIN)
$(RM) $(INSTALL_INCLUDE)/SuiteSparse_config.h
$(RM) $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt
( cd xerbla ; $(MAKE) uninstall )


51 changes: 51 additions & 0 deletions external/SuiteSparse_config/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
SuiteSparse_config, 2017, Timothy A. Davis, http://www.suitesparse.com
(formerly the UFconfig package)

This directory contains a default SuiteSparse_config.mk file. It tries to
detect your system (Linux, SunOS, or Mac), which compiler to use (icc or cc),
which BLAS and LAPACK library to use (OpenBLAS or MKL), and whether or not to
compile with CUDA.

For alternatives, see the comments in the SuiteSparse_config.mk file.

License: No licensing restrictions apply to this file or to the
SuiteSparse_config directory.

--------------------------------------------------------------------------------

SuiteSparse_config contains configuration settings for all many of the software
packages that I develop or co-author. Note that older versions of some of
these packages do not require SuiteSparse_config.

Package Description
------- -----------
AMD approximate minimum degree ordering
CAMD constrained AMD
COLAMD column approximate minimum degree ordering
CCOLAMD constrained approximate minimum degree ordering
UMFPACK sparse LU factorization, with the BLAS
CXSparse int/long/real/complex version of CSparse
CHOLMOD sparse Cholesky factorization, update/downdate
KLU sparse LU factorization, BLAS-free
BTF permutation to block triangular form
LDL concise sparse LDL'
LPDASA LP Dual Active Set Algorithm
RBio read/write files in Rutherford/Boeing format
SPQR sparse QR factorization (full name: SuiteSparseQR)

SuiteSparse_config is not required by these packages:

CSparse a Concise Sparse matrix package
MATLAB_Tools toolboxes for use in MATLAB

In addition, the xerbla/ directory contains Fortan and C versions of the
BLAS/LAPACK xerbla routine, which is called when an invalid input is passed to
the BLAS or LAPACK. The xerbla provided here does not print any message, so
the entire Fortran I/O library does not need to be linked into a C application.
Most versions of the BLAS contain xerbla, but those from K. Goto do not. Use
this if you need too.

If you edit this directory (SuiteSparse_config.mk in particular) then you
must do "make purge ; make" in the parent directory to recompile all of
SuiteSparse. Otherwise, the changes will not necessarily be applied.

Loading

0 comments on commit bd110a8

Please sign in to comment.