首页 > Web开发 > 详细

jsoncpp编译

时间:2020-04-22 14:40:50      阅读:73      评论:0      收藏:0      [点我收藏+]

源码获取

地址1:sourceforge.net

版本说明:比较旧的0.5.0版本,使用configure配置文件进行编译;

地址2:github.com

版本说明:包含其他历史版本,但通常下载的版本是0.10.x ,使用cmake编译,编译过程比较麻烦。

 

交叉编译

1.安装交叉编译工具链,并添加路径到PATH

2.编写配置文件toolchain.cmake

# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(CMAKE_C_COMPILER  arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
SET(CMAKE_STRIP arm-linux-gnueabihf-strip)

# where is the target environment 
SET(CMAKE_FIND_ROOT_PATH  /usr/local/arm-linux-gnueabihf-6.3)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

3.执行cmake指令,指定相关编译参数(编译类型,生成动态库,安装路径,配置文件)

cmake -DCMAKE_BUILD_TYPE=release       -DBUILD_SHARED_LIBS=ON       -DCMAKE_INSTALL_PREFIX=~/tmp/jsoncpp-0.10.7/build/orejia-install       -DCMAKE_TOOLCHAIN_FILE=~/tmp/jsoncpp-0.10.7/toolchain.cmake       ..

4.make

make && make install

 

jsoncpp编译

原文:https://www.cnblogs.com/orejia/p/12751413.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!