diff --git a/CMakeLists.txt b/CMakeLists.txt index a97ee8dc..8119a408 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,23 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/opt/libomp/lib -L/opt/homebrew/opt/libomp/lib -lomp") message(STATUS "Using AppleClang-specific flags.") include_directories("/usr/local/opt/libomp/include" "/opt/homebrew/opt/libomp/include") +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_CXX_FLAGS "-O3 -qopenmp -DARMA_DONT_USE_WRAPPER -DARMA_USE_SUPERLU -diag-disable=10430") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + message(STATUS "Using non-Clang compiler flags.") + # Get MKLROOT from environment or fallback to default + if(DEFINED ENV{MKLROOT}) + set(MKLROOT $ENV{MKLROOT}) + else() + set(MKLROOT "/opt/intel/oneapi/mkl/latest") + endif() + + # Automatically set Armadillo to link against MKL + set(BLAS_LIBRARIES "${MKLROOT}/lib/intel64/libmkl_rt.so" CACHE STRING "BLAS library path for MKL") + set(LAPACK_LIBRARIES "${MKLROOT}/lib/intel64/libmkl_rt.so" CACHE STRING "LAPACK library path for MKL") + set(ARMA_USE_WRAPPER OFF CACHE BOOL "Disable Armadillo wrapper to directly use MKL") + + message(STATUS "Using MKL from: ${MKLROOT}") else() set(CMAKE_CXX_FLAGS "-O3 -fopenmp -DARMA_DONT_USE_WRAPPER -DARMA_USE_SUPERLU") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")