Skip to content

Commit

Permalink
Merge pull request UCL#41 from UCL/blas
Browse files Browse the repository at this point in the history
Forcing open-blas detection on Mac
  • Loading branch information
Mayeul d'Avezac committed Feb 3, 2016
2 parents 97acd0c + a23306e commit 2a546d8
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions modules/FindCBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ macro(found_or_not_found_blas)
endif()
endmacro()

macro(_look_for_blas_libraries)
function(_look_for_blas_libraries)
include(FindPkgConfig)
pkg_search_module(CBLAS cblas)
if(NOT CBLAS_FOUND AND PKG_CONFIG_FOUND)
pkg_search_module(ATLAS atlas)
else()
set(BLAS_LIBRARIES ${CBLAS_LIBRARIES})
set(BLAS_INCLUDE_DIR ${CBLAS_INCLUDE_DIRS})
set(BLAS_LIBRARIES ${CBLAS_LIBRARIES} PARENT_SCOPE)
set(BLAS_INCLUDE_DIR ${CBLAS_INCLUDE_DIRS} PARENT_SCOPE)
endif()

# include -pthread so MKL can be included on Ubuntu + enthought
if(use_pthread_flag)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread" PARENT_SCOPE)
endif()
find_package(BLAS QUIET)
if(use_pthread_flag)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread" PARENT_SCOPE)
endif()

# Figures out atlas if necessary
Expand All @@ -58,10 +58,11 @@ macro(_look_for_blas_libraries)
HINTS "${atlas_dir}"
)
if(BLAS_atlas_cblas_LIBRARY)
set(BLAS_FOUND TRUE)
set(BLAS_FOUND TRUE PARENT_SCOPE)
set(BLAS_LIBRARIES
"${BLAS_atlas_cblas_LIBRARY}"
"${BLAS_atlas_LIBRARY}"
PARENT_SCOPE
)
endif()
endif()
Expand All @@ -70,11 +71,17 @@ macro(_look_for_blas_libraries)
if(NOT BLAS_LIBRARIES AND NOT BLAS_INCLUDE_DIR)
find_package(OpenBLAS)
if(OpenBLAS_FOUND)
set(BLAS_LIBRARIES ${OpenBLAS_LIBRARIES})
set(BLAS_INCLUDE_DIR ${OpenBLAS_INCLUDE_DIRS})
if(NOT EXISTS "${OpenBLAS_LIBRARIES}")
string(REPLACE "'" "" OpenBLAS_LIBRARIES ${OpenBLAS_LIBRARIES})
endif()
if(NOT EXISTS "${OpenBLAS_INCLUDE_DIRS}")
string(REPLACE "'" "" OpenBLAS_INCLUDE_DIRS ${OpenBLAS_INCLUDE_DIRS})
endif()
set(BLAS_LIBRARIES ${OpenBLAS_LIBRARIES} PARENT_SCOPE)
set(BLAS_INCLUDE_DIR ${OpenBLAS_INCLUDE_DIRS} PARENT_SCOPE)
endif()
endif()
endmacro()
endfunction()

function(_look_for_include_directories)
# Adds BLAS_INCLUDE_DIR
Expand Down

0 comments on commit 2a546d8

Please sign in to comment.