@@ -119,9 +119,11 @@ endif ()
119
119
120
120
# Only generate .def for dll on MSVC and always produce pdb files for debug and release
121
121
if (MSVC )
122
- set (OpenBLAS_DEF_FILE "${PROJECT_BINARY_DIR} /openblas.def" )
123
- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi" )
124
- set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF" )
122
+ if (${CMAKE_MAJOR_VERSION} .${CMAKE_MINOR_VERSION} LESS 3.4 )
123
+ set (OpenBLAS_DEF_FILE "${PROJECT_BINARY_DIR} /openblas.def" )
124
+ endif ()
125
+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi" )
126
+ set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF" )
125
127
endif ()
126
128
127
129
if (${DYNAMIC_ARCH} )
@@ -141,7 +143,15 @@ endif()
141
143
# add objects to the openblas lib
142
144
add_library (${OpenBLAS_LIBNAME} ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS} ${OpenBLAS_DEF_FILE} )
143
145
144
- include ("${PROJECT_SOURCE_DIR} /cmake/export.cmake" )
146
+ # Handle MSVC exports
147
+ if (MSVC AND BUILD_SHARED_LIBS )
148
+ if (${CMAKE_MAJOR_VERSION} .${CMAKE_MINOR_VERSION} LESS 3.4 )
149
+ include ("${PROJECT_SOURCE_DIR} /cmake/export.cmake" )
150
+ else ()
151
+ # Creates verbose .def file (51KB vs 18KB)
152
+ set_target_properties (${OpenBLAS_LIBNAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true )
153
+ endif ()
154
+ endif ()
145
155
146
156
# Set output for libopenblas
147
157
set_target_properties ( ${OpenBLAS_LIBNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} /lib )
@@ -164,7 +174,6 @@ if (USE_THREAD)
164
174
set_property (TARGET ${OpenBLAS_LIBNAME} PROPERTY COMPILE_OPTIONS "-pthread" )
165
175
set_property (TARGET ${OpenBLAS_LIBNAME} PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread" )
166
176
endif ()
167
- message ("PTHREAD: ${CMAKE_THREAD_LIBS_INIT} " )
168
177
target_link_libraries (${OpenBLAS_LIBNAME} ${CMAKE_THREAD_LIBS_INIT} )
169
178
endif ()
170
179
0 commit comments