4. OpenCASCADE и TPL Designer

Что будет сделано на этой странице: вы один раз загрузите и соберёте библиотеку OpenCASCADE 7.9.3 (она нужна TPL Designer для чтения 3D-моделей STEP), проверите, что сборка пакета её нашла, и прогоните тесты TPL Designer.

Разделы 4.1–4.4 выполняются до сборки программ (страница 3), разделы 4.5–4.7 — после неё.


4.1. Что такое TPL Designer и почему нужен OpenCASCADE

TPL Designer — редактор файлов задания .tpl для счётных ядер. С 27.10.2026 он входит в Qt6-версию пакета: исходники — src\tpl_designer\, собирается он тем же сценарием build_win.sh вместе с остальными программами. Отдельно собирать его не нужно.

OpenCASCADE (OCCT) — открытая библиотека геометрического моделирования. TPL Designer читает через неё модели в формате STEP. Для пакета OpenCASCADE обязателен: если CMake его не находит, настройка сборки останавливается с сообщением

TPL Designer: не найден OpenCASCADE (импорт STEP). Укажите папку с OpenCASCADEConfig.cmake:
-DOpenCASCADE_DIR=<occt>/install/cmake (или -DTPLD_WITH_STEP=OFF — сборка без импорта STEP).

Сборка без STEP (-DTPLD_WITH_STEP=OFF) для выпуска не подходит: сценарий поставки копирует библиотеки libTK*.dll и без них остановится.

OpenCASCADE собирается из исходников тем же компилятором MinGW 13.1, что и пакет. Готовые сборки OpenCASCADE с сайта разработчика сделаны другим компилятором (Visual Studio) и с MinGW несовместимы.

Сборку OpenCASCADE достаточно выполнить один раз на компьютере.


4.2. Загрузка исходников OpenCASCADE 7.9.3

На машине разработки исходники — неглубокая копия официального репозитория по метке V7_9_3 (это записано в C:\src\occt\src\.git\config).

  1. Откройте Git Bash.
  2. Выполните (одна команда; загрузка около 300 МБ):

    git clone --depth 1 --branch V7_9_3 https://github.com/Open-Cascade-SAS/OCCT.git "/c/src/occt/src"
    
  3. Проверка:

    ls "/c/src/occt/src/CMakeLists.txt" "/c/src/occt/src/LICENSE_LGPL_21.txt"
    

    Оба файла должны найтись.


4.3. Сборка и установка OpenCASCADE

Настройки ниже — те же, что у папки сборки C:\src\occt\build на машине разработки (модули и сторонние библиотеки сверены по её CMakeCache.txt): собираются библиотеки в виде DLL, только нужные модули, без сторонних библиотек.

Настройка Значение
Компилятор MinGW 13.1 из C:\Qt\Tools\mingw1310_64
Тип сборки Release, библиотеки — DLL (BUILD_LIBRARY_TYPE=Shared)
Модули включены FoundationClasses, ModelingData, ModelingAlgorithms, ApplicationFramework, DataExchange
Модули выключены Visualization, Draw, DETools
Сторонние библиотеки все выключены: Draco, FFmpeg, FreeImage, FreeType, OpenVR, RapidJSON, TBB
Папка сборки C:\src\occt\build
Папка установки (INSTALL_DIR) C:\src\occt\install — сюда по умолчанию смотрит build_win.sh

