Compile on Windows/zh-cn

本页面将逐步讲解如何在 Windows 系统上编译 FreeCAD 0.19 或更新版本,使用的编译器是微软的 MSVC。若需了解使用 MSYS2/MinGW 进行编译的方法,请参阅MinGW 编译指南。其他平台的编译说明详见编译指南

前置条件

在 Windows 上编译 FreeCAD 需要多个工具和库。

必需依赖

注意:强烈建议使用 LibPack 设计对应的编译器版本来编译 FreeCAD。例如,如果您使用 MSVC 2017 编译 FreeCAD 0.20,可能会遇到问题,因为 LibPack 是为 MSVC 2019 或更高版本设计的。
如需后续更新 LibPack,请参阅更新 LibPack章节。

可选程序

下文中我们将使用 TortoiseGit 前端来说明源代码管理操作。该前端直接集成到 Windows 文件资源管理器中,并拥有庞大的用户社区,遇到问题时可以方便地获取帮助。

源代码

现在您可以获取 FreeCAD 的源代码了:

使用前端

Git 前端的使用方法

TortoiseGit:

  1. 新建一个用于存放源代码的文件夹。
  2. 在 Windows 文件资源管理器中右键点击该文件夹,从菜单中选择 Git Clone
  3. 会弹出一个对话框
  4. 输入 FreeCAD 的 Git 仓库地址:
    https://github.com/FreeCAD/FreeCAD.git
  5. 点击 OK

最新源代码将从 FreeCAD 的 Git 仓库下载,同时该文件夹将被 Git 纳入跟踪。

使用命令行

要创建本地跟踪分支并下载源代码,请打开终端(命令提示符),切换到您希望存放源代码的目录,然后输入:

git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git

编译器

默认的(推荐的)编译器是 MS Visual Studio (MSVC)。虽然理论上可以使用其他编译器(例如通过 Cygwin 或 MinGW 使用 gcc),但这些编译方式未经测试,本文档也不会对其进行说明。

您可以下载 MS Visual Studio 的 Community来免费获取 MSVC(供个人使用)。

若仅需编译器而不想安装庞大的 MSVC,请参阅 CompileOnWindows - Reducing Disk Footprint

注意:虽然 MSVC 的 Community 版是免费的,但如果要使用其 IDE 超过 30 天试用期,则必须注册微软账户。若仅通过命令行编译,则无需使用 IDE,因此也不需要微软账户。

如果想要自由开源的替代 IDE,您可以使用 KDevelop。该工具可用于编写和修改 C++ 代码,但编译仍需通过命令行完成。

可选配置:系统 PATH

您可以选择将某些文件夹的路径添加到系统 PATH 变量中。这样做的好处是:既可以直接通过命令行/PowerShell 访问这些文件夹中的程序,也能让编译器或 CMake 找到特定的程序。此外,如果在安装程序时没有勾选相关选项,可能也需要手动添加路径到 PATH 变量。

要将文件夹路径添加到 PATH 环境变量中,请按以下步骤操作:

  1. 在 Windows 开始菜单中右键点击计算机并选择属性
  2. 在弹出的窗口中点击高级系统设置
  3. 在新对话框中选择高级选项卡,点击环境变量
  4. 在环境变量对话框中选中Path变量,点击编辑
  5. 在编辑环境变量对话框中点击新建,然后添加 Git 或 LibPack 的文件夹路径。
  6. 最后点击确定保存,并依次关闭所有对话框。

配置

当你准备好所有必需的工具、库和 FreeCAD 源代码后,就可以开始配置和编译流程了。该过程将分为五个步骤进行:

  1. 先运行一次 CMake 来检测系统并启动配置流程(这次会显示失败)。
  2. 调整必要的 CMake 设置,指定 LibPack 路径并启用 Qt5 支持。
  3. 再次运行 CMake 完成最终配置(这次应该会成功)。
  4. 通过 CMake 生成 Visual Studio 构建系统。
  5. 使用 Visual Studio 编译 FreeCAD。

