Closed mmuetzel closed 5 months ago
I'm already working on a solution
I would like to do something different, by adding #cmakedefine's to cholmod.h.in, which then cmake configures to create cholmod.h.
The draft is in my paru_dev2 branch. I would have pushed it to dev2 as I usually do, but I'm in the middle of making a ParU version 1.0.0. ParU depends on CHOLMOD.
My plan is to have these configured in cholmod.h:
// These flags are configured by cmake when CHOLMOD is compiled:
#define CHOLMOD_HAS_GPL
#define CHOLMOD_HAS_CHECK
#define CHOLMOD_HAS_CHOLESKY
#define CHOLMOD_HAS_CAMD
#define CHOLMOD_HAS_PARTITION
#define CHOLMOD_HAS_MATRIXOPS
#define CHOLMOD_HAS_MODIFY
#define CHOLMOD_HAS_SUPERNODAL
#define CHOLMOD_HAS_CUDA
#define CHOLMOD_HAS_OPENMP
and also to add a run-time check:
//------------------------------------------------------------------------------
// CHOLMOD query: check for CHOLMOD configuration
//------------------------------------------------------------------------------
typedef enum
{
CHOLMOD_QUERY_HAS_GPL = 0, // has GPL licensed modules
CHOLMOD_QUERY_HAS_CHECK = 1, // has Check Module
CHOLMOD_QUERY_HAS_CHOLESKY = 2, // has Cholesky Module
CHOLMOD_QUERY_HAS_CAMD = 3, // has CAMD and CCOLAMD
CHOLMOD_QUERY_HAS_PARTITION = 4, // has Partition Module
CHOLMOD_QUERY_HAS_MATRIXOPS = 5, // has MatrixOps Module
CHOLMOD_QUERY_HAS_MODIFY = 6, // has Modify Module
CHOLMOD_QUERY_HAS_SUPERNODAL = 7, // has Supernodal Module
CHOLMOD_QUERY_HAS_CUDA = 8, // has GPU Module
CHOLMOD_QUERY_HAS_OPENMP = 9 // has OpenMP
}
cholmod_query_t ;
bool cholmod_query // true if CHOLMOD has a specific feature
(
cholmod_query_t feature
) ;
bool cholmod_l_query (cholmod_query_t feature) ;
Some preprocessor flags that are conditionally set by the build rules of CHOLMOD affect which symbols are exported from the built libraries. Add the preprocessor flags that are used to guard function declarations in
cholmod.h
to the CMake targets and the pkg-config file. That way consumers of the library get only those declarations that are actually exported from the library when includingcholmod.h
in their code.Fixes #794.
The names of these preprocessor macros are pretty generic (e.g.,
NGPL
) and might collide with symbols of the same name in other projects. It might be a good idea to rename them to something more specific (e.g.,CHOLMOD_NGPL
). But I don't know if backwards compatibility is required for those names. (Maybe better to handle a potential renaming in a different change anyway...)