Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing open-blas detection on Mac #41

Merged
merged 1 commit into from
Feb 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Detect OpenBlas when required
Closes #41.

Corrects for some badness in OpenBlas' cmake export.
To actually force the call to OpenBlas, it is sufficient to define
BLA_VENDOR=OpenBlas (or any other name that is not an other blas
library)
  • Loading branch information
Mayeul d'Avezac committed Feb 2, 2016
commit a23306e070a1fb06ac0583732f8fc162e1c23b41
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