CMake

首先,使用 CMake 配置构建环境:

  1. 打开 CMake GUI。
  2. 指定 FreeCAD 的源代码目录。
  3. 指定一个构建目录。这个目录可以是源代码文件夹下的 build 文件夹,因为该路径会被 git 忽略,但不要直接使用源代码文件夹。如果该目录不存在,CMake 会自动创建。
  4. 点击 Configure
  5. 在弹出的对话框中,指定要使用的生成器:大多数情况下使用默认选项即可。对于标准的 MS Visual Studio,选择 Visual Studio xx 2yyy,其中 xx 是编译器版本,2yyy 是其发布年份。建议使用默认选项 Use default native compilers

注意:必须指定正确的位数版本。如果使用 64 位的 LibPack,则必须同样选择 x64 编译器。

这将开始配置过程,而且会失败,因为缺少相关设置。这是正常现象,因为你尚未指定 LibPack 的位置。不过,也可能会出现其他错误,需要你进一步处理。

如果配置失败并提示找不到 Visual Studio,则说明尚未安装 MSVC 的 CMake 支持组件。请按以下步骤操作:

  1. 打开 MSVC IDE
  2. 点击菜单中的工具 → 获取工具和功能
  3. 工作负载选项卡中勾选使用 C++ 的桌面开发
  4. 此时右侧应显示 Visual C++ tools for CMake 组件将被安装。
  5. 安装。

若未出现关于 Visual Studio 或 Python 的错误,则一切正常,但 CMake 尚未获取所有必要配置。此时需进行以下操作:

  1. 在 CMake 中搜索变量 FREECAD_LIBPACK_DIR,并指定之前下载的 LibPack 文件夹路径。注意请使用正斜杠“/”,反斜杠“\”会导致 CMake 失败。
  2. 若编译 FreeCAD 0.19)搜索变量 BUILD_QT5 并启用该选项。
  3. 再次点击 Configure
  4. 若计划直接从构建目录运行程序,例如用于调试)搜索并启用以下选项:
    • FREECAD_COPY_DEPEND_DIRS_TO_BUILD
    • FREECAD_COPY_LIBPACK_BIN_TO_BUILD
    • FREECAD_COPY_PLUGINS_BIN_TO_BUILD
  5. 再次点击 Configure

此时应该不再报错。如果仍遇到无法解决的问题,请访问 FreeCAD 论坛的 Install/Compile forum。若 CMake 运行无误,点击 Generate。完成后即可关闭 CMake,并使用 Visual Studio 开始编译 FreeCAD。不过,首次编译时建议保持 CMake 开启,以便随时调整构建选项。

构建选项

CMake 构建系统允许您控制构建过程的某些方面。具体来说,您可以通过 CMake 变量来启用或禁用某些功能和模块。

以下是其中部分变量的描述:

Variable name Description Default
BUILD_XXX Build FreeCAD with the component XXX. If you don't want/need to compile e.g. the workbench OpenSCAD, disable the variable BUILD_OPENSCAD. FreeCAD will then not have this workbench.

Note: Some components are required for other components. If you for example uncheck BUILD_ROBOT CMake will inform you that then the component Path cannot be compiled correctly. Therefore check the CMake output after you changed a BUILD_XXX option!

