@@ -17,20 +17,29 @@ IF(USE_EIGEN_FOR_BLAS)
17
17
ENDIF (USE_EIGEN_FOR_BLAS )
18
18
19
19
INCLUDE (cblas )
20
+ # IF(WIN32 AND NOT ${CBLAS_FOUND})
21
+
22
+
20
23
21
24
IF (NOT ${CBLAS_FOUND} )
25
+
22
26
INCLUDE (ExternalProject )
23
27
24
28
SET (CBLAS_SOURCES_DIR ${THIRD_PARTY_PATH} /openblas )
25
29
SET (CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH} /install/openblas )
26
- SET (CBLAS_INC_DIR "${CBLAS_INSTALL_DIR} /include" CACHE PATH "openblas include directory." FORCE )
30
+ SET (CBLAS_INCLUDE_DIR "${CBLAS_INSTALL_DIR} /include" CACHE PATH "openblas include directory." FORCE )
27
31
28
32
SET (CBLAS_LIBRARIES
29
33
"${CBLAS_INSTALL_DIR} /lib/${CMAKE_STATIC_LIBRARY_PREFIX} openblas${CMAKE_STATIC_LIBRARY_SUFFIX} "
30
34
CACHE FILEPATH "openblas library." FORCE )
31
35
32
36
ADD_DEFINITIONS (-DPADDLE_USE_OPENBLAS )
37
+ IF (WIN32 )
38
+ SET (CBLAS_FOUND true )
39
+ MESSAGE (WARNING, "In windows, openblas only support msvc build, please build it manually and put it at " ${CBLAS_INSTALL_DIR} )
40
+ ENDIF (WIN32 )
33
41
42
+ IF (NOT WIN32 )
34
43
SET (OPENBLAS_CC "${CMAKE_C_COMPILER} -Wno-unused-but-set-variable -Wno-unused-variable" )
35
44
SET (OPENBLAS_COMMIT "v0.2.20" )
36
45
@@ -69,7 +78,6 @@ IF(NOT ${CBLAS_FOUND})
69
78
ENDIF ()
70
79
71
80
SET (COMMON_ARGS CC=${OPENBLAS_CC} NO_SHARED=1 NO_LAPACK=1 libs )
72
-
73
81
ExternalProject_Add (
74
82
extern_openblas
75
83
${EXTERNAL_PROJECT_LOG_ARGS}
@@ -84,9 +92,11 @@ IF(NOT ${CBLAS_FOUND})
84
92
UPDATE_COMMAND ""
85
93
CONFIGURE_COMMAND ""
86
94
)
95
+ ELSE ()
96
+ ENDIF (NOT WIN32 )
87
97
SET (CBLAS_PROVIDER openblas )
88
98
IF (WITH_C_API )
89
- INSTALL (DIRECTORY ${CBLAS_INC_DIR } DESTINATION third_party/openblas )
99
+ INSTALL (DIRECTORY ${CBLAS_INCLUDE_DIR } DESTINATION third_party/openblas )
90
100
# Because libopenblas.a is a symbolic link of another library, thus need to
91
101
# install the whole directory.
92
102
IF (ANDROID )
@@ -107,7 +117,8 @@ IF(NOT ${CBLAS_FOUND})
107
117
ENDIF (NOT ${CBLAS_FOUND} )
108
118
109
119
MESSAGE (STATUS "BLAS library: ${CBLAS_LIBRARIES} " )
110
- INCLUDE_DIRECTORIES (${CBLAS_INC_DIR} )
120
+ MESSAGE (STATUS "BLAS Include: ${CBLAS_INCLUDE_DIR} " )
121
+ INCLUDE_DIRECTORIES (${CBLAS_INCLUDE_DIR} )
111
122
112
123
# FIXME(gangliao): generate cblas target to track all high performance
113
124
# linear algebra libraries for cc_library(xxx SRCS xxx.c DEPS cblas)
0 commit comments