Home

Awesome

Build Status build-with-cmake

CMake scripts for painless usage of Tim Davis' SuiteSparse (CHOLMOD,UMFPACK,AMD,LDL,SPQR,...) and METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake. The project includes precompiled BLAS/LAPACK DLLs for easy use with Visual C++. Licensed under BSD 3-Clause License.

The goal is using one single CMake code to build against SuiteSparse in standard Linux package systems (e.g. libsuitesparse-dev) and in manual compilations under Windows.

Credits: Jose Luis Blanco (Universidad de Almeria); Jerome Esnault (INRIA); @NeroBurner

logo

1. Instructions

1.2 Using OpenBLAS as alternative to generic BLAS/LAPACK

Starting with v0.3.21 OpenBLAS ships with an f2c-converted copy of LAPACK v3.9.0 which is used if no fortran compiler is available. This means we can compile OpenBLAS to provide BLAS and LAPACK functionality with a regular C++ compiler like MSVC or GCC. This includes compiling everything as a static library. If that library is later used to compile an executable the executable can run without any external dependencies (like fortran runtimes or lapack dlls in the generic fortran based BLAS and LAPACK implementation).

When building OpenBLAS yourself be sure to use BUILD_WITHOUT_LAPACK=NO and NOFORTAN=1 when configuring OpenBLAS with CMake to get a pure C++ OpenBLAS library (with the benefits described above).

To tell SuiteSparse to build against this OpenBLAS implementation set the option WITH_OPENBLAS=ON.

2. Test program

Example CMake programs are provided for testing, based on Tim Davis' code in his manual:

An example to test CUDA support can be found here.

3. Integration in your code (unique code for Windows/Linux)

4. Why did you create this project?

Porting SuiteSparse to CMake wasn't trivial because this package makes extensive usage of a one-source-multiple-objects philosophy by compiling the same sources with different compiler flags, and this ain't directly possible to CMake's design.

My workaround to this limitation includes auxiliary Python scripts and dummy source files, so the whole thing became large enough to be worth publishing online so many others may benefit.