aboutsummaryrefslogtreecommitdiff
path: root/ports/openblas
diff options
context:
space:
mode:
authorGriffin Downs <35574547+grdowns@users.noreply.github.com>2019-07-01 13:14:53 -0700
committerGitHub <noreply@github.com>2019-07-01 13:14:53 -0700
commit0b9cf040bafa0a8ed064e47459779d72fcf9b9c4 (patch)
tree53036c9f0b7f051abe737376f7ddeeeccd9948d0 /ports/openblas
parent34d19da9ffd0571bf16190ec4a16a04bef265900 (diff)
parent77cfd20b83e71a0c513658e7c4d049d4039905af (diff)
downloadvcpkg-0b9cf040bafa0a8ed064e47459779d72fcf9b9c4.tar.gz
vcpkg-0b9cf040bafa0a8ed064e47459779d72fcf9b9c4.zip
Merge branch 'master' into openssl-unix-dynamic
Diffstat (limited to 'ports/openblas')
-rw-r--r--ports/openblas/CONTROL3
-rw-r--r--ports/openblas/enable_underscore.patch70
-rw-r--r--ports/openblas/fix_space_path.patch (renamed from ports/openblas/fix-space-path.patch)0
-rw-r--r--ports/openblas/openblas_common.h72
-rw-r--r--ports/openblas/portfile.cmake50
-rw-r--r--ports/openblas/vcpkg-cmake-wrapper.cmake49
6 files changed, 151 insertions, 93 deletions
diff --git a/ports/openblas/CONTROL b/ports/openblas/CONTROL
index 40249c332..1c01d8363 100644
--- a/ports/openblas/CONTROL
+++ b/ports/openblas/CONTROL
@@ -1,3 +1,4 @@
Source: openblas
-Version: 0.3.6-2
+Version: 0.3.6-4
+Homepage: https://github.com/xianyi/OpenBLAS
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
diff --git a/ports/openblas/enable_underscore.patch b/ports/openblas/enable_underscore.patch
new file mode 100644
index 000000000..d2eb3ff22
--- /dev/null
+++ b/ports/openblas/enable_underscore.patch
@@ -0,0 +1,70 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9696961..47ef712 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -29,7 +29,7 @@ option(BUILD_RELAPACK "Build with ReLAPACK (recursive implementation of several
+ # 64 bit integer interfaces in OpenBLAS.
+
+ set(SYMBOLPREFIX "" CACHE STRING "Add a prefix to all exported symbol names in the shared library to avoid conflicts with other BLAS libraries" )
+-set(SYMBOLSUFFIX "" CACHE STRING "Add a suffix to all exported symbol names in the shared library, e.g. _64 for INTERFACE64 builds" )
++set(SYMBOLSUFFIX "_" CACHE STRING "Add a suffix to all exported symbol names in the shared library, e.g. _64 for INTERFACE64 builds" )
+ #######
+ if(BUILD_WITHOUT_LAPACK)
+ set(NO_LAPACK 1)
+@@ -232,7 +232,7 @@ if (BUILD_SHARED_LIBS AND BUILD_RELAPACK)
+ endif()
+ endif()
+
+-if (BUILD_SHARED_LIBS AND NOT ${SYMBOLPREFIX}${SYMBOLSUFIX} STREQUAL "")
++if (NOT ${SYMBOLPREFIX}${SYMBOLSUFFIX} STREQUAL "")
+ if (NOT DEFINED ARCH)
+ set(ARCH_IN "x86_64")
+ else()
+@@ -289,12 +289,14 @@ endif()
+ if (NOT ${SYMBOLSUFFIX} STREQUAL "")
+ message(STATUS "adding suffix ${SYMBOLSUFFIX} to names of exported symbols in ${OpenBLAS_LIBNAME}")
+ endif()
++if(BUILD_SHARED_LIBS)
+ add_custom_command(TARGET ${OpenBLAS_LIBNAME} POST_BUILD
+ COMMAND perl ${PROJECT_SOURCE_DIR}/exports/gensymbol "objcopy" "${ARCH}" "${BU}" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" \"${SYMBOLPREFIX}\" \"${SYMBOLSUFFIX}\" "${BUILD_LAPACK_DEPRECATED}" > ${PROJECT_BINARY_DIR}/objcopy.def
+ COMMAND objcopy -v --redefine-syms ${PROJECT_BINARY_DIR}/objcopy.def ${PROJECT_BINARY_DIR}/lib/lib${OpenBLAS_LIBNAME}.so
+ COMMENT "renaming symbols"
+ )
+ endif()
++endif()
+
+
+ # Install project
+@@ -385,4 +387,3 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
+ install(EXPORT "${PN}${SUFFIX64}Targets"
+ NAMESPACE "${PN}${SUFFIX64}::"
+ DESTINATION ${CMAKECONFIG_INSTALL_DIR})
+-
+diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake
+index 259ef16..936fbf7 100644
+--- a/cmake/prebuild.cmake
++++ b/cmake/prebuild.cmake
+@@ -58,10 +58,8 @@ endif ()
+ set(TARGET_CONF_TEMP "${PROJECT_BINARY_DIR}/${TARGET_CONF}.tmp")
+
+ # c_check
+-set(FU "")
+-if (APPLE OR (MSVC AND NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang"))
+- set(FU "_")
+-endif()
++set(FU "")
++set(BU "")
+
+ set(COMPILER_ID ${CMAKE_C_COMPILER_ID})
+ if (${COMPILER_ID} STREQUAL "GNU")
+@@ -75,7 +73,9 @@ file(WRITE ${TARGET_CONF_TEMP}
+ "#define ARCH_${UC_ARCH}\t1\n"
+ "#define C_${COMPILER_ID}\t1\n"
+ "#define __${BINARY}BIT__\t1\n"
+- "#define FUNDERSCORE\t${FU}\n")
++ "#define FUNDERSCORE\t${FU}\n"
++ "#define BUNDERSCORE\t${BU}\n"
++ "//#define NEEDBUNDERSCORE 1\n")
+
+ if (${HOST_OS} STREQUAL "WINDOWSSTORE")
+ file(APPEND ${TARGET_CONF_TEMP}
diff --git a/ports/openblas/fix-space-path.patch b/ports/openblas/fix_space_path.patch
index 1ceacd90a..1ceacd90a 100644
--- a/ports/openblas/fix-space-path.patch
+++ b/ports/openblas/fix_space_path.patch
diff --git a/ports/openblas/openblas_common.h b/ports/openblas/openblas_common.h
deleted file mode 100644
index 10b25d4c7..000000000
--- a/ports/openblas/openblas_common.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#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)
diff --git a/ports/openblas/portfile.cmake b/ports/openblas/portfile.cmake
index 1bd7b6157..45260c78a 100644
--- a/ports/openblas/portfile.cmake
+++ b/ports/openblas/portfile.cmake
@@ -1,9 +1,26 @@
include(vcpkg_common_functions)
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+ message(WARNING "You do not need this package on macOS, since you already have the Accelerate Framework")
+ return()
+endif()
+
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
message(FATAL_ERROR "openblas can only be built for x64 currently")
endif()
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(ADDITIONAL_PATCH "enable_underscore.patch")
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(NO_SHARED 1)
+endif()
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(NO_STATIC 1)
+endif()
+
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO xianyi/OpenBLAS
@@ -12,7 +29,8 @@ vcpkg_from_github(
HEAD_REF develop
PATCHES
uwp.patch
- fix-space-path.patch
+ fix_space_path.patch
+ ${ADDITIONAL_PATCH}
)
find_program(GIT NAMES git git.cmd)
@@ -26,8 +44,7 @@ vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH};${SED_EXE_PATH}")
-set(COMMON_OPTIONS
- -DBUILD_WITHOUT_LAPACK=ON)
+set(COMMON_OPTIONS -DBUILD_WITHOUT_LAPACK=ON)
# for UWP version, must build non uwp first for helper
# binaries.
@@ -60,7 +77,7 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
- OPTIONS
+ OPTIONS
${COMMON_OPTIONS}
-DCMAKE_SYSTEM_PROCESSOR=AMD64
-DVS_WINRT_COMPONENT=TRUE
@@ -76,28 +93,21 @@ else()
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
${COMMON_OPTIONS}
+ -DTARGET=SANDYBRIDGE
-DCMAKE_SYSTEM_PROCESSOR=AMD64
+ -DBINARY=64
+ -DNO_SHARED=${NO_SHARED}
+ -DNO_STATIC=${NO_STATIC}
-DNOFORTRAN=ON)
endif()
vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/OpenBLAS TARGET_PATH share/openblas)
-#maybe we need also to write a wrapper inside share/blas to search implicitly for openblas, whenever we feel it's ready for its own -config.cmake file
-
-# 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(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 "${CBLAS_H}")
-
-# openblas is BSD
-file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openblas)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/openblas/LICENSE ${CURRENT_PACKAGES_DIR}/share/openblas/copyright)
-
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/OpenBLAS)
+#we install a cmake wrapper since the official FindBLAS thinks that OpenBLAS can solve also LAPACK libraries, while it cannot because we disabled it and we use CLAPACK... maybe we have to trigger finding one package when requesting the other and vice-versa. Wrappers should be ready also to avoid an infinite loop
+file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/blas)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openblas RENAME copyright)
diff --git a/ports/openblas/vcpkg-cmake-wrapper.cmake b/ports/openblas/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 000000000..e0791bde8
--- /dev/null
+++ b/ports/openblas/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,49 @@
+list(REMOVE_ITEM ARGS "BLAS")
+list(REMOVE_ITEM ARGS "blas")
+list(REMOVE_ITEM ARGS "Blas")
+list(REMOVE_ITEM ARGS "NO_MODULE")
+list(REMOVE_ITEM ARGS "CONFIG")
+list(REMOVE_ITEM ARGS "MODULE")
+if(NOT BLAS_LIBRARY OR BLAS_LIBRARIES OR OpenBLAS_LIBRARY OR OpenBLAS_LIBRARIES OR BLAS_LIB OR BLAS_LIBS)
+ include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
+ include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+
+ _find_package(OpenBLAS CONFIG ${ARGS})
+
+ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+ _find_package(Threads)
+
+ get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+ set(BLAS_INCLUDE_DIR ${_loc})
+ get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_RELEASE)
+ if(NOT _loc)
+ get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_RELEASE)
+ endif()
+ set(BLAS_LIBRARY_RELEASE ${_loc})
+ get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_DEBUG)
+ if(NOT _loc)
+ get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_DEBUG)
+ endif()
+ set(BLAS_LIBRARY_DEBUG ${_loc})
+ list(APPEND BLAS_LIBRARY_RELEASE Threads::Threads)
+ list(APPEND BLAS_LIBRARY_DEBUG Threads::Threads)
+ select_library_configurations(BLAS)
+
+ set(BLAS_LIBRARY "${BLAS_LIBRARY}" CACHE STRING "" FORCE)
+ set(BLAS_LIBRARIES "${BLAS_LIBRARY}" CACHE STRING "" FORCE)
+ set(OpenBLAS_LIBRARY "${BLAS_LIBRARY}" CACHE STRING "" FORCE)
+ set(OpenBLAS_LIBRARIES "${BLAS_LIBRARY}" CACHE STRING "" FORCE)
+ set(BLAS_LIB "${BLAS_LIBRARY}" CACHE STRING "" FORCE)
+ set(BLAS_LIBS "${BLAS_LIBRARY}" CACHE STRING "" FORCE)
+
+ set(BLAS_INCLUDE_DIR "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE)
+ set(BLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE)
+ set(OpenBLAS_INCLUDE_DIR "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE)
+ set(OpenBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE)
+ set(BLAS_INC "${BLAS_INCLUDE_DIR}" CACHE STRING "" FORCE)
+
+ find_package_handle_standard_args(BLAS DEFAULT_MSG BLAS_LIBRARY BLAS_INCLUDE_DIR)
+ mark_as_advanced(BLAS_INCLUDE_DIR BLAS_LIBRARY)
+ find_package_handle_standard_args(OpenBLAS DEFAULT_MSG OpenBLAS_LIBRARY OpenBLAS_INCLUDE_DIR)
+ mark_as_advanced(OpenBLAS_INCLUDE_DIR OpenBLAS_LIBRARY)
+endif()