您的位置:首页 > 编程语言 > C语言/C++

LeanCloud C++ SDK安装测试记录

2016-02-20 08:03 465 查看
LeanCloud C++ SDK以开源方式作为githum项目存在,地址是:https://github.com/leancloud/cpp-sdk。
此SDK的主要目的是为以Cocos2d-X为代表的C++开发框架提供支持。因为本人主要使用Cocos2d-X C++开发手机游戏,同时又想测试leancould的云存储支持技术,所以选择了LeanCloud C++ SDK。

此SDK不同于leancloud其他官方SDK,操作略有些麻烦,但也不尽然。以下是本人根据上面开源项目中提供的安装指南操作结果的记录。

注:
(1)测试环境为iMac,OS X:10.11
(2)根据官方论坛(https://forum.leancloud.cn/t/leancloud/1474)中说明『目前我们的 c++ sdk 还只有最基本的数据存储、查询功能,推送、聊天都还不支持。』这一说明的记录时间为:2015-07-07.

Prerequisites(前提准备)

安装homebrew, a package management tool for Mac OS X
开源网站中给出的安装命令格式为:
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
根据homebrew官方网站提示,我使用的命令方式如下:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"【说明】mac上默认已经安装了ruby、git和curl这样的基本工具。 href="/article/3709316.html" target=_blank>Homebrew的口号是『使 OS X 更完整』。你可以到其网址http://brew.sh处作详细了解。其实,/article/3709316.html这个短文已经对homebrew这个MAC上的工具作了足够的说明。当然,如果你是一位nodejs用户,则你对npm这样的管理工具一定不陌生;那么,homebrew之于Mac相当于npm之于nodejs。强烈建议你到homebrew官方网站参考最新的安装方式来安装homebrew到你的MAC上。有了homebrew后,再使用之安装其他工具便容易多了,安装的工具及步骤如下。

安装CMake。CMake是 cross-platform, open-source build system:
brew install cmake

Doxygen, the de facto standard tool for generating documentation from annotated C++ sources
brew install doxygen

Boost, a set of libraries for the C++ programming language that provide support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing.
brew install boost

注:这一步花费时间较长,可能要10多分钟。

Build(工程构建)

现在,使用上面安装的
cmake来构建我们的
C++ SDK,步骤如下:Get git submodules
$ git submodule init
$ git submodule update

build and install cpp-netlib
$ cd lib/cpp-netlib
$ mkdir cpp-netlib-build
$ cd cpp-netlib-build
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
$ make -j4 && make install

build and install jsoncpp
$ cd lib/jsoncpp
$ mkdir jsoncpp-build
$ cd jsoncpp-build
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
$ make -j4 && make install

build AVOSCloud C++ SDK
$ cd cpp-sdk
$ mkdir cpp-sdk-build
$ cd cpp-sdk-build
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
$ make -j4 && make install


本文出自 “青峰” 博客,请务必保留此出处http://zhuxianzhong.blog.51cto.com/157061/1743547
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: