diff --git a/modules/math/blas.cmake b/modules/math/blas.cmake new file mode 100644 index 0000000..91d7683 --- /dev/null +++ b/modules/math/blas.cmake @@ -0,0 +1,20 @@ +#.rst: +# +# Find and link to BLAS. +# +# Variables defined:: +# +# BLAS_FOUND - describe me, uncached +# BLAS_LIBRARIES - describe me, uncached +# BLAS_INCLUDE_DIR - describe me, uncached +# +# autocmake.cfg configuration:: +# +# docopt: --blas Find and link to BLAS [default: False]. +# define: '-DENABLE_BLAS=%s' % arguments['--blas'] + +option(ENABLE_BLAS "Find and link to BLAS" OFF) + +if(ENABLE_BLAS) + find_package(BLAS REQUIRED) +endif() diff --git a/modules/math/lapack.cmake b/modules/math/lapack.cmake new file mode 100644 index 0000000..2382dd5 --- /dev/null +++ b/modules/math/lapack.cmake @@ -0,0 +1,20 @@ +#.rst: +# +# Find and link to LAPACK. +# +# Variables defined:: +# +# LAPACK_FOUND - describe me, uncached +# LAPACK_LIBRARIES - describe me, uncached +# LAPACK_INCLUDE_DIR - describe me, uncached +# +# autocmake.cfg configuration:: +# +# docopt: --lapack Find and link to LAPACK [default: False]. +# define: '-DENABLE_LAPACK=%s' % arguments['--lapack'] + +option(ENABLE_LAPACK "Find and link to LAPACK" OFF) + +if(ENABLE_LAPACK) + find_package(LAPACK REQUIRED) +endif() diff --git a/test/fc_blas/cmake/autocmake.cfg b/test/fc_blas/cmake/autocmake.cfg index dded6ee..dd61239 100644 --- a/test/fc_blas/cmake/autocmake.cfg +++ b/test/fc_blas/cmake/autocmake.cfg @@ -5,8 +5,8 @@ min_cmake_version: 2.8 [fc] source: ../../../modules/fc.cmake -[math_libs] -source: ../../../modules/math_libs.cmake +[math] +source: ../../../modules/math/blas.cmake [default_build_paths] source: ../../../modules/default_build_paths.cmake diff --git a/test/fc_blas/src/CMakeLists.txt b/test/fc_blas/src/CMakeLists.txt index c311c0a..682fdba 100644 --- a/test/fc_blas/src/CMakeLists.txt +++ b/test/fc_blas/src/CMakeLists.txt @@ -1,6 +1,6 @@ if(BLAS_FOUND) add_executable(example example.f90) - target_link_libraries(example ${MATH_LIBS}) + target_link_libraries(example ${BLAS_LIBRARIES}) else() - message(FATAL_ERROR "BLAS library not found for the test fc_blas!") + message(FATAL_ERROR "BLAS library not found") endif() diff --git a/test/fc_lapack/cmake/autocmake.cfg b/test/fc_lapack/cmake/autocmake.cfg index dded6ee..6d5ea5a 100644 --- a/test/fc_lapack/cmake/autocmake.cfg +++ b/test/fc_lapack/cmake/autocmake.cfg @@ -5,8 +5,8 @@ min_cmake_version: 2.8 [fc] source: ../../../modules/fc.cmake -[math_libs] -source: ../../../modules/math_libs.cmake +[math] +source: ../../../modules/math/lapack.cmake [default_build_paths] source: ../../../modules/default_build_paths.cmake diff --git a/test/fc_lapack/src/CMakeLists.txt b/test/fc_lapack/src/CMakeLists.txt index 0181a67..c427a02 100644 --- a/test/fc_lapack/src/CMakeLists.txt +++ b/test/fc_lapack/src/CMakeLists.txt @@ -1,6 +1,6 @@ if(LAPACK_FOUND) - add_executable(example example.F90) - target_link_libraries(example ${MATH_LIBS}) + add_executable(example example.f90) + target_link_libraries(example ${LAPACK_LIBRARIES}) else() - message(FATAL_ERROR "LAPACK library not found for the test fc_lapack!") + message(FATAL_ERROR "LAPACK library not found") endif() diff --git a/test/fc_lapack/src/example.F90 b/test/fc_lapack/src/example.f90 similarity index 100% rename from test/fc_lapack/src/example.F90 rename to test/fc_lapack/src/example.f90 diff --git a/test/test.py b/test/test.py index 52cfe03..7131d43 100644 --- a/test/test.py +++ b/test/test.py @@ -128,7 +128,11 @@ def test_fc_omp(): def test_fc_blas(): - configure_build_and_exe('fc_blas', 'python setup.py --fc=gfortran --cmake-options="-DMATH_LIB_SEARCH_ORDER=\'OPENBLAS;ATLAS;MKL;SYSTEM_NATIVE\'"') + configure_build_and_exe('fc_blas', 'python setup.py --fc=gfortran --blas') + + +def test_fc_lapack(): + configure_build_and_exe('fc_lapack', 'python setup.py --fc=gfortran --lapack') @skip_on_osx @@ -136,10 +140,6 @@ def test_cxx_cblas(): configure_build_and_exe('cxx_cblas', 'python setup.py --cxx=g++ --cblas') -def test_fc_lapack(): - configure_build_and_exe('fc_lapack', 'python setup.py --fc=gfortran --cmake-options="-DMATH_LIB_SEARCH_ORDER=\'OPENBLAS;ATLAS;MKL;SYSTEM_NATIVE\'"') - - @skip_on_osx @skip_on_linux def test_cxx_lapacke():