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.10.0.tar.gz"
|
|
sha256 "de333da67f1cb3d1b30be118860531092467f18d24ca6b4d36f6623fecab0de0"
|
|
|
|
head "https://github.com/Microsoft/cpprestsdk.git", :branch => "development"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "cbe02f42a6c8b3804fcee855d0b80924454d04aeb2a74b90ec7f39cec2eefc1b" => :high_sierra
|
|
sha256 "bfd8212b40116123b8a9be9ff458bae43bb6b0f8411fb620927fcaadd529dd6c" => :sierra
|
|
sha256 "e225dc408d4d19714efd48243338f9fb545407cc6a3aeb6f7ddd66b2d516af43" => :el_capitan
|
|
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
|
|
#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
|