FreeCAD-0.19源码的编译配置(保姆级教程)

一、素材工具:

  1)Visual Studio 2019: Visual Studio 2019 社区版 – 下载最新免费版本

  2)CMake: Download | CMake

  3)(依赖库)LibPack: https://github.com/FreeCAD/FreeCAD/releases

  4)(源代码)Source Code:https://github.com/FreeCAD/FreeCAD/releases

       (https://github.com/FreeCAD/FreeCAD/releases中 下载文件以指出)

         选择0.19.1版本

        下载两个红箭头指出的文件即可

二、CMake过程

Delete Cache一下。(CMake file工具栏)

Step1:新建编译后的目标文件夹(例名:最好和源码和依赖库放一个文件夹下,好管理)

Step2:点击configure配置,选择vs2019  ×64

Step3:点击configure配置,出现的红区中修改(会弹出一个报错框,点掉就行)

              BUILD_ENABLE_CXX_STD        C++14

              BUILD_QT5                                 打勾

              FREECAD_LIBPACK_DIR          改为依赖库所在的绝对路径

           (例:D:\CAD\FreeCAD-0.19.1\FreeCADLibs_12.5.3_x64_VC17)

Step4:  再次点击configure配置,出现的红区中修改

             FREECAD_COPY_DEPEND_DIRS_TO_BUILD     打勾

             FREECAD_COPY_LIBPACK_BIN_TO_BUILD      打勾

             FREECAD_COPY_PLUGINS_BIN_TO_BULD       打勾

Step5:  点击configure配置,出现“Copying libpack 'bin' directory to build directory.”表示成功。                   该步骤是将依赖库所需的文件copy到cmake编译的bin件夹下,文件较多,耐心等待,直                  至Generate可点击。

Step6:点击Generate。

              Generate完成后CMakeFiles下会生成大量的文件。(完成如下图)      

三、编译教程

   官方教程:Compile on Windows:https ://wiki.freecadweb.org/Compile_on_Windows

   编译器要遵循相应的Lib库: 相应的源码要跟相应的Lib库对应,因为编译平台不一样可能会出问题。(应该是编译命名不一样会)。相应的源码和库的下载位置:https://github.com/FreeCAD/FreeCAD/releases

    Note: It is highly recommended to compile FreeCAD with the compiler version the LibPack is designed for. For example, you might run into problems compiling FreeCAD 0.19 using MSVC 15 because the LibPack for 0.19 is designed to be built with MSVC 17.

四、可能编译错误

     错误一: 源码FreeCAD-0.19.1(编译前最好先查看下)

        直接编译可能不成功,显示语法错误,要修改源码文件夹下\src\Mod\PartDesign\APP\ FeatureHole.cpp 中三处地方修改为一下。FreeCAD-0.19.1编译成功后是109个项目。

//Line1889:
throw Base::IndexError(std::string("Thread type '") + thread_type_string + "' unsupported");
//Line1902:
throw Base::IndexError(std::string("Cut type '") + cut_type_string + "' unsupported");
//Line1932: 
std::cerr << "Failed reading '" << f.filePath() << "' with: "<< e.what() << "\n";

        备注:修改错误后,光重新编译PartDesign是不行的,虽然生成成功6个,但是必须要重新ALL_BUILD才能建立起完整的整个。

错误二:pcl_macros.h文件报错,提示: “log2f”: 内部函数,不能定义

        定位到错误文件,将log2f改为log2_f

五、运行

       在vs中找到FreeCADMain右键设置为启动项。再次运行即可。

  • 6
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
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
### 回答1: 在安装 FreeCAD 时遇到依赖问题,提示缺少 libboost-regex1.74.0-icu6,解决这个问题需要安装所需的依赖项。 libboost-regex1.74.0-icu6 是 Boost 库的一个子模块,用于提供正则表达式的功能。缺少这个库可能是由于系统中缺少对应版本的 Boost 库所导致的。 解决方法如下: 1. 首先,需要确认操作系统中是否已经安装了 Boost 库。可以使用以下命令进行确认: ``` dpkg -l | grep libboost ``` 如果没有安装 Boost 库,请先安装对应版本的 Boost 库。可以使用以下命令进行安装: ``` sudo apt-get install libboost-all-dev ``` 2. 在安装 libboost-regex1.74.0-icu6 之前,需要添加一个 Ubuntu PPA(个人软件包存档)仓库,该仓库提供了最新的 FreeCAD 软件包及其依赖项。可以使用以下命令添加该仓库: ``` sudo add-apt-repository ppa:freecad-maintainers/freecad-stable ``` 3. 添加完仓库后,需要更新系统的软件包信息。可以使用以下命令进行更新: ``` sudo apt-get update ``` 4. 更新完软件包信息后,可以尝试安装 FreeCAD 以及所需的依赖项。可以使用以下命令进行安装: ``` sudo apt-get install freecad ``` 5. 安装完成后,可以使用以下命令启动 FreeCAD: ``` freecad ``` 以上是通过添加 PPA 仓库并安装对应的依赖项来解决 FreeCAD 安装中缺少 libboost-regex1.74.0-icu6 的问题。如果问题仍然存在,建议参考官方文档或社区支持寻求更多帮助。 ### 回答2: 在安装FreeCAD时遇到依赖项错误 "libfreecad-python3-0.19 : 依赖: libboost-regex1.74.0-icu6" 可能意味着你的系统缺少 libboost-regex1.74.0-icu6 这个库文件。 解决这个问题的一种方法是手动安装缺少的依赖项。你可以按照以下步骤进行操作: 1. 打开终端并输入以下命令以更新系统软件包列表: ``` sudo apt update ``` 2. 安装 libboost-regex1.74.0-icu6 依赖项: ``` sudo apt install libboost-regex1.74.0-icu6 ``` 3. 继续安装 FreeCAD: ``` sudo apt install freecad ``` 这样,系统应该能够正确安装 FreeCAD 软件包,并满足所有依赖项。 如果以上步骤仍然无法解决问题,你可以尝试从官方网站下载 FreeCAD 的最新版本,并根据其提供的安装说明进行安装。有时官方网站的版本可能与软件源中的版本不同,可能会解决某些依赖性问题。 总之,安装 FreeCAD 时遇到依赖项错误通常可以通过安装缺少的依赖项来解决。希望以上信息能够对你有所帮助。 ### 回答3: 要解决在安装FreeCAD时出现的libfreecad-python3-0.19报错,依赖于libboost-regex1.74.0-icu6的问题,您可以按照以下步骤解决。 1. 首先,检查您的系统上是否已安装libboost-regex1.74.0-icu6。您可以使用以下命令进行检查: ``` dpkg -l libboost-regex1.74.0-icu6 ``` 2. 如果返回结果显示未安装libboost-regex1.74.0-icu6,您可以尝试使用以下命令安装它: ``` sudo apt-get install libboost-regex1.74.0-icu6 ``` 3. 如果上述命令无法安装libboost-regex1.74.0-icu6,可能是因为您的软件包索引过期。您可以通过运行以下命令更新软件包索引: ``` sudo apt-get update ``` 4. 更新软件包索引后,再次尝试安装libboost-regex1.74.0-icu6: ``` sudo apt-get install libboost-regex1.74.0-icu6 ``` 5. 完成安装后,您可以再次尝试安装FreeCAD,应该不会再出现libfreecad-python3-0.19的依赖报错。 如果在安装过程中遇到其他问题,建议查看相关错误消息,以便进一步确定出错的原因,并尝试在开放源代码社区中寻求帮助或提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值