homebrew-core/Formula/azure-storage-cpp.rb
2018-11-02 17:14:07 +01:00

55 lines
2.1 KiB
Ruby

class AzureStorageCpp < Formula
desc "Microsoft Azure Storage Client Library for C++"
homepage "https://azure.github.io/azure-storage-cpp"
url "https://github.com/Azure/azure-storage-cpp/archive/v5.1.1.tar.gz"
sha256 "29b4b0c47784ae541b0ef1b3693acba54e0d06bac78d139105a379ab1fd20333"
bottle do
cellar :any
sha256 "4484c83222736e6d4b3572a585766557aab5afe11f1ce8f454f76bba2a83d5a5" => :mojave
sha256 "bd4d979c9291c0c37284fc870e4b987686e738782aed9c167a6c27e3b56f7d27" => :high_sierra
sha256 "f5a3ccb959b0d3ad2874e46ec73496b4ac7d04a6eab5b1e388c3a7a999d424b3" => :sierra
end
depends_on "cmake" => :build
depends_on "boost"
depends_on "cpprestsdk"
depends_on "gettext"
depends_on "openssl"
depends_on "ossp-uuid"
def install
system "cmake", "Microsoft.WindowsAzure.Storage",
"-DBUILD_SAMPLES=OFF",
"-DBUILD_TESTS=OFF",
*std_cmake_args
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <was/common.h>
#include <was/storage_account.h>
using namespace azure;
int main() {
utility::string_t storage_connection_string(_XPLATSTR("DefaultEndpointsProtocol=https;AccountName=myaccountname;AccountKey=myaccountkey"));
try {
azure::storage::cloud_storage_account storage_account = azure::storage::cloud_storage_account::parse(storage_connection_string);
return 0;
}
catch(...){ return 1; }
}
EOS
flags = ["-stdlib=libc++", "-std=c++11", "-I#{include}",
"-I#{Formula["boost"].include}",
"-I#{Formula["openssl"].include}",
"-I#{Formula["cpprestsdk"].include}",
"-L#{Formula["boost"].lib}",
"-L#{Formula["cpprestsdk"].lib}",
"-L#{Formula["openssl"].lib}",
"-L#{lib}",
"-lcpprest", "-lboost_system-mt", "-lssl", "-lcrypto", "-lazurestorage"] + ENV.cflags.to_s.split
system ENV.cxx, "-o", "test_azurestoragecpp", "test.cpp", *flags
system "./test_azurestoragecpp"
end
end