Skip to content

Commit

Permalink
Added OpenBLAS option to CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
tjof2 committed May 10, 2016
1 parent 807efe6 commit eb65ad2
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_aux/Module
option(BUILD_LIBRARY "Build the shared library" ON)
option(BUILD_PYTHON "Install Python wrapper as a package" ON)
option(BUILD_EXECUTABLE "Build a standalone executable" OFF)
option(USE_OPENBLAS "Whether to use BLAS or OpenBLAS" ON)

include(CheckIncludeFileCXX)
include(CheckLibraryExists)
Expand Down Expand Up @@ -44,23 +45,21 @@ else()
set(SVT_INCL ${SVT_INCL} ${TIFF_INCLUDE_DIR})
endif()

if(OpenBLAS_FOUND AND ATLAS_FOUND)
message(STATUS "*** WARNING: found both OpenBLAS and ATLAS; ATLAS will not be used")
endif()

if(OpenBLAS_FOUND AND BLAS_FOUND)
message(STATUS "*** WARNING: found both OpenBLAS and BLAS; BLAS will not be used")
endif()

if(OpenBLAS_FOUND)
set(SVT_LIBS ${SVT_LIBS} ${OpenBLAS_LIBRARIES})
else()
if(OpenBLAS_FOUND AND USE_OPENBLAS)
if(OpenBLAS_FOUND AND BLAS_FOUND)
message(STATUS "*** WARNING: found both OpenBLAS and BLAS; BLAS will not be used")
endif()
if(OpenBLAS_FOUND AND ATLAS_FOUND)
message(STATUS "*** WARNING: found both OpenBLAS and ATLAS; ATLAS will not be used")
endif()
set(SVT_LIBS ${SVT_LIBS} ${OpenBLAS_LIBRARIES})
else()
if(ATLAS_FOUND)
set(SVT_LIBS ${SVT_LIBS} ${ATLAS_LIBRARIES})
endif()
set(SVT_LIBS ${SVT_LIBS} ${ATLAS_LIBRARIES})
endif()
if(BLAS_FOUND)
set(SVT_LIBS ${SVT_LIBS} ${BLAS_LIBRARIES})
endif()
endif()
endif()

if(LAPACK_FOUND)
Expand All @@ -71,6 +70,10 @@ if(ARMADILLO_FOUND)
set(SVT_LIBS ${SVT_LIBS} ${ARMADILLO_LIBRARIES})
endif()



message(STATUS ${SVT_LIBS})

########################################

# Enable OpenMP
Expand Down Expand Up @@ -99,35 +102,28 @@ endif()
# Install Python package
find_program(PYTHON "python")
if(BUILD_PYTHON AND PYTHON)

set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(DEPS "${CMAKE_CURRENT_BINARY_DIR}/pguresvt/*.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
configure_file(${SETUP_PY_IN} ${SETUP_PY})

set(PYTHONLIBRARYPATH "${CMAKE_INSTALL_PREFIX}/lib")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pguresvt/pguresvt.py.in
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pguresvt/pguresvt.py.in
${CMAKE_CURRENT_BINARY_DIR}/pguresvt/pguresvt.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pguresvt/hspysvt.py
${CMAKE_CURRENT_BINARY_DIR}/pguresvt/hspysvt.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pguresvt/__init__.py
${CMAKE_CURRENT_BINARY_DIR}/pguresvt/__init__.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pguresvt/hspysvt.py
${CMAKE_CURRENT_BINARY_DIR}/pguresvt/hspysvt.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pguresvt/__init__.py
${CMAKE_CURRENT_BINARY_DIR}/pguresvt/__init__.py)


add_custom_command(OUTPUT ${OUTPUT}
COMMAND ${PYTHON} ${SETUP_PY} build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
DEPENDS ${DEPS})

add_custom_target(python ALL DEPENDS ${OUTPUT})

install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")
endif()







0 comments on commit eb65ad2

Please sign in to comment.