Last active
August 30, 2023 21:36
-
-
Save scivision/cfcf7e59daa75e78e18cf29fb5cab9ad to your computer and use it in GitHub Desktop.
Intel oneMKL build Lapack built-in examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.20.2...3.27) | |
project(LapackMKL LANGUAGES Fortran) | |
message(STATUS "ENV{MKLROOT}: $ENV{MKLROOT}") | |
# this find_package() isn't required, but we do it here | |
# to discover if MKL is missing | |
find_package(MKL CONFIG REQUIRED) | |
message(STATUS "MKL_ROOT: ${MKL_ROOT}") | |
# this is how to link MKL in general | |
# target_link_library(myexe PRIVATE MKL::MKL) | |
include(ExternalProject) | |
find_file(archive | |
NAMES examples_core_f.tgz examples_core_f.zip | |
HINTS ${MKL_ROOT} | |
PATH_SUFFIXES examples | |
NO_DEFAULT_PATH | |
REQUIRED | |
) | |
message(STATUS "source archive: ${archive}") | |
set(cmake_args | |
-DCMAKE_MODULE_PATH:PATH=${MKL_ROOT}/examples/cmake | |
-DCMAKE_Fortran_COMPILER:FILEPATH=${CMAKE_Fortran_COMPILER} | |
) | |
ExternalProject_Add(examples | |
URL ${archive} | |
CONFIGURE_HANDLED_BY_BUILD true | |
CMAKE_ARGS ${cmake_args} | |
INSTALL_COMMAND "" | |
TEST_BEFORE_INSTALL true | |
USES_TERMINAL_CONFIGURE true | |
USES_TERMINAL_BUILD true | |
USES_TERMINAL_TEST true | |
) | |
ExternalProject_Get_Property(examples BINARY_DIR) | |
message(STATUS "To run tests after build manually: | |
ctest --test-dir ${BINARY_DIR}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment