11cmake_minimum_required (VERSION 3.15)
22project (dynadjust VERSION 1.2.9)
33
4- option (BUILD_TESTING "Enable testing" OFF )
4+ option (BUILD_TESTING "Enable testing" ON )
55option (BUILD_STATIC "Build static binaries in the 'static' directory" OFF )
6- option (USE_MKL "Use Intel MKL (Linux and Windows)" OFF )
6+ option (USE_MKL "Use Intel MKL (Linux and Windows)" ON )
77option (USE_OPENMP_MAC "Use OpenMP on macOS (requires `brew install libomp`)" OFF )
88option (ILP64 "Use ILP64 Interface for BLAS and LAPACK" OFF )
99
10- set (CMAKE_DISABLE_PRECOMPILE_HEADERS ON )
10+ set (CMAKE_DISABLE_PRECOMPILE_HEADERS OFF )
1111
1212# Fix Boost 1.70+ issue with CMake 3.14+
1313if (POLICY CMP0167)
@@ -279,25 +279,44 @@ if(APPLE)
279279 endif ()
280280 list (APPEND DNA_LIBRARIES ${ACCELERATE_LIB} )
281281
282- elseif (WIN32 )
282+ elseif (WIN32 )
283+ message (STATUS "Looking for BLAS and LAPACK on Windows (BLA_VENDOR=${BLA_VENDOR} )" )
283284 if (USE_MKL)
284285 add_compile_options ("-DUSE_MKL" )
285286 if (ILP64)
286287 set (BLA_VENDOR "Intel10_64ilp" CACHE STRING "Force MKL" FORCE)
287288 else ()
288289 set (BLA_VENDOR "Intel10_64lp" CACHE STRING "Force MKL" FORCE)
289290 endif ()
290- else ()
291- set (BLA_VENDOR "OpenBLAS" CACHE STRING "Force OpenBLAS" FORCE)
292- endif ()
293291
294- message (STATUS "Looking for BLAS and LAPACK on Windows (BLA_VENDOR=${BLA_VENDOR} )" )
292+ message (STATUS "BLA_VENDOR=${BLA_VENDOR} " )
293+
294+ find_package (MKL CONFIG REQUIRED PATHS $ENV{MKL_ROOT} )
295+ set (BLAS_LIBRARIES, ${MKL_REQUESTED_LIBRARIES} )
296+ set (BLAS_INCLUDE_DIRS, ${MKL_INCLUDE} )
297+ message (STATUS "MKL_INCLUDE=${MKL_INCLUDE} " )
298+ message (STATUS "MKL_LIB_DIR=${MKL_ROOT} /lib" )
299+ message (STATUS "DLL_EXT=${DLL_EXT} " )
300+ include_directories (${MKL_INCLUDE} )
301+ link_directories ("${MKL_ROOT} /lib" )
302+
303+ foreach (lib ${MKL_REQUESTED_LIBRARIES} )
304+ get_filename_component (libname ${lib} NAME_WLE)
305+ list (APPEND MKL_REQUESTED_DLL_LIBRARIES "${libname} _dll" )
306+ endforeach ()
295307
296- find_package (BLAS REQUIRED)
297- add_link_options (${BLAS_LINKER_FLAGS} )
298- message (STATUS "BLAS_LINKER_FLAGS=${BLAS_LINKER_FLAGS} " )
299- message (STATUS "BLAS_LIBRARIES=${BLAS_LIBRARIES} " )
300- list (APPEND DNA_LIBRARIES ${BLAS_LIBRARIES} )
308+ message (STATUS "MKL_REQUESTED_DLL_LIBRARIES=${MKL_REQUESTED_DLL_LIBRARIES} " )
309+
310+ list (APPEND DNA_LIBRARIES ${MKL_REQUESTED_DLL_LIBRARIES} )
311+ else ()
312+ set (BLA_VENDOR "OpenBLAS" CACHE STRING "Force OpenBLAS" FORCE)
313+ find_package (BLAS REQUIRED)
314+ add_link_options (${BLAS_LINKER_FLAGS} )
315+ message (STATUS "BLAS_LINKER_FLAGS=${BLAS_LINKER_FLAGS} " )
316+ message (STATUS "BLAS_LIBRARIES=${BLAS_LIBRARIES} " )
317+ list (APPEND DNA_LIBRARIES ${BLAS_LIBRARIES} )
318+ endif ()
319+
301320
302321 if (NOT USE_MKL)
303322 set (BLA_VENDOR "Generic" CACHE STRING "Force Generic" FORCE)
@@ -311,7 +330,7 @@ elseif(WIN32)
311330 list (APPEND DNA_LIBRARIES ${LAPACK_LIBRARIES} )
312331 endif ()
313332
314- if (NOT USE_MKL)
333+ if (NOT USE_MKL)
315334 # Find OpenBLAS package which should set include directories
316335 find_package (OpenBLAS CONFIG QUIET )
317336 if (OpenBLAS_FOUND)
@@ -379,7 +398,8 @@ elseif(UNIX)
379398 list (APPEND DNA_LIBRARIES ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} )
380399 endif ()
381400 endif ()
382-
401+ else ()
402+ message (STATUS "Here is something dandy" )
383403endif ()
384404
385405message (STATUS "DynAdjust library dependencies: ${DNA_LIBRARIES} " )
0 commit comments