POCO C++ Libraries - Simplify C++ Development
poco的官网
https://pocoproject.org/about.html
Poco C++库简介
https://blog.csdn.net/lengye7/article/details/80782496
doc :
https://macchina.io/edge.html#learnmore
1.编译
1.1 linux下编译
这里的环境是ubuntu 16.04
<1>下载最新版本的代码:poco-poco-1.11.1-release.tar.gz
源代码下载
https://github.com/pocoproject/poco/releases/tag/poco-1.11.1-release
解压命令:
tar -zxf poco-poco-1.11.1-release.tar.gz
<2>查看readme.md文档,里面有相关的编译介绍,进行编译,操作如下:
看“Building with CMake (Linux, macOS, Windows)”
cd poco
mkdir cmake-build
cd cmake-build
cmake .. //配置安装目录:cmake -DCMAKE_INSTALL_PREFIX=/home/user ..
cmake --build . --config Release
sudo make install//默认安装到下面的路径
/usr/local/include/Poco/
/usr/local/lib
自己总结使用的操作命令:
//解压命令:
tar -zxf poco-poco-1.11.1-release.tar.gz
//poco-poco-1.11.1-release名字改成poco
mv poco-poco-1.11.1-release poco
cd poco
mkdir cmake-build
cd cmake-build
//arm32位交叉编译,默认只生产so动态库文件
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../mytoolchain.cmake -DCMAKE_INSTALL_PREFIX=./../../../bin
//或者不进行交叉编译
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./../../bin
//进行编译
make -j4
//安装到../../bin文件夹下
make install
新建mytoolchain.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++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /home/tf/work/project/rv1126_rv1109_v2.2.0_20210825/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf)
# 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)
这里采用绝对路径,编译器不用 加入到系统环境里
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
# where is the target environment
#SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
#SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
#SET(CMAKE_FIND_ROOT_PATH /home/rk/workdir/rock/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf)
#SET(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
#SET(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
SET(CMAKE_C_COMPILER /home/rk/workdir/jetson/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc)
SET(CMAKE_CXX_COMPILER /home/rk/workdir/jetson/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++)
SET(CMAKE_FIND_ROOT_PATH /home/rk/workdir/jetson/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/)
# 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)
2 日志Logger
POCO下的日志库封装成可以根据日期创建文件的单例类
https://blog.csdn.net/u014270740/article/details/51579002
C++ 使用Poco库实现日志操作
https://blog.csdn.net/flyfish1986/article/details/125091157
:实现了文件和终端的例子
POCO C++库学习和分析 -- 日志 (二)
https://www.dandelioncloud.cn/article/details/1503297904763797505
Poco::Logger 日志库使用示例(上): 带性能分析
https://blog.csdn.net/Osean_li/article/details/80101706
3 数据库
C++ 使用Poco库操作SQLite数据库
https://blog.csdn.net/flyfish1986/article/details/124864261
4 编码base64
C++ 使用Poco库进行base64编解码
https://blog.csdn.net/flyfish1986/article/details/126125263
5 文件读写
Poco库使用:文件目录操作
https://blog.csdn.net/yang1fei2/article/details/126770096
这个网址有介绍poco的其它模块使用