Commit d06e2494 authored by Dave Moxey's avatar Dave Moxey

Change BLAS/LAPACK routines to download pre-built binaries automatically

parent b3e81914
......@@ -130,25 +130,6 @@ OPTION(NEKTAR_USE_MEMORY_POOLS
"Use memory pools to accelerate memory allocation." ON)
MARK_AS_ADVANCED(NEKTAR_USE_MEMORY_POOLS)
# Turn on NEKTAR_USE_WIN32_LAPACK if we are in Windows and the libraries exist.
IF( WIN32 )
IF( CMAKE_CL_64 )
FIND_LIBRARY( WIN32_BLAS NAMES libblas64 PATHS ${CMAKE_SOURCE_DIR}/ThirdParty ${CMAKE_SOURCE_DIR}/../ThirdParty )
FIND_LIBRARY( WIN32_LAPACK NAMES liblapack64 PATHS ${CMAKE_SOURCE_DIR}/ThirdParty ${CMAKE_SOURCE_DIR}/../ThirdParty )
ELSE()
FIND_LIBRARY( WIN32_BLAS NAMES blas_win32 PATHS ${CMAKE_SOURCE_DIR}/ThirdParty ${CMAKE_SOURCE_DIR}/../ThirdParty )
FIND_LIBRARY( WIN32_LAPACK NAMES lapack_win32 PATHS ${CMAKE_SOURCE_DIR}/ThirdParty ${CMAKE_SOURCE_DIR}/../ThirdParty )
ENDIF()
IF( WIN32_BLAS AND WIN32_LAPACK )
SET(Win32LapackDefault ON)
ELSE(WIN32_BLAS AND WIN32_LAPACK)
SET(Win32LapackDefault OFF)
ENDIF(WIN32_BLAS AND WIN32_LAPACK)
ELSE(WIN32)
SET(Win32LapackDefault OFF)
ENDIF(WIN32)
IF (MSVC)
# Needed for M_PI to be visible in visual studio.
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
......@@ -158,9 +139,9 @@ IF (MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
ENDIF()
DEPENDENT_OPTION(NEKTAR_USE_WIN32_LAPACK
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_WIN32_LAPACK
"Use Win32 Lapack provided with the Third Party Distribution."
${Win32LapackDefault} "NEKTAR_USE_BLAS_LAPACK; WIN32" OFF)
OFF "NEKTAR_USE_BLAS_LAPACK; WIN32" ON)
# Include Nektar++ common macros
INCLUDE (NektarCommon)
......
IF( WIN32 AND CMAKE_CL_64 )
FIND_LIBRARY( WIN32_BLAS NAMES libblas64 PATHS
${WIN32_LAPACK_ADDITIONAL_DIRS}
${CMAKE_SOURCE_DIR}/ThirdParty
${CMAKE_SOURCE_DIR}/../ThirdParty)
FIND_LIBRARY(WIN32_BLAS NAMES libblas PATHS
${CMAKE_SOURCE_DIR}/ThirdParty)
FIND_LIBRARY(WIN32_LAPACK NAMES liblapack PATHS
${CMAKE_SOURCE_DIR}/ThirdParty)
FIND_LIBRARY( WIN32_LAPACK NAMES liblapack64 PATHS
${WIN32_LAPACK_ADDITIONAL_DIRS}
${CMAKE_SOURCE_DIR}/ThirdParty
${CMAKE_SOURCE_DIR}/../ThirdParty)
ELSE()
FIND_LIBRARY( WIN32_BLAS NAMES blas_win32 PATHS
${WIN32_LAPACK_ADDITIONAL_DIRS}
${CMAKE_SOURCE_DIR}/ThirdParty
${CMAKE_SOURCE_DIR}/../ThirdParty)
IF (NOT WIN32_BLAS OR NOT WIN32_LAPACK)
IF (CMAKE_CL64)
SET(WIN_ZIP_FILE "win64-blas-lapack.zip")
ELSE()
SET(WIN_ZIP_FILE "win32-blas-lapack.zip")
ENDIF()
FIND_LIBRARY( WIN32_LAPACK NAMES lapack_win32 PATHS
${WIN32_LAPACK_ADDITIONAL_DIRS}
${CMAKE_SOURCE_DIR}/ThirdParty
${CMAKE_SOURCE_DIR}/../ThirdParty)
ENDIF()
IF (NOT EXISTS ${TPSRC}/${WIN_ZIP_FILE})
FILE(DOWNLOAD http://ae-nektar.ae.ic.ac.uk/~dmoxey/${WIN_ZIP_FILE} ${TPSRC}/${WIN_ZIP_FILE})
ENDIF()
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E tar jxf ${TPSRC}/${WIN_ZIP_FILE}
WORKING_DIRECTORY ${TPSRC}
)
CHANGE_EXTENSION(WIN32_LAPACK_DLL ${WIN32_LAPACK} "dll")
CHANGE_EXTENSION(WIN32_BLAS_DLL ${WIN32_BLAS} "dll")
FIND_LIBRARY(WIN32_BLAS NAMES libblas PATHS
${CMAKE_SOURCE_DIR}/ThirdParty)
FIND_LIBRARY(WIN32_LAPACK NAMES liblapack PATHS
${CMAKE_SOURCE_DIR}/ThirdParty)
MESSAGE(STATUS ${CMAKE_SOURCE_DIR}/ThirdParty)
MESSAGE(STATUS ${WIN32_BLAS})
IF (NOT WIN32_BLAS)
MESSAGE(FATAL_ERROR "Could not find BLAS library after unzipping!")
ENDIF()
IF (NOT WIN32_LAPACK)
MESSAGE(FATAL_ERROR "Could not find LAPACK library after unzipping!")
ENDIF()
ENDIF ()
GET_FILENAME_COMPONENT(LAPACK_DIR ${WIN32_LAPACK} PATH CACHE)
LINK_DIRECTORIES(${LAPACK_DIR})
IF (WIN32_BLAS)
SET(WIN32_LAPACK_FOUND ON)
ENDIF (WIN32_BLAS)
IF (WIN32_LAPACK_FOUND)
IF (NOT WIN32_LAPACK_FIND_QUIETLY)
MESSAGE(STATUS "Found WIN32 Lapack: ${WIN32_LAPACK}")
ENDIF (NOT WIN32_LAPACK_FIND_QUIETLY)
ELSE(WIN32_LAPACK_FOUND)
IF (WIN32_LAPACK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Win32 Lapack")
ENDIF (WIN32_LAPACK_FIND_REQUIRED)
ENDIF (WIN32_LAPACK_FOUND)
MESSAGE(STATUS "Found Win32 BLAS: ${WIN32_BLAS}")
MESSAGE(STATUS "Found Win32 Lapack: ${WIN32_LAPACK}")
\ No newline at end of file
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