由于发到CSDN的文章频繁被上会员锁,以后新发的文章都改到博客园上去,后面有条件考虑自己建博客,祝CSDN早日倒闭。
项目开始变离谱了,早期规划原因,GUI开发选用了AWTK,后面换了领导,由于进度原因,一些功能需要直接搬其他开发组的代码,然而这些代码用的都不是易搬运的三方,而是QT,QT的代码一点点改成AWTK上能用的方式,这就欲哭无泪了,后面这个任务干了一个月50%的时间都在搬运代码上。
AWTK没有QT那种signal/slot,而新功能的代码大量用到这个特性,后面发现boost库的signals2库能提供的类似的功能,借此机会,记录下Boost库的编译使用。
下载
测试库为:boost-1.89.0-cmake.tar.gz
tar -zxf boost-1.89.0-cmake.tar.gz
cd boost-1.89.0
编译
自带方法(b2)
./bootstrap.sh --prefix=~/thirdparty/boost/t113
在生成的project-config.jam中修改编译器地址为自己的交叉编译器:
# B2 Configuration
# Automatically generated by bootstrap.shimport option ;
import feature ;# Compiler configuration. This definition will be used unless
# you already have defined some toolsets in your user-config.jam
# file.
if ! gcc in [ feature.values <toolset> ]
{using gcc : arm : /opt/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc ;
}project : default-build <toolset>gcc ;...
然后:
./b2
./b2 install
不知道为什么报一堆错误,部分库编译不出来。
CMake(推荐)
能正常的把所有库都编出来。
build_cmake.sh
cmake -B build_t113 \-DCMAKE_SYSTEM_NAME=Linux \-DCMAKE_SYSTEM_PROCESSOR=arm \-DCMAKE_C_COMPILER=/opt/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc \-DCMAKE_CXX_COMPILER=/opt/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-g++ \-DCMAKE_BUILD_TYPE=Release \-DCMAKE_INSTALL_PREFIX=~/thirdparty/boost/t113 \-DBUILD_SHARED_LIBS=ON
./build_cmake.sh
cmake --build build_t113
cd build_t113
make install
VCPKG
最简单,可惜公司的网络环境没法用,只能乖乖下源码编译。
vcpkg install boost
参考
https://www.cnblogs.com/TaXueWuYun/p/15965640.html
Boost Getting Started