Microsoft Azure Storage Client Library for C++
Перейти к файлу
Guy Sherman 00d7e0257d Updates to gitignore, src/CMakeLists.txt and readme, per Han Zhu's requests
Removed the * from *.DS_Store in .gitignore

Removed ${WARNINGS} from the non-apple clause in src/CMakeLists.txt making it
equivalent to the non-apple behavior before this branch.

Updated README.md with instructions for building unit tests as the CMake module
for finding libunittest++ works now.
2016-06-17 08:28:44 +01:00
Microsoft.WindowsAzure.Storage Updates to gitignore, src/CMakeLists.txt and readme, per Han Zhu's requests 2016-06-17 08:28:44 +01:00
documentation Update Microsoft Azure Storage Client Library for C++ 2.0.0.md 2015-08-17 14:49:06 +08:00
packages [XSCL C++]Azure Storage Client Library for c++ v1.0 2015-04-28 16:46:19 +08:00
tools Azure Storage Client Library for C++ v2.1.0 2015-09-11 09:38:37 +08:00
.gitattributes Azure Storage Client Library for C++ v0.3.0 2014-05-15 11:29:20 -07:00
.gitignore Updates to gitignore, src/CMakeLists.txt and readme, per Han Zhu's requests 2016-06-17 08:28:44 +01:00
BreakingChanges.txt Azure Storage Client Library for C++ v2.3.0 2016-02-29 17:35:43 +08:00
CONTRIBUTING.md fix a typo 2016-04-06 08:59:32 +08:00
Changelog.txt Add more specific information in Changelog 2016-03-01 14:21:27 +08:00
Doxyfile Azure Storage Client Library for C++ v2.3.0 2016-02-29 17:35:43 +08:00
LICENSE.txt Repository setup 2013-12-18 10:25:45 -08:00
Microsoft.WindowsAzure.Storage.v120.sln change dependent unittest++ project name 2016-03-31 13:22:21 +08:00
Microsoft.WindowsAzure.Storage.v140.sln change dependent unittest++ project name 2016-03-31 13:22:21 +08:00
README.md Updates to gitignore, src/CMakeLists.txt and readme, per Han Zhu's requests 2016-06-17 08:28:44 +01:00
build.proj Azure Storage Client Library for C++ v2.1.0 2015-09-11 09:38:37 +08:00
build.sln Azure Storage Client Library for C++ v2.1.0 2015-09-11 09:38:37 +08:00
wastorage.nuspec Azure Storage Client Library for C++ v2.3.0 2016-02-29 17:35:43 +08:00
wastorage.v120.nuspec Bug fix, add constants.dat to install target 2016-05-19 10:25:04 +08:00
wastorage.v120.targets Azure Storage Client Library for C++ v2.1.0 2015-09-11 09:38:37 +08:00
wastorage.v140.nuspec Bug fix, add constants.dat to install target 2016-05-19 10:25:04 +08:00
wastorage.v140.targets Azure Storage Client Library for C++ v2.1.0 2015-09-11 09:38:37 +08:00

README.md

Azure Storage Client Library for C++ (2.3.0)

The Azure Storage Client Library for C++ allows you to build applications against Microsoft Azure Storage. For an overview of Azure Storage, see Introduction to Microsoft Azure Storage.

Features

  • Tables
    • Create/Delete Tables
    • Query/Create/Read/Update/Delete Entities
  • Blobs
    • Create/Read/Update/Delete Blobs
  • Queues
    • Create/Delete Queues
    • Insert/Peek Queue Messages
    • Advanced Queue Operations

Getting started

For the best development experience, we recommend that developers use the official Microsoft NuGet packages for libraries. NuGet packages are regularly updated with new functionality and hotfixes. Download the NuGet Package.

Requirements

To call Azure services, you must first have an Azure subscription. Sign up for a free trial or use your MSDN subscriber benefits.

Need Help?

Be sure to check out the Azure Storage Forum on MSDN if you need help, or use StackOverflow.

Collaborate & Contribute

We gladly accept community contributions.

For general suggestions about Azure, use our Azure feedback forum.

Download & Install

Via Git

To create a local clone of the source for the Azure Storage Client Library for C++ via git, type:

git clone https://github.com/Azure/azure-storage-cpp.git
cd azure-storage-cpp

Via NuGet

To install the binaries for the Azure Storage Client Library for C++, type the following into the NuGet Package Manager console:

Install-Package wastorage

Visual Studio Version

Starting from version 2.1.0, Azure Storage Client Library for C++ supports Visual Studio 2013 and Visual Studio 2015. In case you have the need to use Visual Studio 2012, please get version 2.0.0.

Dependencies

C++ REST SDK

The Azure Storage Client Library for C++ depends on the C++ REST SDK (codename "Casablanca") 2.8.0. It can be installed through NuGet or downloaded directly from GitHub.