depends
BUILD_ENABLE_CXX_STD The version of the C++ language standard. C++14 is the highest possible for FreeCAD 0.19 while at least C++17 is required for FreeCAD 0.20. See also the note in the section Building with Visual Studio 15 (2017) and 16 (2019) depends
BUILD_DESIGNER_PLUGIN To build the Qt Designer plugin, see this section below OFF
BUILD_FLAT_MESH Necessary to have a build that includes the CreateFlatMesh feature OFF
CMAKE_INSTALL_PREFIX The output folder when building the target INSTALL, see also the section Running and installing FreeCAD Windows default program installation folder
FREECAD_COPY_DEPEND_DIRS_TO_BUILD Copies depending libraries needed to execute the FreeCAD.exe to the build folder. See also the section Running and installing FreeCAD.
Note: the options FREECAD_COPY_XXX only appear if the libraries were not already copied. If you only need to upgrade/change to another LibPack version, see the section Updating the LibPack. If you want to bring back the options for some reason, you need to delete all folders in your build folder, except for the LibPack folder. In CMake delete the cache and start as if you compile for the first time.
OFF
FREECAD_COPY_LIBPACK_BIN_TO_BUILD Copies the LibPack binaries needed to execute the FreeCAD.exe to the build folder. See also the section Running and installing FreeCAD. OFF
FREECAD_COPY_PLUGINS_BIN_TO_BUILD Copies Qt's plugin files needed to execute the FreeCAD.exe to the build folder. See also the section Running and installing FreeCAD. OFF
FREECAD_LIBPACK_USE Switch the usage of the FreeCAD LibPack on or off ON
FREECAD_LIBPACK_DIR Directory where the LibPack is FreeCAD's source code folder
FREECAD_RELEASE_PDB Create debug libraries (*.pdb) also for release builds. It doesn't affect the speed (like a real debug build would do) and can be very useful to locate crashes in FreeCAD code. In case FreeCAD crashes a crash.dmp file will be created that can be loaded with MSVC and if you have the corresponding PDB files plus the source code of that version you can debug through the code. Without the PDB files it's not possible to debug the code and all what the debugger shows is the name of the DLL where the crash has occurred. ON
FREECAD_USE_MP_COMPILE_FLAG Adds the /MP (multiprocessor) option to the Visual Studio projects, enabling speedups on multi-core CPUs. This can greatly accelerate builds on modern processors.
Note: If you turn off FREECAD_USE_PCH, the compilation can quickly overload your heap space, even if you have 16 GB RAM.
ON
FREECAD_USE_PCH Precompiles the headers in order to save compilation time. ON
FREECAD_USE_PYBIND11 Includes the PyBind11 library. Necessary to have a build that includes the CreateFlatMesh feature.
Note: after turning it on you might get a configuration error. Just configure again and the problem should go away.
OFF

构建 FreeCAD

根据您使用的编译器不同,构建 FreeCAD 的过程会略有差异。本章节将描述已知的工作流程。如果您使用 Qt Creator 进行构建,请跳转至使用 Qt Creator 构建(已过时),否则请直接继续:

使用 cmd.exe 命令行构建

如果您想要用命令行构建,CMake 的输出会显示相应的命令(具体命令取决于配置的发布目录)。但该命令会生成一个 Debug 版本,此版本在 Windows 上无法运行,并会导致 FreeCAD 中出现 Numpy 导入错误(这是一个已知问题但难以修复)。您需要指定 --config Release 选项来强制生成 Release 版本:

cmake --build E:/release --config Release

请注意,设置像 CMAKE_BUILD_TYPE 这样的 CMake 变量不会产生任何效果,只有按照上述方式指定 --config 选项才有效。

使用 Visual Studio 15 (2017) 或更新版本构建

构建 Release 版本

  1. 启动 Visual Studio IDE:可以点击 CMake GUI 中的 Open Project 按钮,或直接双击构建文件夹中的 FreeCAD.sln 文件。
  2. 首次编译时,确保 IDE 工具栏中选择的是 Release 模式。
  3. 在名为 Solution Explorer 的窗口中(列出所有可编译目标),右键点击 ALL_BUILD 目标并选择 Build,开始完整编译。

这一过程将会耗费较长时间。

要编译可直接使用的 FreeCAD 版本,请编译 INSTALL 目标,具体操作请参阅运行与安装 FreeCAD 章节。

