45 lines
1.8 KiB
Ruby
45 lines
1.8 KiB
Ruby
class Cpprestsdk < Formula
|
|
desc "C++ libraries for cloud-based client-server communication"
|
|
homepage "https://github.com/Microsoft/cpprestsdk"
|
|
# pull from git tag to get submodules
|
|
url "https://github.com/Microsoft/cpprestsdk.git",
|
|
:tag => "v2.10.13",
|
|
:revision => "9d8f544001cb74544de6dc8c565592f7e2626d6e"
|
|
head "https://github.com/Microsoft/cpprestsdk.git", :branch => "development"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "8690db034a59516774eb5e3d7b7d986d86054ea1ada3df2a341ed34a7c50d610" => :mojave
|
|
sha256 "8cac36203d1916c8f07bf1d79aa081f849c103c24ddd8479ec45f0cef869d1a3" => :high_sierra
|
|
sha256 "051cf1caed37d1f15c12f898308776ab57f014a92789ea138fa65f53bb2c4c62" => :sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "boost"
|
|
depends_on "openssl"
|
|
|
|
def install
|
|
system "cmake", "-DBUILD_SAMPLES=OFF", "-DBUILD_TESTS=OFF", "Release", *std_cmake_args
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cc").write <<~EOS
|
|
#include <iostream>
|
|
#include <cpprest/http_client.h>
|
|
int main() {
|
|
web::http::client::http_client client(U("https://github.com/"));
|
|
std::cout << client.request(web::http::methods::GET).get().extract_string().get() << std::endl;
|
|
}
|
|
EOS
|
|
flags = ["-stdlib=libc++", "-std=c++11", "-I#{include}",
|
|
"-I#{Formula["boost"].include}",
|
|
"-I#{Formula["openssl"].include}", "-L#{lib}",
|
|
"-L#{Formula["openssl"].lib}", "-L#{Formula["boost"].lib}",
|
|
"-lssl", "-lcrypto", "-lboost_random", "-lboost_chrono",
|
|
"-lboost_thread-mt", "-lboost_system-mt", "-lboost_regex",
|
|
"-lboost_filesystem", "-lcpprest"] + ENV.cflags.to_s.split
|
|
system ENV.cxx, "-o", "test_cpprest", "test.cc", *flags
|
|
system "./test_cpprest"
|
|
end
|
|
end
|