> For the complete documentation index, see [llms.txt](https://jherculesqz.gitbook.io/open-cascade-technology-v7.7.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jherculesqz.gitbook.io/open-cascade-technology-v7.7.0/introduction/environment-variables.md).

# Environment Variables

To run any Open CASCADE Technology application you need to set the environment variables.

要运行任何 Open CASCADE Technology 应用程序，您需要设置环境变量。

## On Windows 在 Windows 上

You can define the environment variables with env.bat script located in the $CASROOT folder. This script accepts two arguments to be used: the version of Visual Studio (vc12 – vc143) and the architecture (win32 or win64).

The additional environment settings necessary for compiling OCCT libraries and samples by Microsoft Visual Studio can be set using script custom.bat located in the same folder. You might need to edit this script to correct the paths to third-party libraries if they are installed on your system in a non-default location.

Script msvc.bat can be used with the same arguments for immediate launch of Visual Studio for (re)compiling OCCT.

您可以使用 $CASROOT 文件夹中的 env.bat 脚本定义环境变量。此脚本接受两个要使用的参数：Visual Studio 的版本 (vc12 – vc143) 和体系结构（win32 或 win64）。

通过 Microsoft Visual Studio 编译 OCCT 库和示例所需的其他环境设置，可以使用位于同一文件夹中的脚本 custom.bat 进行设置。如果第三方库安装在系统上的非默认位置，您可能需要编辑此脚本来更正第三方库的路径。

脚本 msvc.bat 可以与相同的参数一起使用，以立即启动 Visual Studio 来编译或重编译 OCCT。

## On Unix 在Unix上

If OCCT was built by Code::Blocks, you can define the environment variables with env\_cbp.sh or custom\_cbp.sh script.

If OCCT was built by Automake, you can define the environment variables with env\_amk.sh or custom\_amk.sh script.

The scripts are located in the OCCT root folder.

如果 OCCT 是由 Code::Blocks 构建的，您可以使用 env\_cbp.sh 或 custom\_cbp.sh 脚本定义环境变量。

如果 OCCT 是由 Automake 构建的，您可以使用 env\_amk.sh 或 custom\_amk.sh 脚本定义环境变量。

这些脚本位于 OCCT 根文件夹中。

## Description of system variables: 系统变量说明：

* **CASROOT** is used to define the root directory of Open CASCADE Technology;
* **PATH** is required to define the path to OCCT binaries and 3rdparty folder;
* **LD\_LIBRARY\_PATH** is required to define the path to OCCT libraries (on UNIX platforms only; **DYLD\_LIBRARY\_PATH** variable in case of macOS);
* **MMGT\_OPT** (optional) if set to 1, the memory manager performs optimizations as described below; if set to 2, Intel (R) TBB optimized memory manager is used; if 0 (default), every memory block is allocated in C memory heap directly (via malloc() and free() functions). In the latter case, all other options starting with *MMGT*, except MMGT\_CLEAR, are ignored;
* **CASROOT**用于定义Open CASCADE Technology的根目录；
* **PATH**用于定义 OCCT 二进制文件和 3rdparty 文件夹的路径；
* **LD\_LIBRARY\_PATH**用于定义 OCCT 库的路径（仅在 UNIX 平台上；对于 macOS，需要DYLD\_LIBRARY\_PATH变量）；
* **MMGT\_OPT**（可选）如果设置为 1，内存管理器将执行如下所述的优化；如果设置为 2，则使用 Intel (R) TBB 优化内存管理器；如果为 0（默认），则每个内存块都直接在 C 内存堆中分配（通过 malloc() 和 free() 函数）。在后一种情况下，除了 MMGT\_CLEAR 之外，以MMGT开头的所有其他选项都将被忽略；
*
* **MMGT\_CLEAR** (optional) if set to 1 (default), every allocated memory block is cleared by zeros; if set to 0, memory block is returned as it is;
* **MMGT\_CELLSIZE** (optional) defines the maximal size of blocks allocated in large pools of memory. Default is 200;
* **MMGT\_NBPAGES** (optional) defines the size of memory chunks allocated for small blocks in pages (operating-system dependent). Default is 10000;
* **MMGT\_THRESHOLD** (optional) defines the maximal size of blocks that are recycled internally instead of being returned to the heap. Default is 40000;
* **MMGT\_MMAP** (optional) when set to 1 (default), large memory blocks are allocated using memory mapping functions of the operating system; if set to 0, they will be allocated in the C heap by malloc();
* **MMGT\_CLEAR**（可选）如果设置为1（默认），则每个分配的内存块都被清零；如果设置为0，则按原样返回内存块；
* **MMGT\_CELLSIZE**（可选）定义在大型内存池中分配的块的最大大小。默认为 200；
* **MMGT\_NBPAGES**（可选）定义为页面中的小块分配的内存块的大小（取决于操作系统）。默认为 10000；
* **MMGT\_THRESHOLD**（可选）定义内部回收而不是返回到堆的块的最大大小。默认为 40000；
* **MMGT\_MMAP**（可选）当设置为1（默认）时，使用操作系统的内存映射函数分配大内存块；如果设置为0，它们将通过malloc()分配在C堆中；
*
* **CSF\_LANGUAGE** (optional) defines default language of messages;
* **CSF\_DEBUG** (optional, Windows only): if defined then a diagnostic message is displayed in case of an exception;
* **CSF\_DEBUG\_BOP** (optional): if defined then it should specify directory where diagnostic data on problems occurred in Boolean operations will be saved;
* **CSF\_MDTVTexturesDirectory** defines the directory for available textures when using texture mapping;
* **CSF\_ShadersDirectory** (optional) defines the directory for GLSL programs for Ray Tracing renderer (embedded resources are used when variable is undefined);
* **CSF\_LANGUAGE**（可选）定义消息的默认语言；
* **CSF\_DEBUG**（可选，仅限 Windows）：如果定义，则在出现异常时显示诊断消息；
* **CSF\_DEBUG\_BO**P（可选）：如果定义，则应指定保存布尔运算中出现问题的诊断数据的目录；
* **CSF\_MDTVTexturesDirectory**定义使用纹理映射时可用纹理的目录；
* **CSF\_ShadersDirectory**（可选）定义光线追踪渲染器的 GLSL 程序的目录（当变量未定义时使用嵌入资源）；
*
* **CSF\_SHMessage** (optional) defines the path to the messages file for *ShapeHealing*;
* **CSF\_XSMessage** (optional) defines the path to the messages file for **STEP** and **IGES** translators;
* **CSF\_StandardDefaults**, **CSF\_StandardLiteDefaults**, **CSF\_XCAFDefaults**, and **CSF\_PluginDefaults** define paths to directory where configuration files for OCAF persistence are located (required for open/save operations with OCAF documents);
* **CSF\_IGESDefaults** and **CSF\_STEPDefaults** (optional) define paths to directory where resource files of **IGES** and **STEP** translators are located;
* **CSF\_XmlOcafResource** is required in order to set the path to **XSD** resources, which defines XML grammar.
* **CSF\_MIGRATION\_TYPES** is required in order to read documents that contain old data types, such as *TDataStd\_Shape*;
* **CSF\_SHMessage** （可选）定义ShapeHealing的消息文件的路径；
* **CSF\_XSMessage** （可选）定义STEP和IGES转换器的消息文件的路径；
* **CSF\_StandardDefaults、CSF\_StandardLiteDefaults、CSF\_XCAFDefaults**和**CSF\_PluginDefaults**定义 OCAF 持久性配置文件所在目录的路径（对 OCAF 文档进行打开/保存操作所需）；
* **CSF\_IGESDefaults**和**CSF\_STEPDefaults**（可选）定义IGES和STEP转换器资源文件所在目录的路径；
* **CSF\_XmlOcafResource**用于设置**XSD**资源的路径，**XSD**资源定义了 XML 语法；
* **CSF\_MIGRATION\_TYPES**用于读取包含旧数据类型的文档，例如TDataStd\_Shape。
