homebrew-core/Formula/xsimd.rb

51 lines
1.5 KiB
Ruby

class Xsimd < Formula
desc "Modern, portable C++ wrappers for SIMD intrinsics"
homepage "https://xsimd.readthedocs.io/en/latest/"
url "https://github.com/xtensor-stack/xsimd/archive/refs/tags/10.0.0.tar.gz"
sha256 "73f818368b3a4dad92fab1b2933d93694241bd2365a6181747b2df1768f6afdd"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, all: "508e2ec083191ef2dfd9a5ac52e6cf0f6b86b171d7c8c4ba1e84fea652414c3f"
end
depends_on "cmake" => :build
def install
args = std_cmake_args
args << "-DBUILD_TESTS=OFF"
system "cmake", ".", *args
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <vector>
#include <type_traits>
#include "xsimd/memory/xsimd_alignment.hpp"
using namespace xsimd;
struct mock_container {};
int main(void) {
using u_vector_type = std::vector<double>;
using a_vector_type = std::vector<double, xsimd::default_allocator<double>>;
using u_vector_align = container_alignment_t<u_vector_type>;
using a_vector_align = container_alignment_t<a_vector_type>;
using mock_align = container_alignment_t<mock_container>;
if(!std::is_same<u_vector_align, unaligned_mode>::value) abort();
if(!std::is_same<a_vector_align, aligned_mode>::value) abort();
if(!std::is_same<mock_align, unaligned_mode>::value) abort();
return 0;
}
EOS
system ENV.cxx, "test.c", "-std=c++14", "-I#{include}", "-o", "test"
system "./test"
end
end