Commit 62c6ba3f authored by Davis King's avatar Davis King

Improved building of mex files.

parent 5c17c93f
...@@ -49,10 +49,6 @@ if (UNIX) ...@@ -49,10 +49,6 @@ if (UNIX)
include(CheckLibraryExists) include(CheckLibraryExists)
# Don't try to use the Intel MKL when we are building a MATLAB mex file
# since it will usually conflict with MATLAB's copy of the MKL and cause
# problems.
if (NOT BUILDING_MATLAB_MEX_FILE)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt # Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases. # file first since this way avoids linking bugs in some cases.
find_library(mkl_rt mkl_rt ${mkl_search_path}) find_library(mkl_rt mkl_rt ${mkl_search_path})
...@@ -65,6 +61,13 @@ if (UNIX) ...@@ -65,6 +61,13 @@ if (UNIX)
set(lapack_found 1) set(lapack_found 1)
set(found_intel_mkl 1) set(found_intel_mkl 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library") message(STATUS "Found Intel MKL BLAS/LAPACK library")
if (BUILDING_MATLAB_MEX_FILE)
message(STATUS "\n!!!! Don't forget to set the BLAS_VERSION and LAPACK_VERSION environment variables to !!!!\n!!!! ${blas_libraries} so MATLAB doesn't explode when you run this mex file !!!!\n")
endif()
endif()
if (BUILDING_MATLAB_MEX_FILE)
return()
endif() endif()
if (NOT found_intel_mkl) if (NOT found_intel_mkl)
...@@ -86,7 +89,6 @@ if (UNIX) ...@@ -86,7 +89,6 @@ if (UNIX)
message(STATUS "Found Intel MKL BLAS/LAPACK library") message(STATUS "Found Intel MKL BLAS/LAPACK library")
endif() endif()
endif() endif()
endif()
# try to find some other LAPACK libraries if we didn't find the MKL # try to find some other LAPACK libraries if we didn't find the MKL
...@@ -107,11 +109,7 @@ if (UNIX) ...@@ -107,11 +109,7 @@ if (UNIX)
INCLUDE (CheckFunctionExists) INCLUDE (CheckFunctionExists)
if (NOT blas_found) if (NOT blas_found)
if (BUILDING_MATLAB_MEX_FILE)
find_library(cblas_lib libopenblas.a PATHS ${extra_paths})
else()
find_library(cblas_lib openblas PATHS ${extra_paths}) find_library(cblas_lib openblas PATHS ${extra_paths})
endif()
if (cblas_lib) if (cblas_lib)
set(blas_libraries ${cblas_lib}) set(blas_libraries ${cblas_lib})
set(blas_found 1) set(blas_found 1)
......
...@@ -67,13 +67,6 @@ INCLUDE(InstallRequiredSystemLibraries) ...@@ -67,13 +67,6 @@ INCLUDE(InstallRequiredSystemLibraries)
MACRO(add_mex_function name ) MACRO(add_mex_function name )
ADD_LIBRARY(${name} MODULE ${name}.cpp ) ADD_LIBRARY(${name} MODULE ${name}.cpp )
if (UNIX)
if (DEFINED ENV{MATLAB_HOME})
set_target_properties(${name} PROPERTIES LINK_FLAGS "-Wl,--version-script,$ENV{MATLAB_HOME}/extern/lib/glnxa64/mexFunction.map")
else()
set_target_properties(${name} PROPERTIES LINK_FLAGS "-Wl,--version-script,${MATLAB_HOME}/extern/lib/glnxa64/mexFunction.map")
endif()
endif()
# Change the output file extension to a mex extension. # Change the output file extension to a mex extension.
if (WIN32) if (WIN32)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment