File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed
Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ set(XTENSOR_BLAS_INCLUDE_DIR ${INCLUDE_DIR})
2121set (XTENSOR_BLAS_CLING_LIBRARY_DIR_64 "\" ${CMAKE_INSTALL_PREFIX} /lib64\" " )
2222set (XTENSOR_BLAS_CLING_LIBRARY_DIR_32 "\" ${CMAKE_INSTALL_PREFIX} /lib32\" " )
2323set (XTENSOR_BLAS_CLING_LIBRARY_DIR "\" ${CMAKE_INSTALL_PREFIX} /lib\" " )
24+ if (EMSCRIPTEN)
25+ set (OPENBLAS_CPPINTEROP_LIBRARY_PATH "\" /lib/${CMAKE_SHARED_LIBRARY_PREFIX} openblas${CMAKE_SHARED_LIBRARY_SUFFIX} \" " )
26+ message (STATUS "OPENBLAS_CPPINTEROP_LIBRARY_PATH = ${OPENBLAS_CPPINTEROP_LIBRARY_PATH} " )
27+ endif ()
2428
2529configure_file (
2630 "${INCLUDE_DIR} /xtensor-blas/xblas_config_cling.hpp.in"
@@ -86,7 +90,7 @@ OPTION(XTENSOR_USE_FLENS_BLAS "use FLENS generic implementation instead of cblas
8690# If that is not the case, one can pass OpenBLAS_DIR without the boolean
8791# toggle.
8892OPTION (USE_OPENBLAS "use OpenBLAS (requires suitable OpenBLASConfig.cmake)" OFF )
89- if (OpenBLAS_DIR)
93+ if (OpenBLAS_DIR OR EMSCRIPTEN )
9094 set (USE_OPENBLAS ON )
9195endif ()
9296
Original file line number Diff line number Diff line change 3030#include " xtensor-blas/xblas_config_cling.hpp"
3131#endif
3232
33+ #if defined(__CLANG_REPL__) && defined(__EMSCRIPTEN__)
34+ #include " xtensor-blas/xblas_config_cling.hpp"
35+ #endif
36+
3337namespace xt
3438{
3539 using blas_index_t = BLAS_IDX;
Original file line number Diff line number Diff line change 1010#ifndef XBLAS_CONFIG_CLING_HPP
1111#define XBLAS_CONFIG_CLING_HPP
1212
13- #pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR_64@)
14- #pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR_32@)
15- #pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR@)
16-
1713#ifndef XTENSOR_USE_FLENS_BLAS
1814
1915#define HAVE_CBLAS 1
2016
17+ #if defined(__CLING__)
18+
19+ #pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR_64@)
20+ #pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR_32@)
21+ #pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR@)
2122#pragma cling load("libblas")
2223#pragma cling load("liblapack")
2324
24- #endif
25+ #elif defined(__EMSCRIPTEN__) && defined(__CLANG_REPL__)
26+
27+ #include <clang/Interpreter/CppInterOp.h>
28+ static bool _openblas_loaded = []() {
29+ Cpp::LoadLibrary(@OPENBLAS_CPPINTEROP_LIBRARY_PATH@, false);
30+ return true;
31+ }();
2532
2633#endif
34+
35+ #endif // XTENSOR_USE_FLENS_BLAS
36+
37+ #endif // XBLAS_CONFIG_CLING_HPP
You can’t perform that action at this time.
0 commit comments