From 4d2260fea3c1e2d542f9c7dd4ed1322619dc4e5b Mon Sep 17 00:00:00 2001 From: John Date: Sat, 13 Oct 2018 14:56:21 +0200 Subject: [PATCH] vc: make missing libmvec non fatal [ci skip] --- ...b1ad007766c87a4b99cd0070df97e749b513.patch | 63 +++++++++++++++++++ srcpkgs/vc/patches/i686.patch | 11 ++++ srcpkgs/vc/template | 2 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/vc/patches/81b3b1ad007766c87a4b99cd0070df97e749b513.patch create mode 100644 srcpkgs/vc/patches/i686.patch diff --git a/srcpkgs/vc/patches/81b3b1ad007766c87a4b99cd0070df97e749b513.patch b/srcpkgs/vc/patches/81b3b1ad007766c87a4b99cd0070df97e749b513.patch new file mode 100644 index 00000000000..5d67bc910a8 --- /dev/null +++ b/srcpkgs/vc/patches/81b3b1ad007766c87a4b99cd0070df97e749b513.patch @@ -0,0 +1,63 @@ +From 81b3b1ad007766c87a4b99cd0070df97e749b513 Mon Sep 17 00:00:00 2001 +From: Matthias Kretz +Date: Mon, 15 Oct 2018 14:19:47 +0200 +Subject: [PATCH] CMake: Handle missing libmvec and less var pollution + +* If libmvec doesn't exist better just skip the rest of the libmvec code +* If it exists, don't keep the libmvec dependency in + CMAKE_REQUIRED_LIBRARIES, but use a temporary variable to restore the + variable after the CHECK_CXX_SOURCE_COMPILES calls. + +Fixes: gh-215 + +Signed-off-by: Matthias Kretz +--- + cmake/VcMacros.cmake | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git cmake/VcMacros.cmake cmake/VcMacros.cmake +index 9f4a50ed3..684b4ac9f 100644 +--- cmake/VcMacros.cmake ++++ cmake/VcMacros.cmake +@@ -174,8 +174,10 @@ macro(vc_set_preferred_compiler_flags) + + # Look for libmvec, which provides vectorized implementations of libm + find_library(Vc_LIB_MVEC mvec) +- set(CMAKE_REQUIRED_LIBRARIES ${Vc_LIB_MVEC}) +- CHECK_CXX_SOURCE_COMPILES(" ++ if(Vc_LIB_MVEC) ++ set(SAFE_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") ++ set(CMAKE_REQUIRED_LIBRARIES ${Vc_LIB_MVEC}) ++ CHECK_CXX_SOURCE_COMPILES(" + #include + extern \"C\" { + __m128 _ZGVbN4v_sinf(__m128); +@@ -188,7 +190,7 @@ __m128 f0(__m128 x) { return _ZGVbN4v_cosf(_ZGVbN4v_sinf(x)); } + __m128d f1(__m128d x) { return _ZGVbN2v_cos(_ZGVbN2v_sin(x)); } + int main() { return 0; } + " Vc_HAVE_SSE_SINCOS) +- CHECK_CXX_SOURCE_COMPILES(" ++ CHECK_CXX_SOURCE_COMPILES(" + #include + extern \"C\" { + __m256 _ZGVdN8v_sinf(__m256); +@@ -201,12 +203,14 @@ __m256 f0(__m256 x) { return _ZGVdN8v_cosf(_ZGVdN8v_sinf(x)); } + __m256d f1(__m256d x) { return _ZGVdN4v_cos(_ZGVdN4v_sin(x)); } + int main() { return 0; } + " Vc_HAVE_AVX_SINCOS) +- if(Vc_LIB_MVEC AND Vc_HAVE_SSE_SINCOS AND Vc_HAVE_AVX_SINCOS) +- option(USE_LIBMVEC "Use GNU's libmvec for vectorized sine and cosine" OFF) +- if(USE_LIBMVEC) +- set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_HAVE_LIBMVEC=1") ++ set(CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}") ++ if(Vc_HAVE_SSE_SINCOS AND Vc_HAVE_AVX_SINCOS) ++ option(USE_LIBMVEC "Use GNU's libmvec for vectorized sine and cosine" OFF) ++ if(USE_LIBMVEC) ++ set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_HAVE_LIBMVEC=1") ++ endif() + endif() +- endif() ++ endif(Vc_LIB_MVEC) + + set(_add_warning_flags false) + set(_add_buildtype_flags false) diff --git a/srcpkgs/vc/patches/i686.patch b/srcpkgs/vc/patches/i686.patch new file mode 100644 index 00000000000..f8d11505919 --- /dev/null +++ b/srcpkgs/vc/patches/i686.patch @@ -0,0 +1,11 @@ +--- CMakeLists.txt 2018-10-01 14:15:08.000000000 +0200 ++++ - 2018-10-15 16:05:46.593091232 +0200 +@@ -28,7 +28,7 @@ + + vc_determine_compiler() + +-if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|AMD64|amd64)") ++if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(i686|x86|AMD64|amd64)") + set(Vc_X86 TRUE) + elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(arm|aarch32|aarch64)") + message(WARNING "No optimized implementation of the Vc types available for ${CMAKE_SYSTEM_PROCESSOR}") diff --git a/srcpkgs/vc/template b/srcpkgs/vc/template index 7ab480550d9..37cee9a0759 100644 --- a/srcpkgs/vc/template +++ b/srcpkgs/vc/template @@ -1,7 +1,7 @@ # Template file for 'vc' pkgname=vc version=1.4.0 -revision=1 +revision=2 wrksrc="Vc-${version}" build_style=cmake configure_args="-DTARGET_ARCHITECTURE=generic"