Code Samples

To get started with the coding, please visit the following articles:

To accomplish specific tasks, please find the code samples at samples folder.

Getting Started on Linux

As mentioned above, the Azure Storage Client Library for C++ depends on Casablanca. Follow these instructions to compile it. Current version of the library depends on Casablanca version 2.8.0.

Once this is complete, then:

  • Clone the project using git:
git clone https://github.com/Azure/azure-storage-cpp.git

The project is cloned to a folder called azure-storage-cpp. Always use the master branch, which contains the latest release.

  • Install additional dependencies:
sudo apt-get install libxml++2.6-dev libxml++2.6-doc uuid-dev
  • Build the SDK for Release:
cd azure-storage-cpp/Microsoft.WIndowsAzure.Storage
mkdir build.release
cd build.release
CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release
make

In the above command, replace <path to Casablanca> to point to your local installation of Casablanca. For example, if the file libcpprest.so exists at location ~/Github/Casablanca/cpprestsdk/Release/build.release/Binaries/libcpprest.so, then your cmake command should be:

CASABLANCA_DIR=~/Github/Casablanca/cpprestsdk CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release

The library is generated under azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release/Binaries/.

To build and run unit tests:

  • Install UnitTest++ library:
sudo apt-get install libunittest++-dev
  • Build the test code:
CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON
make
  • Run unit tests
cd Binaries
vi test_configurations.json # modify test config file to include your storage account credentials
./azurestoragetest

To build sample code:

CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON
make

To run the samples:

cd Binaries
./samplesblobs            # run the blobs sample
./samplesjson             # run the tables sample with JSON payload
./samplestables           # run the tables sample
./samplesqueues           # run the queues sample

Please note the current build script is only tested on Ubuntu 14.04. Please update the script accordingly for other distributions.

Getting Started on OSX

Note that OSX is not officially supported yet, but it has been seen to work, YMMV. This build has been tested to work when the dependencies are installed via homebrew, YMMV if using FINK or MacPorts

Install dependecies with homebrew:

brew install libxml++ ossp-uuid openssl

As mentioned above, the Azure Storage Client Library for C++ depends on Casablanca. If you are using homebrew you can install it from there:

brew install cpprestsdk

Otherwise, you may need to build it. Follow these instructions to compile it. Current version of the library depends on Casablanca version 2.8.0.

Once this is complete, then:

  • Clone the project using git:
git clone https://github.com/Azure/azure-storage-cpp.git

The project is cloned to a folder called azure-storage-cpp. Always use the master branch, which contains the latest release.

Some notes about building:

  • If you're using homebrew, there seems to be an issue with the pkg-config files, which means that, by default, a -L flag to tell the linker where libintl lives is left out. We've accounted for this in our CMAKE file, by looking in the usual directory that homebrew puts those libs. If you are not using homebrew, you will get an error stating that you need to tell us where those libs live.

  • Similarly, for openssl, you don't want to use the version that comes with OSX, it is old. We've accounted for this in the CMAKE script by setting the search paths to where homebrew puts openssl, so if you're not using homebrew you'll need to tell us where a more recent version of openssl lives.

  • Build the SDK for Release if you are using hombrew:

cd azure-storage-cpp/Microsoft.WIndowsAzure.Storage
mkdir build.release
cd build.release
cmake .. -DCMAKE_BUILD_TYPE=Release
make
  • OR, Build the SDK for Release if you are not using homebrew
cd azure-storage-cpp/Microsoft.WindowsAzure.Storage
mkdir build.release
cd build.release
CASABLANCA_DIR=<path to casablanca> cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=<path to openssl> -DGETTEXT_LIB_DIR=<path to gettext lib dir>
make

In the above command, replace:

  • <path to Casablanca> to point to your local installation of Casablanca. For example, if the file libcpprest.so exists at location ~/Github/Casablanca/cpprestsdk/Release/build.release/Binaries/libcpprest.dylib, then should be ~/Github/Casablanca/cpprestsdk
  • <path to openssl> to your local openssl, it is recommended not to use the version that comes with OSX, rather use one from Homebrew or the like. This should be the path that contains the lib and include directories
  • <path to gettext lib dir> is the directory which contains libintl.dylib

For example you might use:

CASABLANCA_DIR=~/Github/Casablanca/cpprestsdk cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DGETTEXT_LIB_DIR=/usr/local/opt/gettext/lib

The library is generated under azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release/Binaries/.

To build and run unit tests:

  • Install UnitTest++ library:
brew install unittest-cpp
  • Build the test code:
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON
make
  • Run unit tests
cd Binaries
vi test_configurations.json # modify test config file to include your storage account credentials
./azurestoragetest

Learn More