FreeCAD-0.19源码编译教程

一、前期准备

  • Visual Studio 2019
  • Cmake(下载地址
  • FreeCADLibs_12.1.2_x64_VC15,源码依赖库,x64位,里面已集成boost/Qt5/Python等依赖环境,点击详细说明,FreeCAD源码和第三方依赖库(下载地址

二、CMake生成VS工程

1、新建文件目录(FreeCADbuild)

注意:一定要将FreeeCAD源码和第三方库放在电脑的E盘下
在这里插入图片描述
2、双击打开CMake主程序
(1)路径选择FreeCAD源码位置,本次设置为:E:/freeCAD3/FreeCAD-0.19_pre
(2)路径是用来存放编译后文件,本次设置为:E:/freeCAD3/freeCADbuild
然后单击“Configure”;选择x64(注意,一定要选择x64,因为依赖库FreeCADLibs_12.1.2_x64_VC15是64位的。这个很重要,如果误选了32位,则会报错),单击“Finish”。
在这里插入图片描述
等待一会后,会出现错误,接下来就需要设置好依赖库和需要的组合键
在这里插入图片描述
3、设置FreeCAD第三方库路径

找到FREECAD_LIBPACK_DIR,将路径更改为第三方库的路径,我的位置是:E:\freeCAD3\FreeCADLibs_12.1.2_x64_VC15
在这里插入图片描述
4、FreeCAD组合键的选择

勾选上下面的组合键

BUILD_ASSEMBLY
BUILD_QT5
BUILD_TEMPLATE

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
5、FreeCAD的Web组合键

最好将FreeCAD的 BUILD_WEB 的功能取消勾选,这样可以避免后期的一些错误,并且这个功能一般不需要使用。
在这里插入图片描述
6、先点击按钮Configure,再次点击按钮Configure,最后点击Generate。

Qt5WebKitWidgets:    not needed (BUILD_WEB)
Qt5WebEngineWidgets:    not needed (BUILD_WEB)
Shiboken2:           5.12.2 [E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/Shiboken2-5.12.2] [E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/Shiboken2-5.12.2/../../../include/shiboken2]
PySide2:             5.12.2 [E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/PySide2-5.12.2/../../../include/PySide2]
PySide2Tools:        [E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/bin/pyside2-uic] [E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/bin/pyside2-rcc.exe]
Freetype:            2.9.1
OpenGLU:             glu32 [glu32][]
Coin3D:              [optimized;E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/lib/Coin4.lib;debug;E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/lib/Coin4d.lib] [E:/freeCAD3/FreeCADLibs_12.1.2_x64_VC15/include]
Matplotlib:          3.0.3
Rift:                not enabled (BUILD_VR)
Doxygen:             not found
Configuring done
Generating done

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

1、VS2019打开E:\freeCAD3\freeCADbuild\FreeCAD_trunk.sln,使用x64位,然后选中 ALL_BUILD 右键 - 生成

过程比较耗时,需要耐心等待(最后会显示成功个数为110)。

2、文件配置
(1)把 E:\freeCAD3\FreeCADLibs_12.1.2_x64_VC15\bin 文件下的所有文件拷贝到工程目录 E:\freeCAD3\freeCADbuild\bin 文件夹下。
(2)把 E:\freeCAD3\FreeCADLibs_12.1.2_x64_VC15\plugins\platforms 文件下的所有文件拷贝到工程目录 E:\freeCAD3\freeCADbuild\bin 文件夹下。
3、将FreeCADMain设置为启动项目,点击本地Windows调试器进行调试。

编译成功之后的画面
在这里插入图片描述

下面推荐几个学习FreeCAD常用的网站

http://free-cad.sourceforge.net/SrcDocu/files.html

https://iesensor.com/FreeCADDoc/0.16-dev/index.html

http://www.cppblog.com/eryar/archive/2016/05/08/213461.html

https://www.freecadweb.org/#

https://www.opencascade.com/content/download-center

https://www.opencascade.com/content/latest-release

  • 7
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 15
    评论
Module developer’s guide to FreeCAD source code by Qingfeng Xia http://www.iesensor.com • 2015-09-18 version 0.1 for FreeCAD version 0.16-dev • 2016-09-18 version 0.2 for FreeCAD version 0.17-dev License of this book This ebook is licensed the same as FreeCAD document license CC-BY 3.0 http://creativecommons.org/licenses/by/3.0/Contents 1 FreeCAD overview and architecture 7 1.1 Introduction to FreeCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2 Key features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3 Software architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.1 Key software libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.2 Mixed python and c++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3.3 GPL code will not be included into installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4 How 3D model are renderred . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.1 Selection of 3D visualization libarary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.2 Discussion of 3D rendering library selection on FreeCAD Forum . . . . . . . . . . . . . . . . . . . . . 8 1.5 Roadmap of FreeCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.1 Keep updated with main components: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.2 C++11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.3 Pyside 2 project for Qt 5.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2 Organisation of FreeCAD source code 11 2.1 Build system for FreeCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.1.1 Analysis of src/cMake/SMesh.cMake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2 List of files and folders in FreeCAD source folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3 List of modules in FreeCAD Mod folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4 Learning path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5 Learning OpenInventor/Coin3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5.1 OpenInventor in FreeCAD’s ViewProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5.2 Important classes in OpenInventor/Coin3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.5.3 Window System integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.5.4 Pivy: Coin3D ’s Python wrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3 Base, App and Main module 19 3.1 List of header files in Base folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.1.1 Frequently included headers files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.1.2 Correct way of using Sequencer in try-catch block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.1.3 String enconding utf8 and conversion into wchar_t QString . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2 Type, BaseClass, PyObjectBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2.1 Type system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2.2 src/Base/BaseClass.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.2.3 src/Base/PyObjectBase.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.2.4 src/Base/Persistence.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.2.5 GeoFeature: Base class of all geometric document objects . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.3 Unit scheme for physial quantity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.3.1 src/Base/Unit.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.3.2 src/Base/Quantity.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.4 List of header files in App folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.5 Property framewrok . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.5.1 Naming of property and PropertyEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.5.2 src/App/PropertyStandard.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.5.3 PropertyEnumeration, see src/App/Enumeration.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.5.4 Geometry related property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.5.5 File related property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

whb1815

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值