Сборка TMC Suite — обзор

Этот раздел документации описывает, как с нуля собрать (скомпилировать) весь пакет программ и библиотек TMC Suite из исходного кода.

TMC Suite — научный пакет для электродинамических расчётов (планарные структуры, H‑поляризация и X‑мода, матрицы рассеяния, диаграммы направленностей, поля). Написан на C++ / MFC / OpenGL, собирается в среде Microsoft Visual Studio.


Главное: есть ДВЕ отдельные сборки — win32 и win64

Пакет собирается под две платформы:

Платформа Что это Куда попадают результаты
win32 32‑битная версия (выбор платформы Win32 в Visual Studio) dist\win32\lib, dist\win32\bin
win64 64‑битная версия (выбор платформы x64 в Visual Studio) dist\win64\lib, dist\win64\bin

Исходный код — один общий комплект в папке src\. Платформы отличаются только папкой результата dist\. Никогда не дублируйте исходники для разных платформ.

Почему две РАЗНЫЕ инструкции

Исторически код собирался под win16 и win32 (это старый legacy‑код ранних версий Visual C++). Сборка под win64 — новая задача: она потребовала точечных правок в коде, связанных с разрядностью (размер указателя стал 8 байт, изменились сигнатуры ряда функций MFC). Поэтому инструкции разделены:

  • win32/ — базовая, самодостаточная инструкция для 32‑битной сборки.
  • win64/ — самодостаточная инструкция для 64‑битной сборки. Дополнительно содержит файл 08-porting-changes.md — журнал ВСЕХ изменений кода ради 64 бит, с обоснованием каждого.

Каждая из двух инструкций читается самостоятельно: тот, кто собирает только win32, не обязан заглядывать в win64, и наоборот.


Два способа сборки: пофазно или всё сразу

Собрать пакет можно двумя способами:

  1. Пофазно — открывать проекты по очереди (библиотеки → вьюверы → ядра → FieldView), отдельно для win32 и win64. Это основной, подробно расписанный способ (файлы 01…08). Он нагляден и удобен для обучения, отладки и пересборки отдельного компонента.
  2. Всё сразу одним решением — в src\tamic.slnx собраны все 12 проектов с зависимостями; открыл, выбрал платформу (Win32 или x64) — собрал весь пакет. Быстрый способ «получить всё». Подробнее — в разделе 09-solution-all.md («Сборка всего сразу через solution»).

Оба способа дают одинаковый результат в dist\win32\… и dist\win64\…. Ниже описан пофазный порядок.


С какой сборки начать

Рекомендуемый порядок (если вы делаете это впервые):

  1. Сначала полностью соберите win32. Она ближе к тому, что уже работало раньше, поэтому проще. Получите 6 рабочих программ и 6 библиотек.
  2. Затем переключайтесь на win64. Все необходимые правки кода уже внесены и описаны в журнале win64/08-porting-changes.md — повторить сборку можно воспроизводимо.

Не пытайтесь собирать win64 параллельно с win32, пока win32 не заработал — иначе непонятно, ошибка из‑за «64 бит» или из‑за того, что окружение ещё не настроено.


Что входит в пакет

6 библиотек (статические .lib):

Библиотека Папка исходников Для кого
sfile95.lib src\libs\SFILE95 вьюверы + ядра
complex.lib src\libs\complex вьюверы
exprint.lib src\libs\exprint вьюверы + ядра
TMCLibError.lib src\libs\TMCLibError ядра
prepr.lib src\libs\PREPR ядра
TMCIndan.lib src\libs\TMCIndan ядра

6 программ (исполняемые .exe):

Программа Папка исходников Назначение
TMCROS.exe src\viewers\Tmcrtout вьювер временных сигналов
TMCGROUT.exe src\viewers\Tmcgrout вьювер матриц рассеяния
TMC_DN.exe src\viewers\DiaNapGr вьювер диаграмм направленностей
tmc_rth.exe src\kernels\PlanarRT_H счётное ядро, H‑поляризация (о‑мода)
tmc_rtx.exe src\kernels\PlanarRT_X счётное ядро, X‑мода (6 макросов)
FieldView.exe src\fieldview визуализатор полей (OpenGL)