如果您没有收到任何错误,那么就大功告成了。恭喜!您现在可以退出 MSVC 或保持其打开状态。

重要:从 Visual Studio 17.4 版本起,对于 SketcherGui 目标,不能启用默认启用的代码优化功能。若启用该优化,草图中的角度约束将会错位。解决方法如下:在 MSVC 解决方案资源管理器中右键点击该目标,选择上下文菜单最后一项属性,在弹出的对话框中依次选择 C/C++ → 优化,然后禁用优化设置。最后请重新编译 ALL_BUILD 目标。

构建 Debug 版本

以下是构建 Debug 版本的必要准备工作:

  1. 将 LibPack 文件夹中 bind 目录下的所有文件复制到 FreeCAD 构建文件夹的 bin 目录下(覆盖现有文件)。
  2. 将 LibPack 文件夹中 libd 目录下的所有文件复制到 FreeCAD 构建文件夹的 lib 目录下。

现在可以开始编译:

  1. 启动 Visual Studio IDE:可以点击 CMake GUI 中的 Open Project 按钮,或直接双击构建文件夹中的 FreeCAD.sln 文件。
  2. 首次编译时,确保 IDE 工具栏中选择的是 Debug 模式。
  3. 在名为 Solution Explorer 的窗口中(列出所有可编译目标),右键点击 ALL_BUILD 目标并选择 Build,开始完整编译。

这一过程将会耗费较长时间。

如果没有编译错误,并且如果上面提到的 CMake配置步骤中的 FREECAD_COPY_* 选项已启用,您就可以启动 Debug 构建:

  1. 右键点击 FreeCADMain 目标,然后在菜单中选择 设置为启动项目
  2. 最后,在工具栏中点击带有绿色三角形的按钮,名为 本地 Windows 调试器

这将启动 FreeCAD 的 Debug 版本,您可以使用 MSVC IDE 对其进行调试。

视频教程

YouTube 上有一个英文教程:Tutorial: Build FreeCAD from source on Windows 10,该教程从 CMake Gui 配置开始讲解,直到至 Visual Studio 16 2019 中的 `Build` 命令操作。

使用 Qt Creator 构建(已过时)

Qt Creator 的安装和配置

  • Download and install Qt Creator
  • Tools → Options → Text Editor → Behavior tab:
    • File Encodings → Default Encodings:
    • Set to: ISO-8859-1 /...csISOLatin1 (Certain characters create errors/warnings with Qt Creator if left set to UTF-8. This seems to fix it.)
  • Tools → Options → Build & Run:
    • CMake tab
      • Fill Executable box with path to cmake.exe
    • Kits tab
      • Name: MSVC 2008
      • Compiler: Microsoft Visual C++ Compiler 9.0 (x86)
      • Debugger: Auto detected...
      • Qt version: None
    • General tab
      • Uncheck: Always build project before deploying it
      • Uncheck: Always deploy project before running it

导入项目并构建

  • File → Open File or Project
  • Open CMakeLists.txt which is in the top level of the source
  • This will start CMake
  • Choose build directory and click next
  • Set generator to NMake Generator (MSVC 2008)
  • Click Run CMake. Follow the instructions depicted above to configure CMake to your liking.

Now FreeCAD can be built

  • Build → Build All
  • This will take a long time...

Once complete, it can be run: There are 2 green triangles at the bottom left. One is debug. The other is run. Pick whichever you want.

命令行构建

The steps how to compile from the command line depends on the compiler. For MSVC 2017 the steps are:

  1. In Windows start menu go to Visual Studio 2017 → Visual Studio Tools and choose Developer Command Prompt for VS 2017
  2. Change to your build folder.
  3. Execute the command
msbuild ALL_BUILD.vcxproj /p:Configuration=Release

or

msbuild INSTALL.vcxproj /p:Configuration=Release

These steps can also be automaized. Here is for example a solution for MSVC 2017:

  1. Download the script compile-FC.txt.
  2. Rename it to compile-FC.bat
  3. In Windows file explorer Shift+Right-click on your build folder and use from the context menu Command prompt here.
  4. Execute the command
compile-FC install

Instead of calling compile-FC with the option install you can also use debug or release:

debug   - compile FreeCAD in debug configuration

release - compile FreeCAD in release configuration

install    - compile FreeCAD in release configuration and create an install setup

运行和安装 FreeCAD

有 2 种方法来运行编译好的 FreeCAD:

方法 1:直接执行构建目录的子目录 bin 中的 FreeCAD.exe。

方法 2:构建 INSTALL 目标。

方法 2 更为简单,因为它能自动确保运行 FreeCAD.exe 所需的所有库文件都位于正确文件夹中。FreeCAD.exe 及相关库文件将输出到 CMake 变量 CMAKE_INSTALL_PREFIX 所指定的文件夹内。

而对于方法 1,您需要启用上文 CMake 配置步骤中提到的 FREECAD_COPY_* 相关选项。

问题排查

在使用某些工作台或功能时,FreeCAD 可能会出现 DLL 缺失错误。FreeCAD 控制台的错误信息不会直接显示缺失的 DLL 名称。要查明具体缺失的文件,您需要使用外部工具进行检测:

import os
os.system(r"~\DependenciesGui.exe")

注意:需要将 ~ 替换为您系统中 DependenciesGui.exe 的实际存放路径。

更新构建

FreeCAD 的开发非常活跃,因此,它的源代码几乎每天都在更新——添加新功能并修复错误。要从这些源代码更改中受益,您必须重新构建 FreeCAD,这一过程分为两个步骤:

  1. 更新源代码
  2. 重新编译

更新源代码

使用前端

使用 Git frontend TortoiseGit 时:

  1. 在 Windows 文件资源管理器中右键点击 FreeCAD 源代码文件夹,从菜单中选择 Pull
  2. 弹出的对话框中将提示选择开发分支。main 是主分支,除非您需要编译某个尚未合并到 main 分支的特殊新功能,否则应保持默认选择。(更多关于 Git 分支的信息,请参阅 Git 开发流程。)

最后,点击 OK

使用命令行

打开终端(命令提示符),切换到源代码目录后输入以下命令:

git pull https://github.com/FreeCAD/FreeCAD.git main

其中 main 是主开发分支的名称。如果您想从另一个分支获取代码,请使用它自己的名称而不是 main

重新编译

  1. 双击构建文件夹中的 FreeCAD.sln 文件或 ALL_BUILD.vcxproj 文件打开 MSVC IDE。
  2. 然后执行 使用 Visual Studio 15 2017 进行构建 章节中的步骤 2。

更新 LibPack

当第三方依赖库(如 Open Cascade)发布新的主版本、或修复了重要 bug 时,将会发布新的 LibPack。您可以在此处获取最新版本。

更新 LibPack 的最佳实践如下:

  1. 删除 build 文件夹中的 bin 文件夹。
  2. 删除本地 LibPack 文件夹中的所有内容。
  3. 将新 LibPack ZIP 文件的内容提取到现在为空的本地 LibPack 文件夹中。
  4. 打开 CMake,点击 Configure,再点击 Generate。这将重新创建您刚刚删除的 bin 文件夹,并将新的 LibPack 文件复制到其中。
  5. 在 CMake 中点击 Open Project,这将会打开 MSVC IDE。
  6. 在 MSVC IDE 中,构建 INSTALL 目标。

工具

In order to join the FreeCAD development you should compile and install the following tools:

Qt Designer 插件

FreeCAD uses Qt as toolkit for its user interface. All dialogs are setup in UI-files that can be edited using the program Qt Designer that is part of any Qt installation and also included in the LibPack. FreeCAD has its own set of Qt widgets to provide special features like adding a unit to input fields and to set preferences properties.

编译

The plugin cannot be loaded by the Qt Designer if it was compiled using another Qt version than the one your Qt Designer/Qt Creator is based on. Therefore the plugin must be compiled together with FreeCAD:

As result you will get the plugin file 'FreeCAD_widgets.dll in the folder
~\src\Tools\plugins\widget\Release

安装

To install the plugin, copy the DLL either to:

Finally (re)start Qt Designer and check its menu Help → Plugins. If the plugin FreeCAD_widgets.dll is listed as being loaded, you can now design and change FreeCAD's .ui files. If not, you must compile the DLL by yourself.

If you prefer using Qt Creator instead of Qt Designer, the plugin file must be placed in this folder:
C:\Qt\Qt5.15.2\Tools\QtCreator\bin\plugins\designer
Then (re)start Qt Creator, switch to the mode Design and then check the menu Tools → Form Editor → About Qt Designer Plugins. If the plugin FreeCAD_widgets.dll is listed as being loaded, you can now design and change FreeCAD's .ui files. If not, you must compile the DLL by yourself.

缩略图插件

FreeCAD has the feature to provide preview thumbnails for *.FCStd files. That means that in the Windows file explorer *.FCStd files are shown with a screenshot of the model it contains. To provide this feature, FreeCAD needs to have the file FCStdThumbnail.dll installed to Windows.

安装

The DLL is installed this way:

  1. Download this ZIP file and extract it.
  2. Open a Windows command prompt with administrator privileges (these privileges are a requirement).
  3. Change to the folder where the DLL is.
  4. Execute this command
    regsvr32 FCStdThumbnail.dll
    

So check if it works, assure that in FreeCAD the preferences option Save thumbnail into project file when saving document is enabled and save a model. Then view in Windows Explorer the folder of the saved model using a symbol view. You should now see a screenshot of the model in the folder view.

编译

To compile the FCStdThumbnail.dll

  1. Change to the FreeCAD source folder
    ~\src\Tools\thumbs\ThumbnailProvider
  2. Open the CMake GUI
  3. Specify there as source folder the one you are currently in.
  4. Use the same folder as build folder.
  5. Click Configure
  6. In the appearing dialog, specify the generator according to the one you want to use. For the standard MS Visual Studio use Visual Studio xx 2yyy where xx is the compiler version and 2yyy the year of its release. It is recommended to use the default option Use default native compilers.
    Note: It is important to specify the correct bit variant. If you have the 64bit variant of LibPack you must also use the x64 compiler.
  7. Click on Generate.
  8. You should now have the file ALL_BUILD.vcxproj in the folder ~\src\Tools\thumbs\ThumbnailProvider. Double-click on it and the MSVC IDE will open.
  9. In the toolbar of the MSVC IDE assure that you use the compilation target Release.
  10. There is a window called Solution Explorer. Right-click there on ALL_BUILD and then choose Build.
  11. As result you should now have a FCStdThumbnail.dll in the folder ~\src\Tools\thumbs\ThumbnailProvider\release that you can install as described above.

编译 Open Cascade

The LibPack comes with a version of Open Cascade that is suitable for general use. However, under some circumstances you may wish to compile against an alternate version of Open Cascade, such as one of their official releases, or a patched fork.

When compiling Open Cascade for FreeCAD note that there is no guarantee that FreeCAD will work with all versions of Open Cascade. Note also that when you are using the Netgen library, you must use the a NetGen version that it approved to compile with the Open Cascade version you like to compile.

To compile:

Variable name Description Default
3RDPARTY_DIR The path to 3rdparty components. It is recommended to use the folder as input where your used LibPack is. Explicitly leave this field empty. empty
3RDPARTY_DOXYGEN_EXECUTABLE The path to the executable of the 3rdparty component Doxygen. It is recommended to install Doxygen. CMake will then find it automatically. empty
3RDPARTY_FREETYPE_DIR The path to the necessary 3rdparty component Freetype. It is recommended to use the folder as input where your used LibPack is. empty
3RDPARTY_RAPIDJSON_DIR Only available if USE_RAPIDJSON is used. The path to the 3rdparty component RapidJSON. It is recommended NOT to use an existing LibPack folder as input. You can use the RapidJSOn folder from a LibPack, but copy it to a new folder and use this new folder as input. empty
3RDPARTY_TCL_DIR The path to the necessary 3rdparty component TCL. It is recommended NOT to use an existing LibPack folder as input. Take for example one of these releases, extract it and take this as input folder for CMake. empty
3RDPARTY_TK_DIR The path to the necessary 3rdparty component TK. It is recommended NOT to use an existing LibPack folder as input. Take for example one of these releases, extract it and take this as input folder for CMake. empty
3RDPARTY_VTK_DIR Only available if USE_VTK is used. The path to the necessary 3rdparty component VTK. It is recommended to use the folder as input where your used LibPack is. If you use another folder please assure that you don't use VTK 9.x or newer. empty
BUILD_RELEASE_DISABLE_EXCEPTIONS Disables exception handling for release builds. For FreeCAD you must set it to OFF. ON
INSTALL_DIR The output folder when building the target INSTALL. If the build was successful, take the files from this folder to update your LibPack. Windows default program installation folder
INSTALL_DIR_BIN The output subfolder for the DLL when building the target INSTALL. You must change it to bin win64/vc14/bin
INSTALL_DIR_LIB The output subfolder for the .lib files when building the target INSTALL. You must change it to lib win64/vc14/lib
USE_RAPIDJSON To compile Open Cascade with support for RapidJSON. Enabling this is mandatory in order to get support for the file format glTF. OFF
USE_VTK To compile Open Cascade with support for VTK. Enabling this is optimal. You can use this to build Open Cascade's VTK bridge. OFF

To build FreeCAD using the self-compiled Open Cascade, you must do the following:

编译 Netgen

The LibPack comes with a version of Netgen that will was tested to be build with the Open Cascade version of the LibPack. The problem is that every new release of Netgen changes the API. Also every new release of Open Cascade does the same. Therefore one cannot just easily change the Netgen version.

However, you might build Netgen nevertheless. This is an easy task:

Variable name Description Default
CMAKE_INSTALL_PREFIX The output folder when building the target INSTALL. If the build was successful, take the files from this folder to update your LibPack. C:/netgen
OpenCasCade_DIR The path to the CMake files of Open Cascade. If you built Open Cascade as described in the section Compiling Open Cascade you can use the subfolder cmake of there folder you used as INSTALL_DIR. If not, use the subfolder cmake of your LibPack. Note hereby that the LibPack must then already contain a proper Open Cascade build. Independent what folder you use, you must now also create there a subfolder lib and copy in the files freetype.lib and freetyped.lib from your LibPack. empty
USE_GUI set it to OFF ON
USE_NATIVE_ARCH set it to OFF; this is only necessary important to support older CPU that don't have the AVX2 instruction set ON
USE_OCC set it to ON OFF
USE_PYTHON set it to OFF ON
USE_SUPERBUILD set it to OFF ON
ZLIB_INCLUDE_DIR The path to the necessary 3rdparty component zlib. It is recommended to use the folder as input where your used LibPack is. empty
ZLIB_LIBRARY_DEBUG The path to the ZLib file zlibd.lib. It is located in the subfolder lib of your LibPack folder. empty
ZLIB_LIBRARY_RELEASE The path to the ZLib file zlib.lib. It is located in the subfolder lib of your LibPack folder. empty

name: CMAKE_DEBUG_POSTFIX, type: string, content: _d
This assures that he file names of the debug libraries get another name than the release libraries and can later not be accidentally exchanged.

To build FreeCAD using the self-compiled Netgen, you must do the following:

参考

See also