summaryrefslogtreecommitdiff
path: root/CMAKE
diff options
context:
space:
mode:
Diffstat (limited to 'CMAKE')
-rw-r--r--CMAKE/FortranMangling.cmake105
-rw-r--r--CMAKE/lapack-GNUtoMS.cmake2
2 files changed, 106 insertions, 1 deletions
diff --git a/CMAKE/FortranMangling.cmake b/CMAKE/FortranMangling.cmake
new file mode 100644
index 0000000..98b8443
--- /dev/null
+++ b/CMAKE/FortranMangling.cmake
@@ -0,0 +1,105 @@
+# Macro that defines variables describing the Fortran name mangling
+# convention
+#
+# Sets the following outputs on success:
+#
+# INTFACE
+# Add_
+# NoChange
+# f77IsF2C
+# UpCase
+#
+macro(FORTRAN_MANGLING CDEFS)
+MESSAGE(STATUS "=========")
+ GET_FILENAME_COMPONENT(F77_NAME ${CMAKE_Fortran_COMPILER} NAME)
+ GET_FILENAME_COMPONENT(F77_PATH ${CMAKE_Fortran_COMPILER} PATH)
+ SET(F77 ${F77_NAME} CACHE INTERNAL "Name of the fortran compiler.")
+
+ IF(${F77} STREQUAL "ifort.exe")
+ #settings for Intel Fortran
+ SET(F77_OPTION_COMPILE "/c" CACHE INTERNAL
+ "Fortran compiler option for compiling without linking.")
+ SET(F77_OUTPUT_OBJ "/Fo" CACHE INTERNAL
+ "Fortran compiler option for setting object file name.")
+ SET(F77_OUTPUT_EXE "/Fe" CACHE INTERNAL
+ "Fortran compiler option for setting executable file name.")
+ ELSE(${F77} STREQUAL "ifort.exe")
+ # in other case, let user specify their fortran configrations.
+ SET(F77_OPTION_COMPILE "-c" CACHE STRING
+ "Fortran compiler option for compiling without linking.")
+ SET(F77_OUTPUT_OBJ "-o" CACHE STRING
+ "Fortran compiler option for setting object file name.")
+ SET(F77_OUTPUT_EXE "-o" CACHE STRING
+ "Fortran compiler option for setting executable file name.")
+ SET(F77_LIB_PATH "" CACHE PATH
+ "Library path for the fortran compiler")
+ SET(F77_INCLUDE_PATH "" CACHE PATH
+ "Include path for the fortran compiler")
+ ENDIF(${F77} STREQUAL "ifort.exe")
+
+
+MESSAGE(STATUS "Testing FORTRAN_MANGLING")
+
+MESSAGE(STATUS "Compiling Finface.f...")
+
+ execute_process ( COMMAND ${CMAKE_Fortran_COMPILER} ${F77_OPTION_COMPILE} ${PROJECT_SOURCE_DIR}/lapacke/mangling/Fintface.f
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ OUTPUT_VARIABLE OUTPUT
+ RESULT_VARIABLE RESULT
+ ERROR_VARIABLE ERROR)
+
+ if(RESULT EQUAL 0)
+ MESSAGE(STATUS "Compiling Finface.f successful")
+ else()
+ MESSAGE(FATAL_ERROR " Compiling Finface.f FAILED")
+ MESSAGE(FATAL_ERROR " Error:\n ${ERROR}")
+ endif()
+
+MESSAGE(STATUS "Compiling Cintface.c...")
+
+ execute_process ( COMMAND ${CMAKE_C_COMPILER} ${F77_OPTION_COMPILE} ${PROJECT_SOURCE_DIR}/lapacke/mangling/Cintface.c
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ OUTPUT_VARIABLE OUTPUT
+ RESULT_VARIABLE RESULT
+ ERROR_VARIABLE ERROR)
+
+ if(RESULT EQUAL 0)
+ MESSAGE(STATUS "Compiling Cintface.c successful")
+ else()
+ MESSAGE(FATAL_ERROR " Compiling Cintface.c FAILED")
+ MESSAGE(FATAL_ERROR " Error:\n ${ERROR}")
+ endif()
+
+MESSAGE(STATUS "Linking Finface.f and Cintface.c...")
+
+ execute_process ( COMMAND ${CMAKE_Fortran_COMPILER} ${F77_OUTPUT_OBJ} xintface.exe Fintface.o Cintface.o
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ OUTPUT_VARIABLE OUTPUT
+ RESULT_VARIABLE RESULT
+ ERROR_VARIABLE ERROR)
+
+ if(RESULT EQUAL 0)
+ MESSAGE(STATUS "Linking Finface.f and Cintface.c successful")
+ else()
+ MESSAGE(FATAL_ERROR " Linking Finface.f and Cintface.c FAILED")
+ MESSAGE(FATAL_ERROR " Error:\n ${ERROR}")
+ endif()
+
+MESSAGE(STATUS "Running ./xintface...")
+
+ execute_process ( COMMAND ./xintface.exe
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ RESULT_VARIABLE xintface_RES
+ OUTPUT_VARIABLE xintface_OUT
+ ERROR_VARIABLE xintface_ERR)
+
+
+ if (xintface_RES EQUAL 0)
+ STRING(REPLACE "\n" "" xintface_OUT "${xintface_OUT}")
+ MESSAGE(STATUS "Fortran MANGLING convention: ${xintface_OUT}")
+ SET(CDEFS ${xintface_OUT})
+ else()
+ MESSAGE(FATAL_ERROR "FORTRAN_MANGLING:ERROR ${xintface_ERR}")
+ endif()
+
+endmacro(FORTRAN_MANGLING)
diff --git a/CMAKE/lapack-GNUtoMS.cmake b/CMAKE/lapack-GNUtoMS.cmake
index 490700c..1ad8db1 100644
--- a/CMAKE/lapack-GNUtoMS.cmake
+++ b/CMAKE/lapack-GNUtoMS.cmake
@@ -4,7 +4,7 @@ if(MINGW OR MSYS OR CYGWIN)
endif()
# Replace each imported target's import library.
-foreach(lib blas lapack)
+foreach(lib blas lapack tmglib lapacke)
# Replace for all imported build configurations.
get_property(configs TARGET ${lib} PROPERTY IMPORTED_CONFIGURATIONS)
foreach(config ${configs})