Шаги

  1. Откройте Git Bash.
  2. Вставьте блок команд целиком и нажмите Enter (первая строка — пути к компилятору; вторая — корневая папка OpenCASCADE; если она у вас другая, измените только её):

    export PATH="/c/Qt/Tools/mingw1310_64/bin:/c/Qt/Tools/CMake_64/bin:/c/Qt/Tools/Ninja:$PATH"
    O="C:/src/occt"
    cmake -S "$O/src" -B "$O/build" -G Ninja -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
      -DBUILD_LIBRARY_TYPE=Shared -DINSTALL_DIR="$O/install" \
      -DBUILD_MODULE_ApplicationFramework=ON -DBUILD_MODULE_DataExchange=ON -DBUILD_MODULE_DETools=OFF \
      -DBUILD_MODULE_Draw=OFF -DBUILD_MODULE_FoundationClasses=ON -DBUILD_MODULE_ModelingAlgorithms=ON \
      -DBUILD_MODULE_ModelingData=ON -DBUILD_MODULE_Visualization=OFF \
      -DUSE_DRACO=OFF -DUSE_FFMPEG=OFF -DUSE_FREEIMAGE=OFF -DUSE_FREETYPE=OFF -DUSE_OPENVR=OFF \
      -DUSE_RAPIDJSON=OFF -DUSE_TBB=OFF > "$O/build.log" 2>&1
    echo "configure exit $?"
    

    Ожидается configure exit 0 (через несколько секунд или минуту).

  3. Запустите сборку:

    cmake --build "$O/build" -j 4 >> "$O/build.log" 2>&1
    echo "build exit $?"
    

    Это самый долгий этап всей инструкции: на машине разработки сборка OpenCASCADE — 4152 шага Ninja (для сравнения: весь пакет — около 360). Точное время не замерялось. Окно молчит до конца; ход виден во втором окне Git Bash:

    tail -f "/c/src/occt/build.log"
    

    Ожидается build exit 0. Последние строки журнала на машине разработки: [4152/4152] Linking CXX shared library win64\gcc\bin\libTKDESTEP.dll.

  4. Установите собранное в папку install:

    cmake --install "$O/build" > "$O/install.log" 2>&1
    echo "install exit $?"
    

    Ожидается install exit 0. Журнал install.log начинается строкой -- Install configuration: "Release".

Git Bash: configure exit 0, build exit 0, install exit 0
Git Bash: configure exit 0, build exit 0, install exit 0

Если вы закрыли окно Git Bash между шагами 2 и 3, в новом окне сначала снова выполните первые две строки шага 2 (export PATH=… и O=…).


4.4. Проверка установки OpenCASCADE

ls "/c/src/occt/install/cmake/OpenCASCADEConfig.cmake"
ls "/c/src/occt/install/win64/gcc/bin/libTKernel.dll" "/c/src/occt/install/win64/gcc/bin/libTKDESTEP.dll"

Все три файла должны найтись. На машине разработки в install\win64\gcc\bin — 47 DLL.

Проводник: папка occt\install\cmake с OpenCASCADEConfig.cmake
Проводник: папка occt\install\cmake с OpenCASCADEConfig.cmake

Теперь можно собирать программы пакета: страница 3.

О путях машины сборки внутри DLL OpenCASCADE

DLL OpenCASCADE, собранные командами выше, содержат внутри строки с полным путём к исходникам (например, C:/src/occt/…; в libTKernel.dll машины разработки — 2 таких строки). На работу программ это не влияет, но эти пути попадают в поставку.


4.5. TPL Designer в общей сборке

Отдельных команд для TPL Designer нет: его собирает build_win.sh (страница 3). При настройке CMake:

  1. ищет OpenCASCADE по пути OpenCASCADE_DIR (его передаёт build_win.sh, по умолчанию C:/src/occt/install/cmake);
  2. пишет в build/build-win-config.log строку -- STEP: OpenCASCADE 7.9.3 — <путь>;
  3. после сборки TplDesigner.exe копирует рядом с ним в dist\win64\bin ровно те DLL, которые ему нужны (команда TARGET_RUNTIME_DLLS в src\tpl_designer\src\gui\CMakeLists.txt): 23 файла libTK*.dll и часть DLL Qt.

Проверка после сборки:

cd "/c/src/TMC_Suite"
grep "STEP: OpenCASCADE" build/build-win-config.log
ls dist/win64/bin/TplDesigner.exe dist/win64/bin/gen_lr2.exe
ls dist/win64/bin/libTK*.dll | wc -l

Ожидается строка -- STEP: OpenCASCADE 7.9.3 — C:/src/occt/install/cmake, два файла и число 23.

Собрать только TPL Designer (после изменений в его коде):

sh "/c/src/TMC_Suite/build_win.sh" TplDesigner

Особенность: для TPL Designer в его CMakeLists.txt сброшены настройки расчётного кода (_MBCS, -UUNICODE, -ffp-contract=off) — он не содержит расчётного кода пакета (пишет текст .tpl и запускает ядра отдельными процессами) и собирается так же, как собирался отдельным проектом.


4.6. Тесты TPL Designer

Тесты в открытый репозиторий не входят, собирать и запускать их не нужно.


4.7. Что из TPL Designer попадает в поставку

Это делает сценарий поставки (страница 5) сам; таблица — для проверки:

Что Откуда берёт build\package_win.sh
TplDesigner.exe, gen_lr2.exe dist\win64\bin\
libTK*.dll dist\win64\bin\
папка models\ (образцы 3D-моделей: horn.obj, tokamak.step, waveguide_iris.step и др.) src\tpl_designer\data\models\
TPL-Designer-rukovodstvo.pdf (руководство TPL Designer) src\tpl_designer\docs\user-guide\

Назад: 3. Сборка программ · Далее: 5. Папка поставки

4. OpenCASCADE and TPL Designer

What this page covers: you will download and build the OpenCASCADE 7.9.3 library once (TPL Designer needs it to read STEP 3D models), check that the package build has found it, and run the TPL Designer tests.

Sections 4.1–4.4 are done before building the programs (page 3), sections 4.5–4.7 — after it.


4.1. What TPL Designer is and why OpenCASCADE is needed

TPL Designer is an editor of .tpl task files for the compute kernels. Since 27 October 2026 it has been part of the Qt6 version of the package: its sources are in src\tpl_designer\, and it is built by the same build_win.sh script together with the other programs. There is no need to build it separately.

OpenCASCADE (OCCT) is an open-source geometric modelling library. TPL Designer reads STEP models through it. For the package, OpenCASCADE is mandatory: if CMake does not find it, the build configuration stops with the message

TPL Designer: не найден OpenCASCADE (импорт STEP). Укажите папку с OpenCASCADEConfig.cmake:
-DOpenCASCADE_DIR=<occt>/install/cmake (или -DTPLD_WITH_STEP=OFF — сборка без импорта STEP).

A build without STEP (-DTPLD_WITH_STEP=OFF) is not suitable for a release: the distribution script copies the libTK*.dll libraries and stops without them.

OpenCASCADE is built from sources with the same MinGW 13.1 compiler as the package. The prebuilt OpenCASCADE binaries from the developer's website are made with a different compiler (Visual Studio) and are incompatible with MinGW.

It is enough to build OpenCASCADE once on a computer.


4.2. Downloading the OpenCASCADE 7.9.3 sources

On the development machine the sources are a shallow clone of the official repository at the tag V7_9_3 (this is recorded in C:\src\occt\src\.git\config).

  1. Open Git Bash.
  2. Run (a single command; the download is about 300 MB):

    git clone --depth 1 --branch V7_9_3 https://github.com/Open-Cascade-SAS/OCCT.git "/c/src/occt/src"
    
  3. Check:

    ls "/c/src/occt/src/CMakeLists.txt" "/c/src/occt/src/LICENSE_LGPL_21.txt"
    

    Both files must be found.


4.3. Building and installing OpenCASCADE

The settings below are the same as those of the build folder C:\src\occt\build on the development machine (modules and third-party libraries were checked against its CMakeCache.txt): the libraries are built as DLLs, only the needed modules, without third-party libraries.

Setting Value
Compiler MinGW 13.1 from C:\Qt\Tools\mingw1310_64
Build type Release, libraries as DLLs (BUILD_LIBRARY_TYPE=Shared)
Modules enabled FoundationClasses, ModelingData, ModelingAlgorithms, ApplicationFramework, DataExchange
Modules disabled Visualization, Draw, DETools
Third-party libraries all disabled: Draco, FFmpeg, FreeImage, FreeType, OpenVR, RapidJSON, TBB
Build folder C:\src\occt\build
Installation folder (INSTALL_DIR) C:\src\occt\install — this is where build_win.sh looks by default

Steps

  1. Open Git Bash.
  2. Paste the block of commands as a whole and press Enter (the first line sets the paths to the compiler; the second is the OpenCASCADE root folder; if yours is different, change only that line):

    export PATH="/c/Qt/Tools/mingw1310_64/bin:/c/Qt/Tools/CMake_64/bin:/c/Qt/Tools/Ninja:$PATH"
    O="C:/src/occt"
    cmake -S "$O/src" -B "$O/build" -G Ninja -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
      -DBUILD_LIBRARY_TYPE=Shared -DINSTALL_DIR="$O/install" \
      -DBUILD_MODULE_ApplicationFramework=ON -DBUILD_MODULE_DataExchange=ON -DBUILD_MODULE_DETools=OFF \
      -DBUILD_MODULE_Draw=OFF -DBUILD_MODULE_FoundationClasses=ON -DBUILD_MODULE_ModelingAlgorithms=ON \
      -DBUILD_MODULE_ModelingData=ON -DBUILD_MODULE_Visualization=OFF \
      -DUSE_DRACO=OFF -DUSE_FFMPEG=OFF -DUSE_FREEIMAGE=OFF -DUSE_FREETYPE=OFF -DUSE_OPENVR=OFF \
      -DUSE_RAPIDJSON=OFF -DUSE_TBB=OFF > "$O/build.log" 2>&1
    echo "configure exit $?"
    

    Expected: configure exit 0 (after a few seconds or a minute).

  3. Start the build:

    cmake --build "$O/build" -j 4 >> "$O/build.log" 2>&1
    echo "build exit $?"
    

    This is the longest stage of the whole guide: on the development machine the OpenCASCADE build is 4152 Ninja steps (for comparison: the whole package is about 360). The exact time was not measured. The window stays silent until the end; the progress can be seen in a second Git Bash window:

    tail -f "/c/src/occt/build.log"
    

    Expected: build exit 0. The last lines of the log on the development machine: [4152/4152] Linking CXX shared library win64\gcc\bin\libTKDESTEP.dll.

  4. Install the built files into the install folder:

    cmake --install "$O/build" > "$O/install.log" 2>&1
    echo "install exit $?"
    

    Expected: install exit 0. The install.log log begins with the line -- Install configuration: "Release".

Git Bash: configure exit 0, build exit 0, install exit 0
Git Bash: configure exit 0, build exit 0, install exit 0

If you closed the Git Bash window between steps 2 and 3, first run again in the new window the first two lines of step 2 (export PATH=… and O=…).


4.4. Checking the OpenCASCADE installation

ls "/c/src/occt/install/cmake/OpenCASCADEConfig.cmake"
ls "/c/src/occt/install/win64/gcc/bin/libTKernel.dll" "/c/src/occt/install/win64/gcc/bin/libTKDESTEP.dll"

All three files must be found. On the development machine there are 47 DLLs in install\win64\gcc\bin.

File Explorer: the occt\install\cmake folder with OpenCASCADEConfig.cmake
File Explorer: the occt\install\cmake folder with OpenCASCADEConfig.cmake

Now you can build the programs of the package: page 3.

About the build-machine paths inside the OpenCASCADE DLLs

The OpenCASCADE DLLs built with the commands above contain strings with the full path to the sources (for example, C:/src/occt/…; in libTKernel.dll of the development machine there are 2 such strings). This does not affect how the programs work, but these paths end up in the distribution.


4.5. TPL Designer in the common build

There are no separate commands for TPL Designer: it is built by build_win.sh (page 3). During configuration CMake:

  1. looks for OpenCASCADE at the OpenCASCADE_DIR path (passed by build_win.sh, by default C:/src/occt/install/cmake);
  2. writes the line -- STEP: OpenCASCADE 7.9.3 — <path> to build/build-win-config.log;
  3. after TplDesigner.exe is built, copies next to it in dist\win64\bin exactly the DLLs it needs (the TARGET_RUNTIME_DLLS command in src\tpl_designer\src\gui\CMakeLists.txt): 23 libTK*.dll files and some of the Qt DLLs.

Check after the build:

cd "/c/src/TMC_Suite"
grep "STEP: OpenCASCADE" build/build-win-config.log
ls dist/win64/bin/TplDesigner.exe dist/win64/bin/gen_lr2.exe
ls dist/win64/bin/libTK*.dll | wc -l

Expected: the line -- STEP: OpenCASCADE 7.9.3 — C:/src/occt/install/cmake, two files and the number 23.

To build only TPL Designer (after changes in its code):

sh "/c/src/TMC_Suite/build_win.sh" TplDesigner

A special feature: in TPL Designer's CMakeLists.txt the settings of the computational code are reset (_MBCS, -UUNICODE, -ffp-contract=off) — it does not contain the package's computational code (it writes the .tpl text and runs the kernels as separate processes) and is built the same way as it was built as a standalone project.


4.6. TPL Designer tests

The tests are not part of the public repository, so there is nothing to build or run.


4.7. What from TPL Designer goes into the distribution

The distribution script (page 5) does this itself; the table is for checking:

What Where build\package_win.sh takes it from
TplDesigner.exe, gen_lr2.exe dist\win64\bin\
libTK*.dll dist\win64\bin\
the models\ folder (sample 3D models: horn.obj, tokamak.step, waveguide_iris.step, etc.) src\tpl_designer\data\models\
TPL-Designer-rukovodstvo.pdf (the TPL Designer manual) src\tpl_designer\docs\user-guide\

Back: 3. Building the programs · Next: 5. Distribution folder