LAPACK: add support for complex numbers for MSVC

pull/14557/head
Maksim Shabunin 6 years ago
parent f629cdfe2c
commit fff7b7e459
  1. 38
      cmake/OpenCVFindLAPACK.cmake

@ -31,27 +31,33 @@ macro(ocv_lapack_check)
else() else()
# adding proxy opencv_lapack.h header # adding proxy opencv_lapack.h header
set(CBLAS_H_PROXY_PATH ${CMAKE_BINARY_DIR}/opencv_lapack.h) set(CBLAS_H_PROXY_PATH ${CMAKE_BINARY_DIR}/opencv_lapack.h)
if((APPLE OR OPENCV_SKIP_LAPACK_EXTERN_C) AND NOT OPENCV_FORCE_LAPACK_EXTERN_C)
set(_lapack_include_str_extern_C "") set(_lapack_add_extern_c NOT (APPLE OR OPENCV_SKIP_LAPACK_EXTERN_C) OR OPENCV_FORCE_LAPACK_EXTERN_C)
set(_lapack_include_str_extern_C_end "")
else() set(_lapack_content "// This file is auto-generated\n")
set(_lapack_include_str_extern_C "extern \"C\" {\n") if(${_lapack_add_extern_c})
set(_lapack_include_str_extern_C_end "}\n") list(APPEND _lapack_content "extern \"C\" {")
endif() endif()
set(_lapack_include_str "${_lapack_include_str_extern_C}\#include \"${OPENCV_CBLAS_H_PATH_${_lapack_impl}}\"") if(NOT OPENCV_SKIP_LAPACK_MSVC_FIX)
if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}") list(APPEND _lapack_content "
set(_lapack_include_str "${_lapack_include_str}\n#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"") #ifdef _MSC_VER
#include <complex.h>
#define lapack_complex_float _Fcomplex
#define lapack_complex_double _Dcomplex
#endif
")
endif() endif()
set(_lapack_include_str "${_lapack_include_str}\n${_lapack_include_str_extern_C_end}") list(APPEND _lapack_content "#include \"${OPENCV_CBLAS_H_PATH_${_lapack_impl}}\"")
# update file contents (if required) if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}")
set(__content_str "") list(APPEND _lapack_content "#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"")
if(EXISTS "${CBLAS_H_PROXY_PATH}")
file(READ "${CBLAS_H_PROXY_PATH}" __content_str)
endif() endif()
if(NOT " ${__content_str}" STREQUAL " ${_lapack_include_str}") if(${_lapack_add_extern_c})
file(WRITE "${CBLAS_H_PROXY_PATH}" "${_lapack_include_str}") list(APPEND _lapack_content "}")
endif() endif()
string(REPLACE ";" "\n" _lapack_content "${_lapack_content}")
ocv_update_file("${CBLAS_H_PROXY_PATH}" "${_lapack_content}")
try_compile(__VALID_LAPACK try_compile(__VALID_LAPACK
"${OpenCV_BINARY_DIR}" "${OpenCV_BINARY_DIR}"
"${OpenCV_SOURCE_DIR}/cmake/checks/lapack_check.cpp" "${OpenCV_SOURCE_DIR}/cmake/checks/lapack_check.cpp"

Loading…
Cancel
Save