-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathrange-v3.rb
46 lines (40 loc) · 1.32 KB
/
range-v3.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class RangeV3 < Formula
desc "Experimental range library for C++14/17/20"
homepage "https://ericniebler.github.io/range-v3/"
url "https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz"
sha256 "015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb"
license "BSL-1.0"
bottle do
rebuild 2
sha256 cellar: :any_skip_relocation, all: "2fdd480cc63593645c0cc98d62a3607bd22600df59de39e7425bd3f89bd69c82"
end
depends_on "cmake" => :build
def install
args = %w[
-DRANGE_V3_TESTS=OFF
-DRANGE_V3_HEADER_CHECKS=OFF
-DRANGE_V3_EXAMPLES=OFF
-DRANGE_V3_PERF=OFF
]
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
test do
(testpath/"test.cpp").write <<~CPP
#include <range/v3/all.hpp>
#include <iostream>
#include <string>
int main() {
std::string s{ "hello" };
ranges::for_each( s, [](char c){ std::cout << c << " "; });
std::cout << std::endl;
}
CPP
stdlib_ldflag = OS.mac? ? "-lc++" : "-lstdc++"
flags = [stdlib_ldflag]
flags << "-stdlib=libc++" if OS.mac?
system ENV.cc, "test.cpp", "-std=c++14", *flags, "-o", "test"
assert_equal "h e l l o \n", shell_output("./test")
end
end