homebrew-core/Formula/xsimd.rb
2019-09-09 09:31:56 +10:00

52 lines
1.7 KiB
Ruby

class Xsimd < Formula
desc "Modern, portable C++ wrappers for SIMD intrinsics"
homepage "https://xsimd.readthedocs.io/en/latest/"
url "https://github.com/QuantStack/xsimd/archive/7.3.0.tar.gz"
sha256 "208b09d9056593460b2f87c5ad20f3d9e000b6306995c7672ea23c1b4a2fd616"
bottle do
cellar :any_skip_relocation
sha256 "9136e36828157d1331fc1bcb45e420b6edb288fe01f3805ce0017c0ff6e53616" => :mojave
sha256 "9136e36828157d1331fc1bcb45e420b6edb288fe01f3805ce0017c0ff6e53616" => :high_sierra
sha256 "947192d693d59d60c162f0d88eb19a9cf9493beb024cf9e553586b7c525c107a" => :sierra
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, aligned_allocator<double, XSIMD_DEFAULT_ALIGNMENT>>;
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