Порядок сборки — 4 фазы

Сборка строго по фазам. Внутри каждой инструкции (и win32, и win64) фазы идут в этом порядке:

ФАЗА 1 — все 6 библиотек        → файл 03-build-libs.md
ФАЗА 2 — 3 вьювера              → файл 04-build-viewers.md
ФАЗА 3 — 2 счётных ядра         → файл 05-build-kernels.md (X‑мода: 6 макросов)
ФАЗА 4 — FieldView (OpenGL)     → файл 06-build-fieldview.md

Не собирайте программы, пока не готовы ВСЕ 6 библиотек. Порядок между самими библиотеками не важен — каждая .lib компилируется независимо. Но все 6 должны быть готовы до начала Фазы 2.

Зависимости линковки (что с чем связывается):

  • Вьюверы ← sfile95, complex, exprint
  • Счётные ядра ← sfile95, prepr, exprint, TMCIndan, TMCLibError
  • FieldView ← opengl32, glu32 + sfile95, prepr, exprint, TMCIndan, TMCLibError

Структура файлов инструкций

docs/build-guide/
├── 00-overview.md            ← этот файл
├── win32/
│   ├── 01-requirements.md    ← что установить
│   ├── 02-setup-paths.md     ← property sheets и папки результатов
│   ├── 03-build-libs.md      ← Фаза 1: библиотеки
│   ├── 04-build-viewers.md   ← Фаза 2: вьюверы
│   ├── 05-build-kernels.md   ← Фаза 3: ядра (X‑мода — 6 макросов)
│   ├── 06-build-fieldview.md ← Фаза 4: FieldView (OpenGL)
│   └── 07-troubleshooting.md ← решение проблем
└── win64/
    ├── 01-requirements.md
    ├── 02-setup-paths.md      ← + добавление платформы x64
    ├── 03-build-libs.md
    ├── 04-build-viewers.md
    ├── 05-build-kernels.md
    ├── 06-build-fieldview.md
    ├── 07-troubleshooting.md
    └── 08-porting-changes.md  ←  журнал всех 64‑битных правок кода

Где брать тестовые данные

Для проверки собранных программ используйте тестовые наборы из папки samples\SAMPLE_R.

Building TMC Suite — overview

This documentation section describes how to build (compile) the entire package of TMC Suite programs and libraries from source, from scratch.

TMC Suite is a scientific package for electrodynamic computations (planar structures, H-polarization and X-mode, scattering matrices, radiation patterns, fields). It is written in C++ / MFC / OpenGL and built in Microsoft Visual Studio.


The main point: there are TWO separate builds — win32 and win64

The package is built for two platforms:

Platform What it is Where the outputs go
win32 32-bit version (platform Win32 in Visual Studio) dist\win32\lib, dist\win32\bin
win64 64-bit version (platform x64 in Visual Studio) dist\win64\lib, dist\win64\bin

The source code is a single shared set in the src\ folder. The platforms differ only in the output folder dist\. Never duplicate the sources for different platforms.

Why there are two SEPARATE guides

Historically the code was built for win16 and win32 (this is old legacy code from early Visual C++ versions). The win64 build is a new task: it required targeted changes in the code related to bitness (the pointer size became 8 bytes, the signatures of several MFC functions changed). That is why the guides are split:

  • win32/ — the base, self-contained guide for the 32-bit build.
  • win64/ — a self-contained guide for the 64-bit build. It additionally contains the file 08-porting-changes.md — a log of ALL code changes made for 64-bit, with a justification for each.

Each of the two guides is read on its own: someone building only win32 does not have to look into win64, and vice versa.


Two ways to build: phased or all at once

