1.win下boost_1_84_0 vs2019 x64编译
2.å¦ä½ä½¿ç¨CMakeè¿è¡äº¤åç¼è¯
win下boost_1_84_0 vs2019 x64编译
在Windows下编译boost_1__0使用VS x环境,使用需分步进行。源码
首先,使用进入boost_1__0目录,源码贷款源码1002贷款源码双击bootstrap.bat生成b2.exe。使用
接着,源码源码城官网为编译动态库,使用执行特定指令,源码目录默认安装于C:\Boost。使用
具体指令如下:在boost_1__0目录下,源码运行./b2.exe install --toolset=msvc-.2 link=shared address-model= runtime-link=shared debug release architecture=x --build-type=complete stage。使用
接着,源码以boost log为例,使用开源小程序源码介绍CMake工程引入步骤。源码
打开项目文件,使用使用CMake引入boost库,芒果微课源码具体配置路径依据实际目录。
配置完成后,打开生成的同城门店源码工程进行编译。
通过以上步骤,成功在Windows下使用VS x环境编译boost_1__0。
å¦ä½ä½¿ç¨CMakeè¿è¡äº¤åç¼è¯
cmake交åç¼è¯é ç½®
å¾å¤æ¶åï¼æ们å¨å¼åçæ¶åæ¯é¢å¯¹åµå ¥å¼å¹³å°ï¼å æ¤ç±äºèµæºçéå¶éè¦ç¨å°ç¸å ³ç交åç¼è¯ãå³å¨ä½ host宿主æºä¸è¦çætargetç®æ æºçç¨åºãéé¢çµæ¯å°ç¸å ³å¤´æ件çåæ¢åç¼è¯å¨çéæ©ä»¥åç¯å¢åéçæ¹åçï¼æä»å¤©ä» ä» ç®åä»ç»ä¸ç¸å ³CMakeå¨é¢å¯¹äº¤åç¼è¯çæ¶åï¼éè¦åçä¸äºåå¤å·¥ä½ã
CMakeç»äº¤åç¼è¯é¢çäºä¸ä¸ªå¾å¥½çåéCMAKE_TOOLCHAIN_FILEï¼å®å®ä¹äºä¸ä¸ªæ件çè·¯å¾ï¼è¿ä¸ªæ件å³toolChainï¼éé¢setäºä¸ç³»åä½ éè¦æ¹åçåéåå±æ§ï¼å æ¬C_COMPILER,CXX_COMPILER,å¦æç¨Qtçè¯éè¦æ´æ¹QT_QMAKE_EXECUTABLE以åå¦æç¨BOOSTçè¯éè¦æ´æ¹çBOOST_ROOT(å ·ä½æ¥çç¸å ³Findxxx.cmakeéé¢æå®çè·¯å¾)ãCMake为äºä¸è®©ç¨æ·æ¯æ¬¡äº¤åç¼è¯é½è¦éæ°è¾å ¥è¿äºå½ä»¤ï¼å æ¤å®å¸¦æ¥toolChainæºå¶ï¼ç®èè¨ä¹å°±æ¯ä¸ä¸ªcmakeèæ¬ï¼å åµäºä½ éè¦æ¹å以åéè¦setçææ交åç¯å¢ç设置ã
toolChainèæ¬ä¸è®¾ç½®çå 个éè¦åé
1.CMAKE_SYSTEM_NAME:
å³ä½ ç®æ æºtargetæå¨çæä½ç³»ç»å称ï¼æ¯å¦ARMæè Linuxä½ å°±éè¦å"Linux",å¦æWindowså¹³å°ä½ å°±å"Windows",å¦æä½ çåµå ¥å¼å¹³å°æ²¡æç¸å ³OSä½ å³éè¦åæ"Generic",åªæå½CMAKE_SYSTEM_NAMEè¿ä¸ªåé被设置äºï¼CMakeæ认为æ¤æ¶æ£å¨äº¤åç¼è¯ï¼å®ä¼é¢å¤è®¾ç½®ä¸ä¸ªåéCMAKE_CROSSCOMPILING为TRUE.
2. CMAKE_C_COMPILER:
顾åæä¹ï¼å³Cè¯è¨ç¼è¯å¨ï¼è¿éå¯ä»¥å°åé设置æå®æ´è·¯å¾æè æ件åï¼è®¾ç½®æå®æ´è·¯å¾æä¸ä¸ªå¥½å¤å°±æ¯CMakeä¼å»è¿ä¸ªè·¯å¾ä¸å»å¯»æ¾ç¼è¯ç¸å ³çå ¶ä»å·¥å ·æ¯å¦linker,binutilsçï¼å¦æä½ åçæ件å带æarm-elfççåç¼ï¼CMakeä¼è¯å«å°å¹¶ä¸å»å¯»æ¾ç¸å ³ç交åç¼è¯å¨ã
3. CMAKE_CXX_COMPILER:
åä¸ï¼æ¤æ¶ä»£è¡¨çæ¯C++ç¼è¯å¨ã
4. CMAKE_FIND_ROOT_PATH:
æå®äºä¸ä¸ªæè å¤ä¸ªä¼å äºå ¶ä»æ索路å¾çæ索路å¾ãæ¯å¦ä½ 设置äº/opt/arm/ï¼ææçFind_xxx.cmakeé½ä¼ä¼å æ ¹æ®è¿ä¸ªè·¯å¾ä¸ç/usr/lib,/libçè¿è¡æ¥æ¾ï¼ç¶åæä¼å»ä½ èªå·±ç/usr/libå/libè¿è¡æ¥æ¾ï¼å¦æä½ æä¸äºåºæ¯ä¸è¢«å å«å¨/opt/arméé¢çï¼ä½ ä¹å¯ä»¥æ¾ç¤ºæå®å¤ä¸ªå¼ç»CMAKE_FIND_ROOT_PATH,æ¯å¦
set(CMAKE_FIND_ROOT_PATH /opt/arm /opt/inst)
该åéè½å¤ææå°éæ°å®ä½å¨ç»å®ä½ç½®ä¸è¿è¡æç´¢çæ ¹è·¯å¾ã该åéé»è®¤ä¸ºç©ºãå½ä½¿ç¨äº¤åç¼è¯æ¶ï¼è¯¥åéååæç¨ï¼ç¨è¯¥åéæåç®æ ç¯å¢çæ ¹ç®å½ï¼ç¶åCMakeå°ä¼å¨é£éæ¥æ¾ã
5. CMAKE_FIND_ROOT_PATH_MODE_PROGRAM:
对FIND_PROGRAM()èµ·ä½ç¨ï¼æä¸ç§åå¼ï¼NEVER,ONLY,BOTH,第ä¸ä¸ªè¡¨ç¤ºä¸å¨ä½ CMAKE_FIND_ROOT_PATHä¸è¿è¡æ¥æ¾ï¼ç¬¬äºä¸ªè¡¨ç¤ºåªå¨è¿ä¸ªè·¯å¾ä¸æ¥æ¾ï¼ç¬¬ä¸ä¸ªè¡¨ç¤ºå æ¥æ¾è¿ä¸ªè·¯å¾ï¼åæ¥æ¾å ¨å±è·¯å¾ï¼å¯¹äºè¿ä¸ªåéæ¥è¯´ï¼ä¸è¬é½æ¯è°ç¨å®¿ä¸»æºçç¨åºï¼æ以ä¸è¬é½è®¾ç½®æNEVER
6. CMAKE_FIND_ROOT_PATH_MODE_LIBRARY:
对FIND_LIBRARY()èµ·ä½ç¨ï¼è¡¨ç¤ºå¨é¾æ¥çæ¶åçåºçç¸å ³é项ï¼å æ¤è¿ééè¦è®¾ç½®æONLYæ¥ä¿è¯æ们çåºæ¯å¨äº¤åç¯å¢ä¸æ¾ç.
7. CMAKE_FIND_ROOT_PATH_MODE_INCLUDE:
对FIND_PATH()åFIND_FILE()èµ·ä½ç¨ï¼ä¸è¬æ¥è¯´ä¹æ¯ONLY,å¦æä½ æ³æ¹åï¼ä¸è¬ä¹æ¯å¨ç¸å ³çFINDå½ä»¤ä¸å¢å optionæ¥æ¹åå±é¨è®¾ç½®ï¼æNO_CMAKE_FIND_ROOT_PATH,ONLY_CMAKE_FIND_ROOT_PATH,BOTH_CMAKE_FIND_ROOT_PATH
8. BOOST_ROOTï¼
对äºéè¦booståºçç¨æ·æ¥è¯´ï¼ç¸å ³çbooståºè·¯å¾é ç½®ä¹éè¦è®¾ç½®ï¼å æ¤è¿éçè·¯å¾å³ARMä¸çboostè·¯å¾ï¼éé¢æincludeålibã
9. QT_QMAKE_EXECUTABLE:
对äºQtç¨æ·æ¥è¯´ï¼éè¦æ´æ¹ç¸å ³çqmakeå½ä»¤åæ¢æåµå ¥å¼çæ¬ï¼å æ¤è¿ééè¦æå®æç¸åºçqmakeè·¯å¾ï¼æå®å°qmakeæ¬èº«ï¼
toolChain demo
# this is required
SET(CMAKE_SYSTEM_NAME Linux)
# specify the cross compiler
SET(CMAKE_C_COMPILER /opt/arm/usr/bin/ppc_xx-gcc)
SET(CMAKE_CXX_COMPILER /opt/arm/usr/bin/ppc_xx-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/arm/ppc_xx /home/rickk/arm_inst)
# search for programs in the build host directories (not necessary)
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)
# configure Boost and Qt
SET(QT_QMAKE_EXECUTABLE /opt/qt-embedded/qmake)
SET(BOOST_ROOT /opt/boost_arm)
è¿æ ·å°±å®æäºç¸å ³toolChainçç¼åï¼ä¹åï¼ä½ å¯ä»¥çµæ´»çéæ©å°åºéç¨å®¿ä¸»æºçæ¬è¿æ¯å¼åæºçæ¬ï¼ä¹é´çåºå«ä» ä» æ¯ä¸æ¡-DCMAKE_TOOLCHAIN_FILE=./toolChain.cmakeï¼æ´ç½çæ¯ï¼å¦æä½ æå¾å¤ç¨åºéè¦å转移ï¼ä½ç®æ å¹³å°æ¯åä¸ä¸ªï¼ä½ ä» ä» éè¦åä¸ä»½toolChainæ¾å¨ä¸ä¸ªå°æ¹ï¼å°±å¯ä»¥ç»ææå·¥ç¨ä½¿ç¨ã
2024-11-06 13:35
2024-11-06 12:55
2024-11-06 12:36
2024-11-06 12:31
2024-11-06 12:22
2024-11-06 11:47