From c81b790f918d5d23908d2de2658d1d6728aa73eb Mon Sep 17 00:00:00 2001 From: julie Date: Tue, 9 Aug 2011 18:59:44 +0000 Subject: Commiting BRAD patch Here is a patch for lapack to provide MS-format dll import libraries from the MinGW GNU toolchain. It is ready for others to try before it goes upstream. You just need to have MinGW GNU Fortran 4.x and one of the VS IDEs installed. Configure a MinGW build with BUILD_SHARED_LIBS set to ON. The resulting build (and install) tree will provide both GNU-format and MS-format import libraries for the DLLs. A C application built with MSVC and linked to the MinGW-built lapack DLLs will run but requires the GNU runtime DLLs from MinGW to be available. I tested this with both 32-bit and 64-bit builds. For the latter I used the mingw64 gfortran. In both cases I just put the GNU runtime directory in my PATH. I think both libgfortran-3.dll and libgcc_s_dw2-1.dll are needed. This may be used to create a binary LAPACK distribution for Windows that will work without any GNU tools installed. One needs only to provide the MinGW GNU runtime libraries along with blas.dll and lapack.dll. -Brad --- CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index aea39b3a..7322fca8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,12 +17,29 @@ if (UNIX) endif () endif () + +# -------------------------------------------------- + +# On Windows-GNU builds try to provide MS import libraries too. +if(BUILD_SHARED_LIBS) + include(GNUtoMS) +endif() + +if(GNUtoMS) + set(LAPACK_GNUtoMS_IMPORT ${LAPACK_SOURCE_DIR}/CMAKE/lapack-GNUtoMS.cmake) + set(LAPACK_GNUtoMS_INSTALL "include(\${_SELF_DIR}/lapack-GNUtoMS.cmake)") + set(LAPACK_GNUtoMS_BUILD "include(\"${LAPACK_GNUtoMS_IMPORT}\")") +endif() + macro(lapack_install_library lib) install(TARGETS ${lib} EXPORT lapack-targets ARCHIVE DESTINATION lib${LIB_SUFFIX} LIBRARY DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin ) + if(GNUtoMS) + install(FILES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/lib${lib}.lib DESTINATION lib) + endif() endmacro() # -------------------------------------------------- @@ -170,6 +187,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapack.pc.in ${CMAKE_CURRENT_BINARY_D configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-install.cmake.in ${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake @ONLY) install(FILES + ${LAPACK_GNUtoMS_IMPORT} ${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake ${LAPACK_BINARY_DIR}/lapack-config-version.cmake DESTINATION lib/cmake/lapack-${LAPACK_VERSION} -- cgit v1.2.3