FreeCAD v0.19源码编译与VS2017+Qt5环境搭建
发布日期:2021-06-30 18:20:51 浏览次数:3 分类:技术文章

本文共 3353 字,大约阅读时间需要 11 分钟。

一、环境准备

VS2017,x64

cmake-3.14.5-win64-x64.msi

FreeCADLibs_12.1.2_x64_VC15.1.7z,源码依赖库,x64位,里面已集成boost/Qt5/Python等依赖环境,点击

依赖库下载:

FreeCAD LibPack Version 12.1.2 debug/release withVisual Studio 2017Qt 5.12.1PySide2 build against Qt 5.12.1Coin3D 4.0PivyPython 3.6.8OpenCascade 7.3Boost 1.67 (including the debug files build against python_d.exe)

源码:

 

二、CMake生成VS工程

1、建工程

注意,一定要选择x64,因为依赖库FreeCADLibs_12.1.2_x64_VC15.1.7z是64位的。这个很重要,如果误选了32位,则会报错:

CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2165 (message):  Unable to find the requested Boost libraries.  Boost version: 1.67.0  Boost include path: F:/CADCAM/FreeCADLibs_12.1.2_x64_VC15.1/include  Could not find the following Boost libraries:          boost_filesystem          boost_program_options          boost_regex          boost_system          boost_thread  Some (but not all) of the required Boost libraries were found.  You may  need to install these additional Boost libraries.  Alternatively, set  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT  to the location of Boost.Call Stack (most recent call first):  CMakeLists.txt:654 (find_package)CMake Error at CMakeLists.txt:670 (message):  =============================================  Required components:   filesystem;program_options;regex;system;thread  Not found, install the components:   filesystem;program_options;regex;system;thread  =============================================

2、指定依赖库的路径

3、勾选需要的功能模块

4、先后点击按钮Configure和Generate。OK!

 

三、异常处理

如果CMake点击按钮Configure过程有boost库相关的错误信息,请打开项目的CMakeLists.txt文件

F:\CADCAM\FreeCAD-master\CMakeLists.txt  ,手动添加以下三句话,会有更详细的提示信息。

set(Boost_DEBUG ON) #是否开启Boost Debug模式,ON位开启,OFF关闭。开启之后会输出很多调试信息,方便寻找错误

set(Boost_ARCHITECTURE "-x32") # CPU架构,对应库文件文件名里的x32或者x64
set(Boost_THREADAPI "win32") # 线程类型,对应thread模块文件名里面的pthread或者win32

 

四、编译源码及依赖文件拷贝

VS2017打开F:\CADCAM\FreeCAD-master\build\FreeCAD.sln,使用x64编译器编译。

编译比较耗时,需要耐心等待。编译完成之后,程序还无法正常运行,需要把相关依赖文件附上:

1.把

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\bin

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\data

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\resources

拷贝到源文件工程目录F:\CADCAM\FreeCAD-master\build\

resources文件夹的文件很重要,QWebEngine所需的一些关键文件

qtwebengine_resources.pakqtwebengine_resources_100pqtwebengine_resources_200p.pak.pakQtWebEngineProcess.exeicudtl.dat

缺失了它们,F:\CADCAM\FreeCAD-master\src\Mod\Web\Gui\BrowserView.cpp源码运行会报错,抛出异常。

QWebEngineProfile *profile = view->page()->profile();

 

2.把

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\plugins\iconengines

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\plugins\imageformats

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\plugins\platforms

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\plugins\printsupport

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\plugins\sqldrivers

拷贝到源文件工程目录F:\CADCAM\FreeCAD-master\build\bin

3.把

F:\CADCAM\FreeCADLibs_12.1.2_x64_VC15.1\translations\qtwebengine_locales

拷贝到源文件工程目录F:\CADCAM\FreeCAD-master\build\bin

 

五、其他版本同样适用

上述的方法,同样适用于以下环境:

VS2019+Qt5.12.9 x64+FreeCAD v0.18.5+FreeCADLibs_12.1.6_x64_VC15

main函数的入口:F:\Software\CADCAM\FreeCAD\FreeCAD-0.18.5\src\Main\MainGui.cpp

 

 

---

FreeCAD是一个基于OpenCASCADE的开源CAD/CAE工具。 OpenCASCADE是一套开源的CAD/CAM/CAE几何模型核心,来自法国Matra Datavision公司,是著名的CAD软件EUCLID的开发平台。

 入门教程

 社区

https://www.freecadweb.org/

https://www.freecadweb.org/wiki/CompileOnWindows 源码编译说明

 依赖库官方发布

 依赖库非官方纯私人发布,版本比较新

https://github.com/FreeCAD/FreeCAD_Conda 依赖库新方式

 官网

 

转载地址:https://libaineu2004.blog.csdn.net/article/details/95623091 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:开源项目推荐:我个人中意的Python/C++数学库(★精品收藏★)
下一篇:mono,让C#脱离.NET环境

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月15日 15时30分24秒