Commit 98d9703d authored by Davis King's avatar Davis King

Fixed cblas conflicts in some environments.

parent 4c816be0
...@@ -3,7 +3,17 @@ ...@@ -3,7 +3,17 @@
#ifndef DLIB_CBLAS_CONSTAnTS_Hh_ #ifndef DLIB_CBLAS_CONSTAnTS_Hh_
#define DLIB_CBLAS_CONSTAnTS_Hh_ #define DLIB_CBLAS_CONSTAnTS_Hh_
#ifndef CBLAS_H #if !(defined(__GSL_CBLAS_H__) || defined(CBLAS_H))
// Setting this tells other headers to define their own copy of the cblas API so we can
// call it. We only do this if some other cblas API hasn't already been included.
#define DLIB_DEFINE_CBLAS_API
#ifndef CBLAS_INT_TYPE
#define CBLAS_INT_TYPE int
#endif
namespace dlib namespace dlib
{ {
namespace blas_bindings namespace blas_bindings
...@@ -16,7 +26,7 @@ namespace dlib ...@@ -16,7 +26,7 @@ namespace dlib
} }
} }
#endif // if not CBLAS_H #endif
#endif // DLIB_CBLAS_CONSTAnTS_Hh_ #endif // DLIB_CBLAS_CONSTAnTS_Hh_
...@@ -46,12 +46,9 @@ namespace dlib ...@@ -46,12 +46,9 @@ namespace dlib
#define DLIB_TEST_BLAS_BINDING_SCAL #define DLIB_TEST_BLAS_BINDING_SCAL
#endif #endif
#ifndef CBLAS_H #ifdef DLIB_DEFINE_CBLAS_API
extern "C" extern "C"
{ {
#ifndef CBLAS_INT_TYPE
#define CBLAS_INT_TYPE int
#endif
// Here we declare the prototypes for the CBLAS calls used by the BLAS bindings below // Here we declare the prototypes for the CBLAS calls used by the BLAS bindings below
void cblas_saxpy(const CBLAS_INT_TYPE N, const float alpha, const float *X, void cblas_saxpy(const CBLAS_INT_TYPE N, const float alpha, const float *X,
...@@ -139,7 +136,7 @@ namespace dlib ...@@ -139,7 +136,7 @@ namespace dlib
const void *alpha, const void *X, const CBLAS_INT_TYPE incX, const void *alpha, const void *X, const CBLAS_INT_TYPE incX,
const void *Y, const CBLAS_INT_TYPE incY, void *A, const CBLAS_INT_TYPE lda); const void *Y, const CBLAS_INT_TYPE incY, void *A, const CBLAS_INT_TYPE lda);
} }
#endif // if not CBLAS_H #endif // if DLIB_DEFINE_CBLAS_API
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
...@@ -10,11 +10,7 @@ namespace dlib ...@@ -10,11 +10,7 @@ namespace dlib
namespace blas_bindings namespace blas_bindings
{ {
#ifdef DLIB_USE_BLAS #ifdef DLIB_USE_BLAS
#ifndef CBLAS_H #ifdef DLIB_DEFINE_CBLAS_API
#ifndef CBLAS_INT_TYPE
#define CBLAS_INT_TYPE int
#endif
extern "C" extern "C"
{ {
void cblas_strsm(const CBLAS_ORDER Order, const CBLAS_SIDE Side, void cblas_strsm(const CBLAS_ORDER Order, const CBLAS_SIDE Side,
...@@ -29,7 +25,7 @@ namespace dlib ...@@ -29,7 +25,7 @@ namespace dlib
const double alpha, const double *A, const CBLAS_INT_TYPE lda, const double alpha, const double *A, const CBLAS_INT_TYPE lda,
double *B, const CBLAS_INT_TYPE ldb); double *B, const CBLAS_INT_TYPE ldb);
} }
#endif // if not CBLAS_H #endif // if DLIB_DEFINE_CBLAS_API
#endif // if DLIB_USE_BLAS #endif // if DLIB_USE_BLAS
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment