3. Сборка программ пакета

Что будет сделано на этой странице: одной командой в окне Git Bash вы соберёте шесть расчётных библиотек, шесть программ пакета и TPL Designer; узнаете, что делает каждый этап сценария, сколько он длится, как следить за ходом сборки и где лежит результат.


3.0. Перед началом — проверьте OpenCASCADE

Сборка пакета останавливается с ошибкой, если не собран OpenCASCADE (его требует TPL Designer). Проверьте, что существует файл:

C:\src\occt\install\cmake\OpenCASCADEConfig.cmake

Проверка в Git Bash:

ls "/c/src/occt/install/cmake/OpenCASCADEConfig.cmake"

Если выводится No such file or directory — сначала выполните страницу 4, разделы 4.1–4.4, затем вернитесь сюда.


3.1. Как устроена сборка (коротко)

  • Сборкой управляет CMake, саму компиляцию выполняет Ninja, компилятор — MinGW 13.1 (g++). Visual Studio не используется.
  • Всё запускает один сценарий build\build_win.sh. Он собирает:
Что Откуда Результат
6 расчётных библиотек: complex, sfile95, exprint, TMCLibError, prepr, TMCIndan src\libs\… (состав файлов — как в проектах .vcxproj MFC-версии) dist\win64\lib\lib*.a
Слой «MFC поверх Qt», общий интерфейс, модуль расчёта на видеокарте src\compat, src\gui_common, src\gui_common\compute статические библиотеки в dist\win64\lib
Вьюверы TMCROS, TMCGROUT, TMC_DN src\viewers\Tmcrtout, Tmcgrout, DiaNapGr tmcros.exe, tmcgrout.exe, tmc_dn.exe
FieldView (вывод через Qt RHI: Direct3D 11 / OpenGL) src\fieldview fieldview.exe
Счётные ядра H и X src\kernels\PlanarRT_H, PlanarRT_X (6 макросов X-моды заданы в src\kernels\PlanarRT_X\qt\CMakeLists.txt) planarrt_h.exe, planarrt_x.exe
TPL Designer, его утилиты и тесты src\tpl_designer TplDesigner.exe, gen_lr2.exe и др.
  • Флаги, от которых зависит побайтное совпадение чисел с MFC-версией, задаются в CMakeLists.txt автоматически: -ffp-contract=off (запрет объединения умножения со сложением) и файл src\compat\ucrt_libm_win.cpp (функции sin, cos, exp… берутся из ucrtbase.dll, как у MFC-версии). Ничего настраивать не нужно; не удаляйте их.

3.2. Сборка — по шагам

  1. Откройте Git Bash: Пуск → наберите Git Bash → Enter.
  2. Вставьте команду и нажмите Enter:

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

    Если OpenCASCADE установлен не в C:\src\occt\install (страница 2, раздел 2.4), укажите путь к папке с файлом OpenCASCADEConfig.cmake перед командой (прямыми косыми чертами, в кавычках):

    OCCT_DIR="D:/occt/install/cmake" sh "/путь/к/TMC_Suite/build/build_win.sh"
    

    OCCT_DIR действует только при первой настройке папки сборки. Если папка build\obj уже есть, смена OCCT_DIR ничего не меняет — удалите build\obj (раздел 3.5) и запустите сценарий снова.

  3. Ждите. Пока идёт сборка, окно ничего не выводит — это нормально: весь вывод сценарий пишет в файл журнала. Не закрывайте окно и не нажимайте клавиши.

  4. Чтобы видеть ход сборки, откройте второе окно Git Bash и выполните:

    tail -f "/c/src/TMC_Suite/build/build-win.log"
    

    В нём бегут строки вида [25/50] Building CXX object … — номер шага и общее число шагов. Выход из просмотра — Ctrl+C (на сборку в первом окне это не влияет). 5. Когда сборка закончится, в первом окне появится строка exit 0 — сборка успешна. Любое другое число (exit 1 и т. п.) — ошибка: см. раздел 3.6.

Git Bash после build_win.sh: строка exit 0
Git Bash после build_win.sh: строка exit 0

Не пропускайте вывод сборки через конвейер (| head, | more, | Select-Object -First … в PowerShell и т. п.): обрезка вывода конвейером на этом проекте приводила к зависанию компилятора. Сценарий и так пишет всё в журнал — читайте журнал.


3.3. Что делает сценарий — по строкам

Текст build_win.sh (19 строк) и смысл каждого этапа:

Этап Команда в сценарии Что происходит
1. Пути export PATH="/c/Qt/Tools/mingw1310_64/bin:/c/Qt/6.11.3/mingw_64/bin:/c/Qt/Tools/CMake_64/bin:/c/Qt/Tools/Ninja:$PATH" MinGW, Qt 6.11.3, CMake и Ninja становятся доступны в этом окне
2. Папка cd "$(dirname "$0")/.." переход в корень проекта, откуда бы вы ни запускали сценарий
3. OpenCASCADE OCCT="${OCCT_DIR:-$(pwd -W)/../occt/install/cmake}" путь к OpenCASCADE: из переменной OCCT_DIR, иначе — путь по умолчанию
4. Настройка (только первый раз) если нет файла build/obj/build.ninja: cmake -S . -B build/obj -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:/Qt/6.11.3/mingw_64 -DCMAKE_CXX_COMPILER=g++ "-DOpenCASCADE_DIR=$OCCT" CMake создаёт папку сборки build\obj, находит Qt и OpenCASCADE; вывод — в build/build-win-config.log. При ошибке сценарий печатает последние 30 строк этого журнала и завершается с exit 1
4а. Дополнение старой папки если build\obj есть, но в build\obj\CMakeCache.txt нет строки OpenCASCADE_DIR: папка создана до 27.10.2026 (без TPL Designer): сценарий дописывает в неё путь к OpenCASCADE
5. Сборка cmake --build build/obj -j 4 -- -k 0 "$@" > build/build-win.log 2>&1 Ninja собирает всё в 4 потока; -k 0 — не останавливаться на первой ошибке, собрать всё, что может собраться; вывод — в build/build-win.log
6. Итог echo "exit $rc" печать кода завершения: 0 — успех

Справки по ключам (--help) у сценария нет: любые дополнительные слова после имени сценария передаются Ninja как имена целей (раздел 3.5).

Что видно в журнале настройки при успехе

Файл build/build-win-config.log на машине разработки:

-- Qt 6.11.3
shaders/grid.vert -> shaders/grid.vert.qsb exposed as :/fieldview/shaders/grid.vert.qsb
…
-- FieldView: значков панели инструментов — 35 (…/resources/icons/toolbar/fieldview)
-- STEP: OpenCASCADE 7.9.3 — C:/src/occt/install/cmake
-- TMC Suite Qt 1.0.0: тип сборки Release, GUI=ON
-- Configuring done (1.3s)
-- Generating done (1.3s)
-- Build files have been written to: C:/src/TMC_Suite/build/obj

Проверьте три строки: -- Qt 6.11.3, -- STEP: OpenCASCADE 7.9.3 — … и GUI=ON. (Число «1.0.0» в строке TMC Suite Qt 1.0.0 — внутренний номер проекта CMake, не версия пакета; версия пакета 5.0 записывается в ресурсы .exe отдельно.)


3.4. Сколько длится и что получится

Сборка Объём Время на машине разработки
Первая (полная) около 360 шагов Ninja около 5 минут при 4 потоках (оценка по времени файлов полной сборки в отдельной папке 29.10.2026)
Повторная только изменённые файлы от нескольких секунд до минуты

На более медленном компьютере полная сборка идёт дольше. В журнале полной сборки — сотни строк warning: (на машине разработки около 400): это предупреждения компилятора, они не мешают сборке. Ошибка — только строки FAILED: и error:.

Результат — папка dist\win64\bin\

Файл Что это Идёт в поставку
planarrt_h.exe, planarrt_x.exe счётные ядра H и X да
tmcgrout.exe, tmcros.exe, tmc_dn.exe вьюверы да
fieldview.exe FieldView да
TplDesigner.exe редактор заданий .tpl да
gen_lr2.exe консольная генерация задания (утилита TPL Designer) да
libTK*.dll (23 файла) библиотеки OpenCASCADE, нужные TPL Designer (кладёт сама сборка) да
Qt6Core.dll, Qt6Gui.dll, Qt6OpenGL.dll, Qt6OpenGLWidgets.dll, Qt6Svg.dll, Qt6Widgets.dll часть DLL Qt, которую сборка копирует рядом с TPL Designer нет (в поставку DLL кладёт windeployqt)
planarrt_*_runcheck.exe, *_shot.exe, *_blocktest.exe, *_doccheck.exe, *_uitest.exe, tmc_launchcheck.exe средства самопроверки программ без участия человека нет
sdump.exe печать матрицы рассеяния из .s для сверки сборок по числам нет
sample_gen.exe, sig_gen.exe, tpl_dump.exe, make_icon.exe, make_models.exe, make_pdf.exe, gui_shot.exe служебные утилиты TPL Designer нет

Проверка в Git Bash:

cd "/c/src/TMC_Suite/dist/win64/bin"
ls planarrt_h.exe planarrt_x.exe tmcgrout.exe tmcros.exe tmc_dn.exe fieldview.exe TplDesigner.exe gen_lr2.exe
ls libTK*.dll | wc -l

Первая команда должна вывести 8 имён, вторая — число 23.

Проводник: папка dist\win64\bin после сборки
Проводник: папка dist\win64\bin после сборки

Программы из dist\win64\bin напрямую двойным щелчком не запускаются: рядом с ними нет модулей Qt (platforms\qwindows.dll) и библиотек MinGW. Для запуска либо соберите поставку (страница 5), либо задайте окружение (страница 7, раздел 7.3).


3.5. Частные случаи

Собрать одну программу. Допишите имя цели после имени сценария:

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

Имена целей: planarrt_h, planarrt_x, tmcgrout, tmcros, tmc_dn, fieldview, TplDesigner, gen_lr2.

Пересобрать всё с нуля (после смены версии Qt, пути к OpenCASCADE или при непонятных ошибках). Сценарий настраивает CMake только когда нет build\obj\build.ninja, поэтому старая папка сборки продолжит пользоваться прежними настройками. Удалите папку сборки и запустите сценарий снова:

rm -rf "/c/src/TMC_Suite/build/obj"
sh "/c/src/TMC_Suite/build_win.sh"

Проверьте путь в команде rm -rf перед нажатием Enter: она удаляет папку без подтверждения и без Корзины.

Те же команды без сценария (для понимания; обычно не нужны):

export PATH="/c/Qt/Tools/mingw1310_64/bin:/c/Qt/6.11.3/mingw_64/bin:/c/Qt/Tools/CMake_64/bin:/c/Qt/Tools/Ninja:$PATH"
cd "/c/src/TMC_Suite"
cmake -S . -B build/obj -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:/Qt/6.11.3/mingw_64 -DCMAKE_CXX_COMPILER=g++ "-DOpenCASCADE_DIR=C:/src/occt/install/cmake" > build/build-win-config.log 2>&1
cmake --build build/obj -j 4 -- -k 0 > build/build-win.log 2>&1
echo "exit $?"

3.6. Если в конце не exit 0

  1. Если сценарий вывел 30 строк журнала и exit 1 сразу (за секунды) — ошибка настройки. Читайте выведенные строки и build/build-win-config.log; типичные причины — страница 8, раздел 8.2.
  2. Если exit 1 после долгой работы — ошибка сборки. Найдите первые ошибки в журнале:

    cd "/c/src/TMC_Suite"
    grep -n "FAILED:\|error:" build/build-win.log | head -20
    

    Строка FAILED: <файл> называет то, что не собралось; строки error: ниже — причину. Разбор типичных ошибок — страница 8, раздел 8.3. 3. Ошибки компилятора не исправляйте сами правкой расчётного кода: это научный код. Сначала покажите журнал ответственному за сборку.


Назад: 2. Исходный код · Далее: 4. OpenCASCADE и TPL Designer (разделы 4.5–4.7 — проверка TPL Designer), затем 5. Папка поставки

3. Building the programs of the package

What this page covers: with a single command in a Git Bash window you will build six computational libraries, six programs of the package and TPL Designer; you will learn what each stage of the script does, how long it takes, how to follow the progress of the build and where the result is.


3.0. Before you start — check OpenCASCADE

The package build stops with an error if OpenCASCADE has not been built (it is required by TPL Designer). Check that the following file exists:

C:\src\occt\install\cmake\OpenCASCADEConfig.cmake

Check in Git Bash:

ls "/c/src/occt/install/cmake/OpenCASCADEConfig.cmake"

If No such file or directory is printed, first complete page 4, sections 4.1–4.4, then return here.


3.1. How the build works (briefly)

  • The build is controlled by CMake, the compilation itself is performed by Ninja, the compiler is MinGW 13.1 (g++). Visual Studio is not used.
  • Everything is started by one script, build\build_win.sh. It builds:
What From where Result
6 computational libraries: complex, sfile95, exprint, TMCLibError, prepr, TMCIndan src\libs\… (the set of files is the same as in the .vcxproj projects of the MFC version) dist\win64\lib\lib*.a
The "MFC on top of Qt" layer, the common user interface, the GPU computing module src\compat, src\gui_common, src\gui_common\compute static libraries in dist\win64\lib
Viewers TMCROS, TMCGROUT, TMC_DN src\viewers\Tmcrtout, Tmcgrout, DiaNapGr tmcros.exe, tmcgrout.exe, tmc_dn.exe
FieldView (rendering via Qt RHI: Direct3D 11 / OpenGL) src\fieldview fieldview.exe
Compute kernels H and X src\kernels\PlanarRT_H, PlanarRT_X (the 6 X-mode macros are set in src\kernels\PlanarRT_X\qt\CMakeLists.txt) planarrt_h.exe, planarrt_x.exe
TPL Designer, its utilities and tests src\tpl_designer TplDesigner.exe, gen_lr2.exe, etc.
  • The flags on which the bit-for-bit agreement of the numbers with the MFC version depends are set in CMakeLists.txt automatically: -ffp-contract=off (no fusing of multiplication with addition) and the file src\compat\ucrt_libm_win.cpp (the functions sin, cos, exp… are taken from ucrtbase.dll, as in the MFC version). Nothing needs to be configured; do not remove them.

3.2. The build — step by step

  1. Open Git Bash: Start → type Git Bash → Enter.
  2. Paste the command and press Enter:

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

    If OpenCASCADE is not installed in C:\src\occt\install (page 2, section 2.4), specify the path to the folder containing the OpenCASCADEConfig.cmake file before the command (with forward slashes, in quotes):

    OCCT_DIR="D:/occt/install/cmake" sh "/path/to/TMC_Suite/build/build_win.sh"
    

    OCCT_DIR takes effect only at the first configuration of the build folder. If the build\obj folder already exists, changing OCCT_DIR changes nothing — delete build\obj (section 3.5) and run the script again.

  3. Wait. While the build is running, the window prints nothing — this is normal: the script writes all output to a log file. Do not close the window and do not press any keys.

  4. To see the progress of the build, open a second Git Bash window and run:

    tail -f "/c/src/TMC_Suite/build/build-win.log"
    

    Lines like [25/50] Building CXX object … scroll in it — the step number and the total number of steps. To exit the viewer press Ctrl+C (this does not affect the build in the first window). 5. When the build is finished, the line exit 0 appears in the first window — the build succeeded. Any other number (exit 1, etc.) means an error: see section 3.6.

Git Bash after build_win.sh: the exit 0 line
Git Bash after build_win.sh: the exit 0 line

Do not pipe the build output (| head, | more, | Select-Object -First … in PowerShell, etc.): truncating the output with a pipe has caused the compiler to hang in this project. The script writes everything to the log anyway — read the log.


3.3. What the script does — line by line

The text of build_win.sh (19 lines) and the meaning of each stage:

Stage Command in the script What happens
1. Paths export PATH="/c/Qt/Tools/mingw1310_64/bin:/c/Qt/6.11.3/mingw_64/bin:/c/Qt/Tools/CMake_64/bin:/c/Qt/Tools/Ninja:$PATH" MinGW, Qt 6.11.3, CMake and Ninja become available in this window
2. Folder cd "$(dirname "$0")/.." changes to the project root, wherever you run the script from
3. OpenCASCADE OCCT="${OCCT_DIR:-$(pwd -W)/../occt/install/cmake}" path to OpenCASCADE: from the OCCT_DIR variable, otherwise the default path
4. Configuration (first time only) if there is no build/obj/build.ninja file: cmake -S . -B build/obj -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:/Qt/6.11.3/mingw_64 -DCMAKE_CXX_COMPILER=g++ "-DOpenCASCADE_DIR=$OCCT" CMake creates the build\obj build folder and finds Qt and OpenCASCADE; output goes to build/build-win-config.log. On an error the script prints the last 30 lines of this log and finishes with exit 1
4a. Updating an old folder if build\obj exists, but build\obj\CMakeCache.txt has no OpenCASCADE_DIR: line the folder was created before 27 October 2026 (without TPL Designer): the script adds the path to OpenCASCADE to it
5. Build cmake --build build/obj -j 4 -- -k 0 "$@" > build/build-win.log 2>&1 Ninja builds everything in 4 threads; -k 0 means do not stop at the first error, build everything that can be built; output goes to build/build-win.log
6. Result echo "exit $rc" prints the exit code: 0 means success

The script has no help on its options (--help): any additional words after the script name are passed to Ninja as target names (section 3.5).

What the configuration log shows on success

The file build/build-win-config.log on the development machine:

-- Qt 6.11.3
shaders/grid.vert -> shaders/grid.vert.qsb exposed as :/fieldview/shaders/grid.vert.qsb
…
-- FieldView: значков панели инструментов — 35 (…/resources/icons/toolbar/fieldview)
-- STEP: OpenCASCADE 7.9.3 — C:/src/occt/install/cmake
-- TMC Suite Qt 1.0.0: тип сборки Release, GUI=ON
-- Configuring done (1.3s)
-- Generating done (1.3s)
-- Build files have been written to: C:/src/TMC_Suite/build/obj

Check three lines: -- Qt 6.11.3, -- STEP: OpenCASCADE 7.9.3 — … and GUI=ON. (The number "1.0.0" in the line TMC Suite Qt 1.0.0 is the internal number of the CMake project, not the version of the package; the package version 5.0 is written into the .exe resources separately.)


3.4. How long it takes and what you get

Build Amount of work Time on the development machine
First (full) about 360 Ninja steps about 5 minutes with 4 threads (estimated from the file times of a full build in a separate folder on 29 October 2026)
Repeated only the changed files from a few seconds to a minute

On a slower computer a full build takes longer. The log of a full build contains hundreds of warning: lines (about 400 on the development machine): these are compiler warnings, they do not prevent the build. Only FAILED: and error: lines indicate an error.

Result — the folder dist\win64\bin\

File What it is Goes into the distribution
planarrt_h.exe, planarrt_x.exe compute kernels H and X yes
tmcgrout.exe, tmcros.exe, tmc_dn.exe viewers yes
fieldview.exe FieldView yes
TplDesigner.exe editor of .tpl task files yes
gen_lr2.exe console generation of a task file (a TPL Designer utility) yes
libTK*.dll (23 files) OpenCASCADE libraries needed by TPL Designer (placed by the build itself) yes
Qt6Core.dll, Qt6Gui.dll, Qt6OpenGL.dll, Qt6OpenGLWidgets.dll, Qt6Svg.dll, Qt6Widgets.dll some of the Qt DLLs, which the build copies next to TPL Designer no (the DLLs for the distribution are placed by windeployqt)
planarrt_*_runcheck.exe, *_shot.exe, *_blocktest.exe, *_doccheck.exe, *_uitest.exe, tmc_launchcheck.exe tools for unattended self-checking of the programs no
sdump.exe prints the scattering matrix from .s to compare builds numerically no
sample_gen.exe, sig_gen.exe, tpl_dump.exe, make_icon.exe, make_models.exe, make_pdf.exe, gui_shot.exe helper utilities of TPL Designer no

Check in Git Bash:

cd "/c/src/TMC_Suite/dist/win64/bin"
ls planarrt_h.exe planarrt_x.exe tmcgrout.exe tmcros.exe tmc_dn.exe fieldview.exe TplDesigner.exe gen_lr2.exe
ls libTK*.dll | wc -l

The first command must print 8 names, the second — the number 23.

File Explorer: the dist\win64\bin folder after the build
File Explorer: the dist\win64\bin folder after the build

The programs in dist\win64\bin cannot be started directly by double-clicking: there are no Qt modules (platforms\qwindows.dll) and MinGW libraries next to them. To run them, either assemble the distribution (page 5) or set up the environment (page 7, section 7.3).


3.5. Special cases

Building a single program. Append the target name after the script name:

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

Target names: planarrt_h, planarrt_x, tmcgrout, tmcros, tmc_dn, fieldview, TplDesigner, gen_lr2.

Rebuilding everything from scratch (after changing the Qt version, the path to OpenCASCADE, or on obscure errors). The script configures CMake only when there is no build\obj\build.ninja, so an old build folder keeps using the previous settings. Delete the build folder and run the script again:

rm -rf "/c/src/TMC_Suite/build/obj"
sh "/c/src/TMC_Suite/build_win.sh"

Check the path in the rm -rf command before pressing Enter: it deletes the folder without confirmation and bypassing the Recycle Bin.

The same commands without the script (for understanding; usually not needed):

export PATH="/c/Qt/Tools/mingw1310_64/bin:/c/Qt/6.11.3/mingw_64/bin:/c/Qt/Tools/CMake_64/bin:/c/Qt/Tools/Ninja:$PATH"
cd "/c/src/TMC_Suite"
cmake -S . -B build/obj -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:/Qt/6.11.3/mingw_64 -DCMAKE_CXX_COMPILER=g++ "-DOpenCASCADE_DIR=C:/src/occt/install/cmake" > build/build-win-config.log 2>&1
cmake --build build/obj -j 4 -- -k 0 > build/build-win.log 2>&1
echo "exit $?"

3.6. If the end is not exit 0

  1. If the script printed 30 log lines and exit 1 immediately (within seconds), this is a configuration error. Read the printed lines and build/build-win-config.log; typical causes are on page 8, section 8.2.
  2. If exit 1 comes after a long run, this is a build error. Find the first errors in the log:

    cd "/c/src/TMC_Suite"
    grep -n "FAILED:\|error:" build/build-win.log | head -20
    

    The line FAILED: <file> names what failed to build; the error: lines below it give the cause. Typical errors are analysed on page 8, section 8.3. 3. Do not fix compiler errors yourself by editing the computational code: this is scientific code. First show the log to the person responsible for the build.


Back: 2. Source code · Next: 4. OpenCASCADE and TPL Designer (sections 4.5–4.7 — checking TPL Designer), then 5. Distribution folder