The package can be built in two ways:

  1. Phased — open the projects in turn (libraries → viewers → kernels → FieldView), separately for win32 and win64. This is the main, fully detailed method (files 01…08). It is illustrative and convenient for training, debugging and rebuilding a single component.
  2. All at once from a single solutionsrc\tamic.slnx gathers all 12 projects with their dependencies; open it, pick a platform (Win32 or x64) — build the whole package. A fast "get everything" method. See the 09-solution-all.md section ("Building everything at once via the solution").

Both methods produce the same result in dist\win32\… and dist\win64\…. The phased order is described below.


Which build to start with

The recommended order (if you are doing this for the first time):

  1. First, fully build win32. It is closer to what already worked before, so it is simpler. You will get 6 working programs and 6 libraries.
  2. Then switch to win64. All the necessary code changes have already been made and are described in the log win64/08-porting-changes.md — the build can be reproduced reliably.

Do not try to build win64 in parallel with win32 until win32 works — otherwise it is unclear whether an error is due to "64-bit" or due to the environment not being set up yet.


What the package contains

6 libraries (static .lib):

Library Source folder For whom
sfile95.lib src\libs\SFILE95 viewers + kernels
complex.lib src\libs\complex viewers
exprint.lib src\libs\exprint viewers + kernels
TMCLibError.lib src\libs\TMCLibError kernels
prepr.lib src\libs\PREPR kernels
TMCIndan.lib src\libs\TMCIndan kernels

6 programs (executable .exe):

Program Source folder Purpose
TMCROS.exe src\viewers\Tmcrtout time-signal viewer
TMCGROUT.exe src\viewers\Tmcgrout scattering-matrix viewer
TMC_DN.exe src\viewers\DiaNapGr radiation-pattern viewer
tmc_rth.exe src\kernels\PlanarRT_H compute kernel, H-polarization (o-mode)
tmc_rtx.exe src\kernels\PlanarRT_X compute kernel, X-mode (6 macros)
FieldView.exe src\fieldview field visualizer (OpenGL)

Build order — 4 phases

The build is strictly phased. Within each guide (both win32 and win64) the phases go in this order:

PHASE 1 — all 6 libraries        → file 03-build-libs.md
PHASE 2 — 3 viewers              → file 04-build-viewers.md
PHASE 3 — 2 compute kernels      → file 05-build-kernels.md (X-mode: 6 macros)
PHASE 4 — FieldView (OpenGL)     → file 06-build-fieldview.md

Do not build the programs until ALL 6 libraries are ready. The order among the libraries themselves does not matter — each .lib compiles independently. But all 6 must be ready before Phase 2 begins.

Link dependencies (what links against what):

  • Viewers ← sfile95, complex, exprint
  • Compute kernels ← sfile95, prepr, exprint, TMCIndan, TMCLibError
  • FieldView ← opengl32, glu32 + sfile95, prepr, exprint, TMCIndan, TMCLibError

Structure of the guide files

docs/build-guide/
├── 00-overview.md            ← this file
├── win32/
│   ├── 01-requirements.md    ← what to install
│   ├── 02-setup-paths.md     ← property sheets and output folders
│   ├── 03-build-libs.md      ← Phase 1: libraries
│   ├── 04-build-viewers.md   ← Phase 2: viewers
│   ├── 05-build-kernels.md   ← Phase 3: kernels (X-mode — 6 macros)
│   ├── 06-build-fieldview.md ← Phase 4: FieldView (OpenGL)
│   └── 07-troubleshooting.md ← troubleshooting
└── win64/
    ├── 01-requirements.md
    ├── 02-setup-paths.md      ← + adding the x64 platform
    ├── 03-build-libs.md
    ├── 04-build-viewers.md
    ├── 05-build-kernels.md
    ├── 06-build-fieldview.md
    ├── 07-troubleshooting.md
    └── 08-porting-changes.md  ← log of all 64-bit code changes

Where to get test data

To verify the compiled programs, use the test sets from the samples\SAMPLE_R folder.