homebrew-core/Formula/cpprestsdk.rb

43 lines
1.6 KiB
Ruby
Raw Normal View History

class Cpprestsdk < Formula
desc "C++ libraries for cloud-based client-server communication"
homepage "https://github.com/Microsoft/cpprestsdk"
url "https://github.com/Microsoft/cpprestsdk/archive/v2.7.0.tar.gz"
sha256 "d53593fda17bcac8f68af8bc3ba4ac638ea7e7480f43aa7f3350f6f200b0c63e"
2015-12-25 20:11:35 +00:00
2015-12-24 09:29:11 +00:00
bottle do
cellar :any
sha256 "f3d0e1fa77b872b9f0bf58ea363d5a6dce656e6f68e90cdb584d090f419d27e4" => :el_capitan
sha256 "85ecc71b5bb39cd4b29d0d4510b51bdbf0e2dad0e38022b221439b20cf472a7d" => :yosemite
sha256 "19b2c820dcc1671778bacad7b33f9f58b97c707f6f536c97b3e2518def239e4d" => :mavericks
end
depends_on "boost"
depends_on "openssl"
depends_on "cmake" => :build
def install
system "cmake", "-DBUILD_SAMPLES=OFF", "Release", *std_cmake_args
system "make", "install"
end
2015-12-25 20:11:35 +00:00
test do
(testpath/"test.cc").write <<-EOS.undent
#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
2015-12-25 20:11:35 +00:00
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