mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 02:39:08 +08:00
Merge pull request #931 from saedrna/master
Add openblas and clapack for blas and lapack backend, respectively
This commit is contained in:
commit
8f245259b9
4
ports/clapack/CONTROL
Normal file
4
ports/clapack/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: clapack
|
||||
Version: 3.2.1
|
||||
Description: CLAPACK (f2c'ed version of LAPACK)
|
||||
Build-Depends: openblas
|
1453
ports/clapack/lapack.def
Normal file
1453
ports/clapack/lapack.def
Normal file
File diff suppressed because it is too large
Load Diff
52
ports/clapack/portfile.cmake
Normal file
52
ports/clapack/portfile.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
# Common Ambient Variables:
|
||||
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
|
||||
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
|
||||
# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
|
||||
# PORT = current port name (zlib, etc)
|
||||
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
|
||||
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
|
||||
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
|
||||
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
|
||||
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
|
||||
#
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
message(FATAL_ERROR "openblas can only be built for x64 currently")
|
||||
endif()
|
||||
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/clapack-3.2.1-CMAKE)
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://www.netlib.org/clapack/clapack-3.2.1-CMAKE.tgz"
|
||||
FILENAME "clapack-3.2.1"
|
||||
SHA512 cf19c710291ddff3f6ead7d86bdfdeaebca21291d9df094bf0a8ef599546b007757fb2dbb19b56511bb53ef7456eac0c73973b9627bf4d02982c856124428b49
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
# apply patch can not add file
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/lapack.def DESTINATION ${SOURCE_PATH}/SRC)
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/use-other-blas-and-install-include.patch"
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
|
||||
# Disable this option if project cannot be built with Ninja
|
||||
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
|
||||
# OPTIONS_RELEASE -DOPTIMIZE=1
|
||||
# OPTIONS_DEBUG -DDEBUGGABLE=1
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
# Handle copyright
|
||||
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/clapack)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/clapack/COPYING ${CURRENT_PACKAGES_DIR}/share/clapack/copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
103
ports/clapack/use-other-blas-and-install-include.patch
Normal file
103
ports/clapack/use-other-blas-and-install-include.patch
Normal file
@ -0,0 +1,103 @@
|
||||
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} )
|
||||
|
@ -1,3 +1,3 @@
|
||||
Source: geographiclib
|
||||
Version: 1.47-patch1-2
|
||||
Version: 1.47-patch1-3
|
||||
Description: a small set of C++ classes for performing conversions between geographic, UTM, UPS, MGRS, geocentric, and local cartesian coordinates, for gravity (e.g., EGM2008), geoid height, and geomagnetic field (e.g., WMM2010) calculations, and for solving geodesic problems.
|
||||
|
@ -18,6 +18,10 @@ vcpkg_download_distfile(ARCHIVE
|
||||
SHA512 d8fdfd7ae093057ec1a4ab922457fe71a3fb9975df5b673c276d62a0e9c4f212dc63652830b9d89e3890bc96aafd335992943cf6a1bce8260acf932d1eb7abfd
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/remove-tools-and-fix-version.patch"
|
||||
)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
vcpkg_configure_cmake(
|
||||
@ -40,14 +44,39 @@ else()
|
||||
endif()
|
||||
|
||||
vcpkg_install_cmake()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake)
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
|
||||
file(GLOB GEOGRAPHICLIB_CMAKE_FILES ${CURRENT_PACKAGES_DIR}/cmake/*.cmake ${CURRENT_PACKAGES_DIR}/debug/cmake/*.cmake)
|
||||
file(COPY ${GEOGRAPHICLIB_CMAKE_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/share/geographiclib)
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/geographiclib-targets.cmake GEOGRAPHICLIB_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}/include" "\${_IMPORT_PREFIX}/../include" GEOGRAPHICLIB_MODULE "${GEOGRAPHICLIB_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/geographiclib/geographiclib-targets.cmake "${GEOGRAPHICLIB_MODULE}")
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/geographiclib-targets-debug.cmake GEOGRAPHICLIB_DEBUG_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/../debug" GEOGRAPHICLIB_DEBUG_MODULE "${GEOGRAPHICLIB_DEBUG_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/geographiclib/geographiclib-targets-debug.cmake "${GEOGRAPHICLIB_DEBUG_MODULE}")
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/geographiclib-namespace-targets-debug.cmake GEOGRAPHICLIB_DEBUG_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/../debug" GEOGRAPHICLIB_DEBUG_MODULE "${GEOGRAPHICLIB_DEBUG_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/geographiclib/geographiclib-namespace-targets-debug.cmake "${GEOGRAPHICLIB_DEBUG_MODULE}")
|
||||
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/cmake/geographiclib-targets-release.cmake GEOGRAPHICLIB_RELEASE_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/.." GEOGRAPHICLIB_RELEASE_MODULE "${GEOGRAPHICLIB_RELEASE_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/geographiclib/geographiclib-targets-release.cmake "${GEOGRAPHICLIB_RELEASE_MODULE}")
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/cmake/geographiclib-namespace-targets-release.cmake GEOGRAPHICLIB_RELEASE_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/.." GEOGRAPHICLIB_RELEASE_MODULE "${GEOGRAPHICLIB_RELEASE_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/geographiclib/geographiclib-namespace-targets-release.cmake "${GEOGRAPHICLIB_RELEASE_MODULE}")
|
||||
|
||||
|
||||
file(COPY ${CURRENT_BUILDTREES_DIR}/src/GeographicLib-1.47/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/geographiclib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/geographiclib/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/geographiclib/copyright)
|
||||
|
||||
file(GLOB EXE_FILES "${CURRENT_PACKAGES_DIR}/bin/*.exe" "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe")
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(REMOVE_RECURSE ${EXE_FILES})
|
||||
# file(REMOVE_RECURSE ${EXE_FILES})
|
||||
|
43
ports/geographiclib/remove-tools-and-fix-version.patch
Normal file
43
ports/geographiclib/remove-tools-and-fix-version.patch
Normal file
@ -0,0 +1,43 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e79923b..3448362 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -437,13 +437,13 @@ set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
# The list of subdirectories to process
|
||||
add_subdirectory (src)
|
||||
add_subdirectory (include/GeographicLib)
|
||||
-add_subdirectory (tools)
|
||||
-add_subdirectory (man)
|
||||
-add_subdirectory (doc)
|
||||
-add_subdirectory (js)
|
||||
-add_subdirectory (matlab)
|
||||
-add_subdirectory (python/geographiclib)
|
||||
-add_subdirectory (examples)
|
||||
+# add_subdirectory (tools)
|
||||
+# add_subdirectory (man)
|
||||
+# add_subdirectory (doc)
|
||||
+# add_subdirectory (js)
|
||||
+# add_subdirectory (matlab)
|
||||
+# add_subdirectory (python/geographiclib)
|
||||
+# add_subdirectory (examples)
|
||||
if (MSVC AND BUILD_NETGEOGRAPHICLIB)
|
||||
if (GEOGRAPHICLIB_PRECISION EQUAL 2)
|
||||
set (NETGEOGRAPHICLIB_LIBRARIES NETGeographicLib)
|
||||
diff --git a/cmake/project-config-version.cmake.in b/cmake/project-config-version.cmake.in
|
||||
index 3b3b9e8..a5ea344 100644
|
||||
--- a/cmake/project-config-version.cmake.in
|
||||
+++ b/cmake/project-config-version.cmake.in
|
||||
@@ -18,10 +18,10 @@ elseif (NOT (APPLE OR (NOT DEFINED CMAKE_SIZEOF_VOID_P) OR
|
||||
# since a multi-architecture library is built for that platform).
|
||||
set (REASON "sizeof(*void) = @CMAKE_SIZEOF_VOID_P@")
|
||||
set (PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
-elseif (MSVC AND NOT MSVC_VERSION STREQUAL "@MSVC_VERSION@")
|
||||
+# elseif (MSVC AND NOT MSVC_VERSION STREQUAL "@MSVC_VERSION@")
|
||||
# Reject if there's a mismatch in MSVC compiler versions
|
||||
- set (REASON "_MSC_VER = @MSVC_VERSION@")
|
||||
- set (PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
+# set (REASON "_MSC_VER = @MSVC_VERSION@")
|
||||
+# set (PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
elseif (NOT CMAKE_CROSSCOMPILING STREQUAL "@CMAKE_CROSSCOMPILING@")
|
||||
# Reject if there's a mismatch in ${CMAKE_CROSSCOMPILING}
|
||||
set (REASON "cross-compiling = @CMAKE_CROSSCOMPILING@")
|
3
ports/openblas/CONTROL
Normal file
3
ports/openblas/CONTROL
Normal file
@ -0,0 +1,3 @@
|
||||
Source: openblas
|
||||
Version: v0.2.19
|
||||
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
|
24
ports/openblas/install-openblas.patch
Normal file
24
ports/openblas/install-openblas.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ff42643..1a013ee 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -13,7 +13,7 @@ enable_language(ASM)
|
||||
enable_language(C)
|
||||
|
||||
if(MSVC)
|
||||
-set(OpenBLAS_LIBNAME libopenblas)
|
||||
+set(OpenBLAS_LIBNAME openblas)
|
||||
else()
|
||||
set(OpenBLAS_LIBNAME openblas)
|
||||
endif()
|
||||
@@ -174,6 +174,10 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
|
||||
SOVERSION ${OpenBLAS_MAJOR_VERSION}
|
||||
)
|
||||
|
||||
+install(TARGETS ${OpenBLAS_LIBNAME}
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ ARCHIVE DESTINATION lib)
|
||||
|
||||
# TODO: Why is the config saved here? Is this necessary with CMake?
|
||||
#Save the config files for installation
|
72
ports/openblas/openblas_common.h
Normal file
72
ports/openblas/openblas_common.h
Normal file
@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
#include "openblas_config.h"
|
||||
|
||||
#if defined(OPENBLAS_OS_WINNT) || defined(OPENBLAS_OS_CYGWIN_NT) || defined(OPENBLAS_OS_INTERIX)
|
||||
#define OPENBLAS_WINDOWS_ABI
|
||||
#define OPENBLAS_OS_WINDOWS
|
||||
|
||||
#ifdef DOUBLE
|
||||
#define DOUBLE_DEFINED DOUBLE
|
||||
#undef DOUBLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEEDBUNDERSCORE
|
||||
#define BLASFUNC(FUNC) FUNC##_
|
||||
#else
|
||||
#define BLASFUNC(FUNC) FUNC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef OPENBLAS_QUAD_PRECISION
|
||||
typedef struct {
|
||||
unsigned long x[2];
|
||||
} xdouble;
|
||||
#elif defined OPENBLAS_EXPRECISION
|
||||
#define xdouble long double
|
||||
#else
|
||||
#define xdouble double
|
||||
#endif
|
||||
|
||||
#if defined(OS_WINNT) && defined(__64BIT__)
|
||||
typedef long long BLASLONG;
|
||||
typedef unsigned long long BLASULONG;
|
||||
#else
|
||||
typedef long BLASLONG;
|
||||
typedef unsigned long BLASULONG;
|
||||
#endif
|
||||
|
||||
#ifdef OPENBLAS_USE64BITINT
|
||||
typedef BLASLONG blasint;
|
||||
#else
|
||||
typedef int blasint;
|
||||
#endif
|
||||
|
||||
#if defined(XDOUBLE) || defined(DOUBLE)
|
||||
#define FLOATRET FLOAT
|
||||
#else
|
||||
#ifdef NEED_F2CCONV
|
||||
#define FLOATRET double
|
||||
#else
|
||||
#define FLOATRET float
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Inclusion of a standard header file is needed for definition of __STDC_*
|
||||
predefined macros with some compilers (e.g. GCC 4.7 on Linux). This occurs
|
||||
as a side effect of including either <features.h> or <stdc-predef.h>. */
|
||||
#include <stdio.h>
|
||||
#define OPENBLAS_COMPLEX_STRUCT
|
||||
typedef struct { float real, imag; } openblas_complex_float;
|
||||
typedef struct { double real, imag; } openblas_complex_double;
|
||||
typedef struct { xdouble real, imag; } openblas_complex_xdouble;
|
||||
#define openblas_make_complex_float(real, imag) {(real), (imag)}
|
||||
#define openblas_make_complex_double(real, imag) {(real), (imag)}
|
||||
#define openblas_make_complex_xdouble(real, imag) {(real), (imag)}
|
||||
#define openblas_complex_float_real(z) ((z).real)
|
||||
#define openblas_complex_float_imag(z) ((z).imag)
|
||||
#define openblas_complex_double_real(z) ((z).real)
|
||||
#define openblas_complex_double_imag(z) ((z).imag)
|
||||
#define openblas_complex_xdouble_real(z) ((z).real)
|
||||
#define openblas_complex_xdouble_imag(z) ((z).imag)
|
71
ports/openblas/portfile.cmake
Normal file
71
ports/openblas/portfile.cmake
Normal file
@ -0,0 +1,71 @@
|
||||
# Common Ambient Variables:
|
||||
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
|
||||
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
|
||||
# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
|
||||
# PORT = current port name (zlib, etc)
|
||||
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
|
||||
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
|
||||
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
|
||||
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
|
||||
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
|
||||
#
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
|
||||
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
message(FATAL_ERROR "openblas can only be built for x64 currently")
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
message(WARNING "openblas only support dynamic link for msvc")
|
||||
set(VCPKG_LIBRARY_LINKAGE "dynamic")
|
||||
endif()
|
||||
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openblas-0.2.19)
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://codeload.github.com/xianyi/OpenBLAS/zip/v0.2.19"
|
||||
FILENAME "openblas-v0.2.19.zip"
|
||||
SHA512 d95dcd1ca5b3bdc5355969d10c22486f7e32f7dfc3a418b5d0a979d030e9f2ed242d2d78267a5896aa83d27b6041e13ee4c6694f9a589765535011eb22dad9e2
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/install-openblas.patch"
|
||||
)
|
||||
|
||||
# openblas require perl to generate .def for exports
|
||||
vcpkg_find_acquire_program(PERL)
|
||||
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
|
||||
set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}")
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS -DTARGET=NEHALEM -DBUILD_WITHOUT_LAPACK=ON
|
||||
# PREFER_NINJA # Disable this option if project cannot be built with Ninja
|
||||
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
|
||||
# OPTIONS_RELEASE -DOPTIMIZE=1
|
||||
# OPTIONS_DEBUG -DDEBUGGABLE=1
|
||||
)
|
||||
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
# openblas do not make the config file , so I manually made this
|
||||
# but I think in most case, libraries will not include these files, they define their own used function prototypes
|
||||
# this is only to quite vcpkg
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/openblas_common.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
||||
|
||||
file(COPY ${SOURCE_PATH}/config.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/include/config.h ${CURRENT_PACKAGES_DIR}/include/openblas_config.h)
|
||||
|
||||
file(READ ${SOURCE_PATH}/cblas.h CBLAS_H)
|
||||
string(REPLACE "#include \"common.h\"" "#include \"openblas_common.h\"" CBLAS_H ${CBLAS_H})
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/include/cblas.h)
|
||||
|
||||
# openblas is BSD
|
||||
file(COPY ${CURRENT_BUILDTREES_DIR}/src/OpenBLAS-0.2.19/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openblas)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/openblas/LICENSE ${CURRENT_PACKAGES_DIR}/share/openblas/copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
Loading…
Reference in New Issue
Block a user