diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-08-27 21:12:31 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-08-27 21:12:31 +0100 |
commit | 969e2584dbd7a45531eac6b31159f84a9d97ca72 (patch) | |
tree | f57a20958ac6f59c2c0ef1f11c1fd0958c3ff884 /cmake | |
parent | 1438514d3bf8de013aa311a6b0c6173de63c75e5 (diff) | |
download | rspamd-969e2584dbd7a45531eac6b31159f84a9d97ca72.tar.gz rspamd-969e2584dbd7a45531eac6b31159f84a9d97ca72.zip |
[Minor] Sigh, another workaround for broken blas
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Openblas.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cmake/Openblas.cmake b/cmake/Openblas.cmake index 69f065d8f..2155b2955 100644 --- a/cmake/Openblas.cmake +++ b/cmake/Openblas.cmake @@ -27,5 +27,38 @@ IF(WITH_BLAS) ELSE() ADD_COMPILE_OPTIONS(-DHAVE_CBLAS_H) ENDIF() + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sgemm.c" " +#include <stddef.h> +enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102 }; +enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112 }; +extern void cblas_sgemm(const enum CBLAS_ORDER Order, + const enum CBLAS_TRANSPOSE TA, + const enum CBLAS_TRANSPOSE TB, + const int M, const int N, const int K, + const float alpha, const float *A, const int lda, + const float *B, const int ldb, const float beta, + float *C, const int ldc); +int main(int argc, char **argv) +{ + cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 0, 0, 0, 0, NULL, 0, + NULL, 0, 0, NULL, 0); + return 0; +} +") + try_compile(HAVE_CBLAS_SGEMM + ${CMAKE_CURRENT_BINARY_DIR} + "${CMAKE_CURRENT_BINARY_DIR}/sgemm.c" + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + LINK_LIBRARIES ${BLAS_REQUIRED_LIBRARIES} + OUTPUT_VARIABLE SGEMM_ERR) + + # Cmake is just brain damaged + #CHECK_LIBRARY_EXISTS(${BLAS_REQUIRED_LIBRARIES} cblas_sgemm "" HAVE_CBLAS_SGEMM) + if(HAVE_CBLAS_SGEMM) + MESSAGE(STATUS "Blas has CBLAS sgemm") + ADD_COMPILE_OPTIONS(-DHAVE_CBLAS_SGEMM) + else() + MESSAGE(STATUS "Blas has -NOT- CBLAS sgemm, use internal workaround: ${SGEMM_ERR}") + endif() ADD_COMPILE_OPTIONS(-DHAVE_CBLAS) ENDIF(WITH_BLAS)
\ No newline at end of file |