public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-cpp/xsimd/, dev-cpp/xsimd/files/
@ 2023-10-29  4:32 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-10-29  4:32 UTC (permalink / raw
  To: gentoo-commits

commit:     74a4e9affa766d87af997d9abe0d7b16bc903254
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 29 04:31:18 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 29 04:31:44 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74a4e9af

dev-cpp/xsimd: don't force -march=native

This both doesn't respect the user's flags and also breaks on some arches
like sparc which lacks -march=native.

Bug: https://bugs.gentoo.org/915926
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-cpp/xsimd/files/xsimd-11.1.0-no-march.patch | 71 +++++++++++++++++++++++++
 dev-cpp/xsimd/xsimd-11.1.0-r1.ebuild            | 58 ++++++++++++++++++++
 2 files changed, 129 insertions(+)

diff --git a/dev-cpp/xsimd/files/xsimd-11.1.0-no-march.patch b/dev-cpp/xsimd/files/xsimd-11.1.0-no-march.patch
new file mode 100644
index 000000000000..77ba1e2f2ef0
--- /dev/null
+++ b/dev-cpp/xsimd/files/xsimd-11.1.0-no-march.patch
@@ -0,0 +1,71 @@
+We both want to respect the user's CFLAGS, but also, not all of our arches support
+-march or -mtune.
+--- a/benchmark/CMakeLists.txt
++++ b/benchmark/CMakeLists.txt
+@@ -30,10 +30,6 @@ include(CheckCXXCompilerFlag)
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
+ 
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+-    if(NOT CMAKE_CXX_FLAGS MATCHES "-march" AND NOT CMAKE_CXX_FLAGS MATCHES "-arch" AND NOT CMAKE_OSX_ARCHITECTURES)
+-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
+-    endif()
+-
+     if(NOT MSVC)
+         CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_CPP11_FLAG)
+         if (ENABLE_XTL_COMPLEX)
+--- a/examples/CMakeLists.txt
++++ b/examples/CMakeLists.txt
+@@ -26,15 +26,6 @@ else()
+     message(STATUS "Tests build type is ${CMAKE_BUILD_TYPE}")
+ endif()
+ 
+-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+-    if (NOT CMAKE_CXX_FLAGS MATCHES "-march" AND NOT CMAKE_CXX_FLAGS MATCHES "-arch" AND NOT CMAKE_OSX_ARCHITECTURES)
+-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
+-    endif()
+-    if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang) # We are using clang-cl
+-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
+-    endif()
+-endif()
+-
+ add_executable(mandelbrot mandelbrot.cpp ${XSIMD_HEADERS})
+ set_property(TARGET mandelbrot PROPERTY CXX_STANDARD 14)
+ if(ENABLE_XTL_COMPLEX)
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -41,10 +41,6 @@ OPTION(XSIMD_ENABLE_WERROR "Turn on -Werror" OFF)
+ 
+ OPTION(CROSS_COMPILE_ARM "cross compile for ARM targets" OFF)
+ 
+-# Note: to compile on ARM (or cross compile), you may need to add the following:
+-# -DTARGET_ARCH="armv8-a -mfpu=neon -mfloat-abi=softfp -target arm-linux-gnueabi"
+-set(TARGET_ARCH "native" CACHE STRING "Target architecture arguments")
+-
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+     if (NOT WIN32 AND NOT ANDROID)
+         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-parameter -Wextra -Wreorder")
+@@ -79,10 +75,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
+         include_directories(/usr/${ARM_ARCH_DIRECTORY}/include/c++/${ARM_GCC_VER}/${ARM_ARCH_DIRECTORY}/)
+         include_directories(/usr/${ARM_ARCH_DIRECTORY}/include/c++/${ARM_GCC_VER}/)
+         include_directories(/usr/${ARM_ARCH_DIRECTORY}/include/)
+-        if(NOT CMAKE_CXX_FLAGS MATCHES "-march")
+-            message(STATUS "SETTING ARCH TO ${TARGET_ARCH}")
+-            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${TARGET_ARCH}")
+-        endif()
+         if(ARM_ARCH_DIRECTORY MATCHES "arm-linux-gnueabi")
+             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mfloat-abi=softfp -target arm-linux-gnueabi")
+         else ()
+@@ -91,13 +83,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
+         message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
+         message(STATUS "CMAKE_CXX_LINK_EXECUTABLE: ${CMAKE_CXX_LINK_EXECUTABLE}")
+     elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^ppc64"  OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
+-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=${TARGET_ARCH} -mtune=${TARGET_ARCH}")
+     elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "riscv64")
+         # Nothing specific
+     elseif(NOT WIN32)
+-        if(NOT CMAKE_CXX_FLAGS MATCHES "-march" AND NOT CMAKE_CXX_FLAGS MATCHES "-arch" AND NOT CMAKE_OSX_ARCHITECTURES)
+-            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${TARGET_ARCH}")
+-        endif()
+     endif()
+ endif()
+ 

diff --git a/dev-cpp/xsimd/xsimd-11.1.0-r1.ebuild b/dev-cpp/xsimd/xsimd-11.1.0-r1.ebuild
new file mode 100644
index 000000000000..2df99c4ac6a7
--- /dev/null
+++ b/dev-cpp/xsimd/xsimd-11.1.0-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="C++ wrappers for SIMD intrinsics"
+HOMEPAGE="https://github.com/xtensor-stack/xsimd"
+SRC_URI="https://github.com/xtensor-stack/${PN}/archive/refs/tags/${PV}.tar.gz
+	-> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+	doc? (
+		app-doc/doxygen
+		dev-python/breathe
+		dev-python/sphinx
+		dev-python/sphinx-rtd-theme
+	)
+	test? ( dev-cpp/doctest )"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-c++17.patch
+	"${FILESDIR}"/${PN}-11.1.0-no-march.patch
+)
+
+src_prepare() {
+	sed -i \
+		-e '/fPIC/d' \
+		test/CMakeLists.txt \
+		|| die
+	cmake_src_prepare
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DBUILD_TESTS=$(usex test)
+	)
+	cmake_src_configure
+}
+
+src_compile() {
+	cmake_src_compile
+	use doc && emake -C docs html
+}
+
+src_install() {
+	cmake_src_install
+	if use doc; then
+		dodoc -r docs/build/html
+	fi
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-29  4:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-29  4:32 [gentoo-commits] repo/gentoo:master commit in: dev-cpp/xsimd/, dev-cpp/xsimd/files/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox