From 7d5a500ae4ec24d8adb728cd405b87bc99318463 Mon Sep 17 00:00:00 2001 From: julie Date: Fri, 6 Dec 2013 03:59:31 +0000 Subject: [PATCH] Remove GNUtoMS code in favor of CMake builtin version - Thanks Brad (Kitware) --- CMAKE/GNUtoMS.cmake | 85 ---------------------------- CMAKE/GNUtoMS/lib.bat.in | 3 - CMAKE/GNUtoMS/lib.cmake | 10 ---- CMAKE/README-GNUtoMS.txt | 10 ---- CMAKE/lapack-config-build.cmake.in | 1 - CMAKE/lapack-config-install.cmake.in | 1 - CMakeLists.txt | 16 +----- 7 files changed, 1 insertion(+), 125 deletions(-) delete mode 100644 CMAKE/GNUtoMS.cmake delete mode 100644 CMAKE/GNUtoMS/lib.bat.in delete mode 100644 CMAKE/GNUtoMS/lib.cmake delete mode 100644 CMAKE/README-GNUtoMS.txt diff --git a/CMAKE/GNUtoMS.cmake b/CMAKE/GNUtoMS.cmake deleted file mode 100644 index 186b28ac..00000000 --- a/CMAKE/GNUtoMS.cmake +++ /dev/null @@ -1,85 +0,0 @@ - -#============================================================================= -# GNUtoMS - CMake module for Windows import library conversion -# Copyright 2010-2011 Kitware, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of Kitware, Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#============================================================================= - -# GNUtoMS works only for the GNU toolchain on Windows (MinGW and MSys). -set(GNUtoMS 0) -if(NOT "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" OR NOT WIN32 OR CYGWIN) - return() -endif() - -# Locate auxiliary GNUtoMS files. -get_filename_component(GNUtoMS_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -set(GNUtoMS_DIR ${GNUtoMS_DIR}/GNUtoMS) - -if(NOT CMAKE_SIZEOF_VOID_P) - enable_language(C) # Find CMAKE_SIZEOF_VOID_P reliably. -endif() - -# Find MS development environment setup script for this architecture. -if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) - find_program(VCVARS32 NAMES vcvars32.bat - PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++;ProductDir]/bin" - ) - set(GNUtoMS_ENV "${VCVARS32}") - set(GNUtoMS_ARCH x86) -elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - find_program(VCVARSAMD64 NAMES vcvarsamd64.bat - PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/amd64" - ) - set(GNUtoMS_ENV "${VCVARSAMD64}") - set(GNUtoMS_ARCH amd64) -endif() - -if(GNUtoMS_ENV) - set(GNUtoMS 1) - - # Create helper script to run lib.exe from MS environment. - string(REPLACE "/" "\\" GNUtoMS_BAT "${GNUtoMS_ENV}") - set(LIB ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/GNUtoMSlib.bat) - configure_file(${GNUtoMS_DIR}/lib.bat.in ${LIB}) - - # Teach CMake how to create a MS import library at link time. - set(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "${CMAKE_Fortran_CREATE_SHARED_LIBRARY} -Wl,--output-def,.def" - " -Dlib=\"${LIB}\" -Ddef=\".def\" -Ddll=\"\" -Dimp=\"\" -P \"${GNUtoMS_DIR}/lib.cmake\"" - ) -endif() diff --git a/CMAKE/GNUtoMS/lib.bat.in b/CMAKE/GNUtoMS/lib.bat.in deleted file mode 100644 index 70d5f738..00000000 --- a/CMAKE/GNUtoMS/lib.bat.in +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -call "@GNUtoMS_BAT@" -lib /machine:"@GNUtoMS_ARCH@" %* diff --git a/CMAKE/GNUtoMS/lib.cmake b/CMAKE/GNUtoMS/lib.cmake deleted file mode 100644 index 6eaba62e..00000000 --- a/CMAKE/GNUtoMS/lib.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# Usage: cmake -Dlib=lib.bat -Ddef=out.def -Ddll=out.dll -Dimp=out.dll.a -P lib.cmake -get_filename_component(name ${dll} NAME) # .dll file name -string(REGEX REPLACE "\\.dll\\.a$" ".lib" out "${imp}") # .dll.a -> .lib -execute_process( - COMMAND ${lib} /def:${def} /name:${name} /out:${out} - RESULT_VARIABLE res - ) -if(res) - message(FATAL_ERROR "lib failed: ${res}") -endif() diff --git a/CMAKE/README-GNUtoMS.txt b/CMAKE/README-GNUtoMS.txt deleted file mode 100644 index 5844aaea..00000000 --- a/CMAKE/README-GNUtoMS.txt +++ /dev/null @@ -1,10 +0,0 @@ -The GNUtoMS CMake module helps LAPACK provide MS-compatible DLLs on -Windows when built with a free GNU Fortran compiler (e.g. MinGW). If -MS Visual Studio tools are installed when one configures LAPACK to -build with GNU tools the module extends the shared library link rule. -The extended rule creates both a GNU-style .dll.a import library and a -MS-format .lib import library. - -LAPACK CMake code installs the import libraries for both formats. -Applications built using CMake can be configured automatically to use -the import libraries matching the target toolchain. diff --git a/CMAKE/lapack-config-build.cmake.in b/CMAKE/lapack-config-build.cmake.in index e1ea54f8..8d60cc88 100644 --- a/CMAKE/lapack-config-build.cmake.in +++ b/CMAKE/lapack-config-build.cmake.in @@ -1,2 +1 @@ include("@LAPACK_BINARY_DIR@/lapack-targets.cmake") -@LAPACK_GNUtoMS_BUILD@ diff --git a/CMAKE/lapack-config-install.cmake.in b/CMAKE/lapack-config-install.cmake.in index b0e917d3..0c55fc17 100644 --- a/CMAKE/lapack-config-install.cmake.in +++ b/CMAKE/lapack-config-install.cmake.in @@ -1,3 +1,2 @@ get_filename_component(_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${_SELF_DIR}/lapack-targets.cmake) -@LAPACK_GNUtoMS_INSTALL@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 126760ad..3d4ccada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8.7) +set(CMAKE_GNUtoMS ON CACHE INTERNAL "") project(LAPACK Fortran) # Configure the warning and code coverage suppression file @@ -31,26 +32,12 @@ if (PYTHONINTERP_FOUND) 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() # -------------------------------------------------- @@ -280,7 +267,6 @@ 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} -- 2.34.1