44 lines
1.7 KiB
Ruby
44 lines
1.7 KiB
Ruby
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.9.0.tar.gz"
|
|
sha256 "217a41c7ff2bab82c372a120cbdb350371065df464d06bba1adbeb1590736e3e"
|
|
|
|
head "https://github.com/Microsoft/cpprestsdk.git", :branch => "development"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "49800ba45575a000f0dab63049c93c77e773d499975210e349034cc433857104" => :sierra
|
|
sha256 "728e26aa3123b5c88e54ebe1e20c43be307f088fb7f1bf0afea7b1767f35423c" => :el_capitan
|
|
sha256 "30121bc8ae67dfec5ab190645273d761d7902a5e1beea0ab00971e8c9a659c75" => :yosemite
|
|
end
|
|
|
|
depends_on "boost"
|
|
depends_on "openssl"
|
|
depends_on "cmake" => :build
|
|
|
|
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.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
|
|
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
|