All Projects → jlblancoc → Suitesparse Metis For Windows

jlblancoc / Suitesparse Metis For Windows

Licence: bsd-3-clause
CMake scripts for painless usage of SuiteSparse+METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to Suitesparse Metis For Windows

Boost Cmake
Easy Boost integration in CMake projects
Stars: ✭ 274 (-14.91%)
Mutual labels:  cmake
Package Example
CMake: config mode of find_package command (examples)
Stars: ✭ 293 (-9.01%)
Mutual labels:  cmake
Qmplay2
QMPlay2 is a video and audio player which can play most formats and codecs.
Stars: ✭ 310 (-3.73%)
Mutual labels:  cmake
Cmrc
A Resource Compiler in a Single CMake Script
Stars: ✭ 272 (-15.53%)
Mutual labels:  cmake
S25client
Return To The Roots (Settlers II(R) Clone)
Stars: ✭ 288 (-10.56%)
Mutual labels:  cmake
Qxmpp
Cross-platform C++ XMPP client and server library
Stars: ✭ 300 (-6.83%)
Mutual labels:  cmake
Libsamplerate
An audio Sample Rate Conversion library
Stars: ✭ 267 (-17.08%)
Mutual labels:  cmake
Stuntrally
The main repository containing Stunt Rally sources and game data. A 3D racing game based on VDrift and OGRE with track editor.
Stars: ✭ 314 (-2.48%)
Mutual labels:  cmake
Log4qt
Log4Qt - Logging for the Qt cross-platform application framework
Stars: ✭ 292 (-9.32%)
Mutual labels:  cmake
Cmake Examples Chinese
快速入门CMake,通过例程学习语法。在线阅读地址:https://sfumecjf.github.io/cmake-examples-Chinese/
Stars: ✭ 298 (-7.45%)
Mutual labels:  cmake
Cleancppproject
Clean C++ project for you to use. Features: Modern CMake, CPack, Doxygen, PlantUML, Catch Unit testing, static analysis
Stars: ✭ 276 (-14.29%)
Mutual labels:  cmake
Programming learning resource
Stars: ✭ 288 (-10.56%)
Mutual labels:  cmake
Corrade
C++11/C++14 multiplatform utility library
Stars: ✭ 307 (-4.66%)
Mutual labels:  cmake
Ios Cmake
A toolchain file and examples using cmake for iOS development (this is a fork of a similar project found on code.google.com)
Stars: ✭ 275 (-14.6%)
Mutual labels:  cmake
Ultralight
Next-generation HTML renderer for apps and games
Stars: ✭ 3,585 (+1013.35%)
Mutual labels:  cmake
Torch Android
Torch-7 for Android
Stars: ✭ 270 (-16.15%)
Mutual labels:  cmake
Cmaketutorial
CMake中文实战教程
Stars: ✭ 289 (-10.25%)
Mutual labels:  cmake
Python Cmake Buildsystem
A cmake buildsystem for compiling Python
Stars: ✭ 317 (-1.55%)
Mutual labels:  cmake
Thyme
An open source re-implementation of Generals : Zero Hour written in C++.
Stars: ✭ 313 (-2.8%)
Mutual labels:  cmake
Tensorflow Cmake
Integrate TensorFlow with CMake projects effortlessly
Stars: ✭ 309 (-4.04%)
Mutual labels:  cmake

Build Status Grunt status

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) Install CMake.

  • (2) Only for Linux/Mac: Install LAPACK & BLAS. In Debian/Ubuntu: sudo apt-get install liblapack-dev libblas-dev

  • (3) Clone or download this project (latest release) and extract it somewhere in your disk, say SP_ROOT.

    • (OPTIONAL) CMake will download SuiteSparse sources automatically for you (skip to step 4), but you may do it manually if preferred:
      • Populate the directories within SP_ROOT with the original sources from each project:
        • SuiteSparse:
          • Download SuiteSparse-X.Y.Z.tar.gz from Tim Davis' webpage.
          • Extract it.
          • Merge (e.g. copy and paste from Windows Explorer) the tree SuiteSparse/* into SP_ROOT/SuiteSparse/*.
          • Make sure of looking for patches in the original webpage and apply them to prevent build errors.
        • METIS: (Optional, only if need METIS for partitioning)
          • Download metis-X.Y.Z.tar.gz.
          • Extract it.
          • Merge the tree metis-X.Y.Z/* into SP_ROOT/metis/*.
          • Add the command cmake_policy(SET CMP0022 NEW) right after the line project(METIS) in metis/CMakeLists.txt.
  • (4) Run CMake (cmake-gui), then:

    • Set the "Source code" directory to SP_ROOT
    • Set the "Build" directory to any empty directory, typically SP_ROOT/build
    • Press "Configure", change anything (if needed)
    • Important: I recommend setting the CMAKE_INSTALL_PREFIX to some other directory different than "Program Files" or "/usr/local" so the INSTALL command does not require Admin privileges. By default it will point to SP_ROOT/build/install.
    • If you have an error like: "Cannot find source file: GKlib/conf/check_thread_storage.c", then manually adjust GKLIB_PATH to the correct path SP_ROOT/metis/GKlib.
    • HAVE_COMPLEX is OFF by default to avoid errors related to complex numbers in some compilers.
    • Press "Generate".
  • (5) Compile and install:

    • In Visual Studio, open SuiteSparseProject.sln and build the INSTALL project in Debug and Release. You may get hundreds of warnings, but it's ok.
    • In Unix: Just execute make install or sudo make install if you did set the install prefix to /usr/*
  • (6) Notice that a file SuiteSparseConfig.cmake should be located in your install directory. It will be required for your programs to correctly build and link against SuiteSparse.

  • (7) Only for Windows: You will have to append CMAKE_INSTALL_PREFIX\lib*\lapack_blas_windows\ and CMAKE_INSTALL_PREFIX\lib* to the environment variable PATH before executing any program, for Windows to localize the required BLAS/Fortran libraries (.DLLs).

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)

  • Add a block like this to your CMake code (see complete example), and set the CMake variable SuiteSparse_DIR to SP_INSTALL_DIR/lib/cmake/suitesparse-5.4.0/ or the equivalent place where SuiteSparse-config.cmake was installed.

    # ------------------------------------------------------------------
    # Detect SuiteSparse libraries:
    # If not found automatically, set SuiteSparse_DIR in CMake to the
    # directory where SuiteSparse-config.cmake was installed.
    # ------------------------------------------------------------------
    find_package(SuiteSparse CONFIG REQUIRED)
    target_link_libraries(MY_PROGRAM PRIVATE ${SuiteSparse_LIBRARIES})
    
    # or directly add only the libs you need:
    target_link_libraries(MY_PROGRAM PRIVATE
      	SuiteSparse::suitesparseconfig
      	SuiteSparse::amd
      	SuiteSparse::btf
      	SuiteSparse::camd
      	SuiteSparse::ccolamd
      	SuiteSparse::colamd
      	SuiteSparse::cholmod
      	SuiteSparse::cxsparse
      	SuiteSparse::klu
      	SuiteSparse::ldl
      	SuiteSparse::umfpack
      	SuiteSparse::spqr
      	SuiteSparse::metis
      )
    
  • In Windows, if you have a CMake error like:

    Could not find a package configuration file provided by "LAPACK" with any
     of the following names:
    
       LAPACKConfig.cmake
       lapack-config.cmake
    

    set the CMake variable LAPACK_DIR to SP_ROOT/lapack_windows/x64/ (or x32 for 32bit builds).

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].