Skip to content

Commit

Permalink
Merge pull request #148 from gruenich/feature/avoid-complex-offer-com…
Browse files Browse the repository at this point in the history
…patibility

Replace #define complex by optional typedef
  • Loading branch information
xiaoyeli authored Jul 24, 2024
2 parents 6f7ea89 + 547c316 commit f94da0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ option(enable_doc "Add target 'doc' to build Doxygen documentation" OFF)
option(enable_examples "Build examples" ON)
option(enable_fortran "Build Fortran interface" ${enable_fortran_xSDK})
option(enable_tests "Build tests" ON)
option(enable_compatibility_complex "Provide typdef 'complex' for compatibility with older SuperLU version" OFF)

include(CTest)
include(GNUInstallDirs)
Expand Down Expand Up @@ -100,6 +101,11 @@ endif()
set(SUPERLU_VERSION "${PROJECT_VERSION}")
set(SUPERLU_REV "${PROJECT_REV}")

if(enable_compatibility_complex)
add_compile_definitions(SUPERLU_TYPEDEF_COMPLEX)
endif()


#-- BLAS
option(TPL_ENABLE_INTERNAL_BLASLIB "Build the CBLAS library" ${enable_internal_blaslib})
option(TPL_BLAS_LIBRARIES "List of absolute paths to blas libraries [].")
Expand Down
6 changes: 5 additions & 1 deletion SRC/slu_scomplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ at the top-level directory.

typedef struct { float r, i; } singlecomplex;

#define complex singlecomplex // backward compatibility
#if defined(SUPERLU_TYPEDEF_COMPLEX) || DOXYGEN
//! \brief backward compatibility with older versions of SuperLU
//! Add -D enable_compatibility_complex=ON to your CMake call
typedef singlecomplex complex;
#endif

/* Macro definitions */

Expand Down

0 comments on commit f94da0c

Please sign in to comment.