Skip to content

Commit a1a3550

Browse files
committed
Fix Linux MKL build
1 parent 4f17d7a commit a1a3550

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

dynadjust/CMakeLists.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,24 @@ else()
347347
if(USE_MKL)
348348
# Use Intel MKL's native CMake config
349349
add_compile_options("-DUSE_MKL")
350-
350+
351351
# Set MKL interface based on ILP64 option
352352
if(ILP64)
353-
set(MKL_INTERFACE "ilp64")
353+
set(MKL_INTERFACE "ilp64" CACHE STRING "MKL interface layer")
354354
else()
355-
set(MKL_INTERFACE "lp64")
355+
set(MKL_INTERFACE "lp64" CACHE STRING "MKL interface layer")
356356
endif()
357-
357+
358+
# Set MKL threading (required for proper configuration)
359+
if(NOT DEFINED MKL_THREADING)
360+
set(MKL_THREADING "gnu_thread" CACHE STRING "MKL threading layer")
361+
endif()
362+
363+
# Set MKL link type
364+
if(NOT DEFINED MKL_LINK)
365+
set(MKL_LINK "dynamic" CACHE STRING "MKL link type")
366+
endif()
367+
358368
# Find MKL using its CMake config
359369
find_package(MKL CONFIG)
360370

@@ -363,7 +373,15 @@ else()
363373
message(STATUS " MKL Version: ${MKL_VERSION}")
364374
message(STATUS " MKL Interface: ${MKL_INTERFACE}")
365375
message(STATUS " MKL Threading: ${MKL_THREADING}")
366-
376+
message(STATUS " MKL Link: ${MKL_LINK}")
377+
378+
# Explicitly ensure we're not using ILP64 when in LP64 mode
379+
if(NOT ILP64)
380+
# Remove any MKL_ILP64 definition that might have been set
381+
remove_definitions(-DMKL_ILP64)
382+
add_compile_definitions(MKL_LP64)
383+
endif()
384+
367385
# Use the modern MKL target
368386
list(APPEND DNA_LIBRARIES MKL::MKL)
369387
else()

0 commit comments

Comments
 (0)