Building BehaviorTree.CPP Static Library for Windows (MinGW & CMake) Сборка статической библиотеки BehaviorTree.CPP для Windows (MinGW и CMake)

A guide to compiling BehaviorTree.CPP source code into a static library for Windows using MinGW and CMake. Руководство по компиляции исходного кода BehaviorTree.CPP в статическую библиотеку для Windows с помощью MinGW и CMake.

If you haven't set up MinGW and CMake on your machine, follow the Если вы еще не настроили MinGW и CMake на своем компьютере, следуйте инструкции: MinGW & CMake Setup Guide Руководство по настройке MinGW и CMake

Step 1: Download BehaviorTree.CPP Source Code Шаг 1: Скачивание исходного кода BehaviorTree.CPP

Download the latest BehaviorTree.CPP source archive (.zip or .tar.gz) from the official GitHub releases page: Скачайте последний архив с исходным кодом BehaviorTree.CPP (.zip или .tar.gz) с официальной страницы релизов GitHub:

Download BehaviorTree.CPP Releases Скачать релизы BehaviorTree.CPP

Extract the downloaded archive to a convenient directory on your machine. Распакуйте скачанный архив в удобную директорию на вашем компьютере.

Step 2: Create the Build Script Шаг 2: Создание скрипта сборки

In the root directory of the extracted BehaviorTree.CPP source folder, create an empty file named build-mingw-static.bat and paste the following content into it: В корневой директории распакованного исходного кода BehaviorTree.CPP создайте пустой файл build-mingw-static.bat и вставьте в него следующее содержимое:

@echo off

if exist build-mingw-static rmdir /s /q build-mingw-static
mkdir build-mingw-static
cd build-mingw-static

cmake .. ^
  -G "MinGW Makefiles" ^
  -DCMAKE_BUILD_TYPE=Release ^
  -DCMAKE_INSTALL_PREFIX=C:/libs/behaviortree-4.9.0-mingw ^
  -DBTCPP_SHARED_LIBS=OFF ^
  -DBTCPP_BUILD_TOOLS=OFF ^
  -DBTCPP_EXAMPLES=OFF ^
  -DBUILD_TESTING=OFF ^
  -DBTCPP_GROOT_INTERFACE=OFF ^
  -DBTCPP_SQLITE_LOGGING=OFF

cmake --build . --config Release --parallel 8 --target install
Note: Примечание: We set -DBTCPP_GROOT_INTERFACE=OFF to disable the ZeroMQ dependency, and -DBTCPP_SQLITE_LOGGING=OFF to remove SQLite requirements. Note that tinyxml2 is compiled as part of the internal tree, but projects consuming this static library on Windows or Linux must link against `tinyxml2` symbols explicitly. Мы используем -DBTCPP_GROOT_INTERFACE=OFF, чтобы отключить ZeroMQ, и -DBTCPP_SQLITE_LOGGING=OFF для исключения SQLite. Обратите внимание, что хотя tinyxml2 собирается внутренне, проектам, использующим эту статическую библиотеку, потребуется явное связывание с `tinyxml2`.

Step 3: Run and Compile Шаг 3: Запуск и сборка

Run build-mingw-static.bat via Command Prompt (CMD) so you can catch any potential compilation errors in the console. Once completed, your compiled static library along with header files will be installed in the output path set by CMAKE_INSTALL_PREFIX. Запустите build-mingw-static.bat через командную строку (CMD), чтобы вы могли увидеть возможные ошибки сборки прямо в консоли. После завершения собранная статическая библиотека вместе с заголовочными файлами будет установлена по пути, указанному в CMAKE_INSTALL_PREFIX.

Step 4: Next Steps Шаг 4: Следующие шаги

Now that you have configured your environment, you can proceed with integrating the BehaviorTree.CPP library using CMake: Теперь, когда вы настроили окружение, вы можете перейти к интеграции библиотеки BehaviorTree.CPP с помощью CMake:

Integrating BehaviorTree.CPP Library with CMake on Windows & Ubuntu Интеграция C++-библиотеки BehaviorTree.CPP с CMake под Windows и Ubuntu


Support My Work Поддержать проект

If these tutorials helped you, consider buying me a coffee! Если эти туториалы вам помогли, вы можете поддержать автора.

Sberbank (Russia only) Сбербанк (только для РФ)

Sberbank SBP QR Code

Direct transfer via phone number (Russia only) Перевод по номеру телефона (только для РФ)

+7 (917) 212-29-59

USDT TRC20

USDT TRC20 QR Code

Support via Cryptocurrency Поддержка криптовалютой

TMtY1YifNf6FKvgeFmqKGQR4NStKr3csGp