From 0c9539ddf021cf86bd72362598ba70516acaae37 Mon Sep 17 00:00:00 2001 From: Alexander Hampel Date: Fri, 8 Mar 2024 11:06:53 -0500 Subject: [PATCH] [build] fix intel f2py build of elk converter (#249) * [build] fix intel f2py build of elk converter * improvements from @wentzell --- .../converters/elktools/elkwrappers/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/triqs_dft_tools/converters/elktools/elkwrappers/CMakeLists.txt b/python/triqs_dft_tools/converters/elktools/elkwrappers/CMakeLists.txt index c0c9daea..bda8dbbd 100644 --- a/python/triqs_dft_tools/converters/elktools/elkwrappers/CMakeLists.txt +++ b/python/triqs_dft_tools/converters/elktools/elkwrappers/CMakeLists.txt @@ -1,18 +1,23 @@ # List the sources set(module_name "getpmatelk") -set(fortran_src_file "${CMAKE_CURRENT_SOURCE_DIR}/getpmatelk.f90") +set(fortran_src_file "${CMAKE_CURRENT_SOURCE_DIR}/getpmatelk.f90") set(generated_module_file ${module_name}${TRIQS_PYTHON_MODULE_EXT}) add_custom_target(${module_name} ALL - DEPENDS ${generated_module_file} + DEPENDS ${generated_module_file} ) +# for Intel fortran compilers we manually have to link against libiomp5 (-fqopenmp is always on in f2py) +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + set(F2PY_INTEL_OPTIONS -liomp5 --fcompiler=intelem) +endif() + ##generate the fortran python wrapper shared library add_custom_command( OUTPUT ${generated_module_file} - COMMAND ${TRIQS_PYTHON_EXECUTABLE} -m numpy.f2py --build-dir ${CMAKE_CURRENT_BINARY_DIR}/meson --f90exec=${CMAKE_Fortran_COMPILER} --f77exec=${CMAKE_Fortran_COMPILER} -c ${fortran_src_file} -m ${module_name} > elk_f2py.log + COMMAND ${TRIQS_PYTHON_EXECUTABLE} -m numpy.f2py --build-dir ${CMAKE_CURRENT_BINARY_DIR}/meson --f90exec=${CMAKE_Fortran_COMPILER} --f77exec=${CMAKE_Fortran_COMPILER} ${F2PY_INTEL_OPTIONS} -c ${fortran_src_file} -m ${module_name} > elk_f2py.log WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )