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.7",
|
|
:revision => "c4cef129e880a3f9c23a480e8c983793963173bb"
|
|
head "https://github.com/Microsoft/cpprestsdk.git", :branch => "development"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "b16e8f7394c60b072e83b2d926edefb87fba016895b7937f35714d459378d390" => :mojave
|
|
sha256 "eaa86feed491d58e54d5cf41fe8544a469a4893f0857384b74fc462531b33d49" => :high_sierra
|
|
sha256 "62a5e080f65be69341b14f41d92a68aa61d1aaaa913a4c5464d152264248ae9e" => :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
|