vcpkg/ports/clapack/use-other-blas-and-install-include.patch
Han Hu 804a882695 add clapack port for lapack
add dependency

[clapack] Use COPYING from sources instead of checked in license.
2017-04-14 18:30:59 -07:00

104 lines
3.4 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 320ccc6..8c53def 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,9 @@ project(CLAPACK C)
enable_testing()
include(CTest)
+# BLAS_LIBRARIES
+find_package(BLAS REQUIRED)
+
if(WIN32 AND NOT CYGWIN)
set(SECOND_SRC ${CLAPACK_SOURCE_DIR}/INSTALL/winsecond.c)
set(DSECOND_SRC ${CLAPACK_SOURCE_DIR}/INSTALL/windsecnd.c)
@@ -19,7 +22,8 @@ if(NOT USE_BLAS_WRAP)
endif()
include_directories(${CLAPACK_SOURCE_DIR}/INCLUDE)
add_subdirectory(F2CLIBS)
-add_subdirectory(BLAS)
+
+# add_subdirectory(BLAS)
add_subdirectory(SRC)
add_subdirectory(TESTING)
set(CLAPACK_VERSION 3.2.1)
@@ -27,8 +31,13 @@ set(CPACK_PACKAGE_VERSION_MAJOR 3)
set(CPACK_PACKAGE_VERSION_MINOR 2)
set(CPACK_PACKAGE_VERSION_PATCH 1)
include(CPack)
-export(TARGETS f2c blas lapack FILE clapack-targets.cmake)
-configure_file(${CLAPACK_SOURCE_DIR}/clapack-config-version.cmake.in
- ${CLAPACK_BINARY_DIR}/clapack-config-version.cmake @ONLY)
-configure_file(${CLAPACK_SOURCE_DIR}/clapack-config.cmake.in
- ${CLAPACK_BINARY_DIR}/clapack-config.cmake @ONLY)
+# export(TARGETS f2c blas lapack FILE clapack-targets.cmake)
+# configure_file(${CLAPACK_SOURCE_DIR}/clapack-config-version.cmake.in
+# ${CLAPACK_BINARY_DIR}/clapack-config-version.cmake @ONLY)
+# configure_file(${CLAPACK_SOURCE_DIR}/clapack-config.cmake.in
+# ${CLAPACK_BINARY_DIR}/clapack-config.cmake @ONLY)
+
+install(FILES
+ ${CMAKE_CURRENT_LIST_DIR}/include/clapack.h
+ ${CMAKE_CURRENT_LIST_DIR}/include/f2c.h
+ DESTINATION include)
\ No newline at end of file
diff --git a/F2CLIBS/libf2c/CMakeLists.txt b/F2CLIBS/libf2c/CMakeLists.txt
index 43d7b3f..2bdbd05 100644
--- a/F2CLIBS/libf2c/CMakeLists.txt
+++ b/F2CLIBS/libf2c/CMakeLists.txt
@@ -58,5 +58,5 @@ if(WIN32)
endif()
include_directories(${CLAPACK_SOURCE_DIR}/F2CLIBS/libf2c)
include_directories(${CLAPACK_BINARY_DIR}/F2CLIBS/libf2c)
-add_library(f2c ${OFILES} ${CMAKE_CURRENT_BINARY_DIR}/arith.h)
+add_library(f2c STATIC ${OFILES} ${CMAKE_CURRENT_BINARY_DIR}/arith.h)
set_property(TARGET f2c PROPERTY PREFIX lib)
diff --git a/INCLUDE/clapack.h b/INCLUDE/clapack.h
index d22da98..5ef0a5b 100644
--- a/INCLUDE/clapack.h
+++ b/INCLUDE/clapack.h
@@ -3,6 +3,8 @@
#ifndef __CLAPACK_H
#define __CLAPACK_H
+#include "f2c.h"
+
/* Subroutine */ int caxpy_(integer *n, complex *ca, complex *cx, integer *
incx, complex *cy, integer *incy);
diff --git a/SRC/CMakeLists.txt b/SRC/CMakeLists.txt
index ac4cce3..0548c8d 100644
--- a/SRC/CMakeLists.txt
+++ b/SRC/CMakeLists.txt
@@ -375,6 +375,17 @@ endif()
if(BUILD_COMPLEX16)
set(ALLOBJ ${ZLASRC} ${ALLAUX} ${DZLAUX})
endif()
-add_library(lapack ${ALLOBJ} ${ALLXOBJ})
-target_link_libraries(lapack blas)
+if(BUILD_SHARED_LIBS AND MSVC)
+ add_library(lapack SHARED ${ALLOBJ} ${ALLXOBJ} ${CMAKE_CURRENT_LIST_DIR}/lapack.def)
+else()
+ add_library(lapack ${ALLOBJ} ${ALLXOBJ})
+endif(BUILD_SHARED_LIBS AND MSVC)
+
+
+target_link_libraries(lapack ${BLAS_LIBRARIES} f2c)
+
+install(TARGETS lapack
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
diff --git a/TESTING/MATGEN/CMakeLists.txt b/TESTING/MATGEN/CMakeLists.txt
index b2cb47a..54fa7a8 100644
--- a/TESTING/MATGEN/CMakeLists.txt
+++ b/TESTING/MATGEN/CMakeLists.txt
@@ -65,5 +65,5 @@ endif()
if(BUILD_COMPLEX16)
set(ALLOBJ $(ZMATGEN) $(DZATGEN))
endif()
-add_library(tmglib ${ALLOBJ} )
+add_library(tmglib STATIC ${ALLOBJ} )