Compile

From MyGamingTalk
Revision as of 19:31, 29 December 2024 by Palota (talk | contribs) (→‎Linux)


You can get Omni-bot C++ source code from GitHub: https://github.com/jswigart/omni-bot

Latest Omni-bot version for Enemy Territory and Return to Castle Wolfenstein is in the stable branch !!!

Use the Download ZIP button or install Git and then clone the repository.

You also need submodule GameMonkey: https://github.com/jswigart/gmscriptex

Omni-bot depends on the Boost libraries which can be downloaded from https://sourceforge.net/projects/boost/

Linux

You need C++ compiler:

sudo apt-get install g++

Compile Boost

If your Linux distribution contains boost packages, you can just install the packages and skip this step.

Run shell as root. Change current directory to boost.

./bootstrap.sh --with-libraries=date_time,filesystem,regex,system
./b2 address-model=32 link=static install

Header files will be copied into /usr/local/include/boost. Libraries will be copied into /usr/local/lib

You can use --prefix parameter to install boost to another folder which does not require root privileges. See boost documentation.

Compile Omni-bot

If you don't want to compile Omni-bot for all supported games, open the file Omnibot\Jamfile in a text editor and insert comment # before build-project commands that you don't want to compile (they are at the end of Jamfile).

Open script Omnibot\linux\buildbot.sh in a text editor and change paths. The BOOST_SUFFIX variable should be empty in current Boost version. Then run the script.

If you are lucky and compilation is successful, you will have file omnibot_et.so or omnibot_rtcw.so somewhere in Omnibot\build folder.

Compile Mods

Run script buildet.sh or buildrtcw.sh.

Files cgame.mp.i386.so and ui.mp.i386.so must be compressed into archive omnibot_et.pk3 or omnibot_rtcw.pk3.

64-bit

If you use 64-bit ET:Legacy and legacy mod, you must compile 64-bit Omni-bot.

Add parameters address-model=64 cflags=-fPIC when you compile Boost.

Add parameter address-model=64 to bjam command when you compile Omni-bot.

Cross-compilation

It is possible to build ARM binaries on x86 machine.

sudo apt install g++-aarch64-linux-gnu

Create file ~/user-config.jam:

using gcc : arm : aarch64-linux-gnu-g++ ;

Then add parameter toolset=gcc-arm when you compile Boost and Omni-bot.

Windows

Project files are for Microsoft Visual Studio 2017 or newer. You can download free Community edition. While installing choose the "Desktop development with C++" workload.

Compile Boost

You can easily download boost binaries from https://sourceforge.net/projects/boost/files/boost-binaries/. Then you don't need to compile it and you can skip this step.

Start "x86 Native Tools Command Prompt for VS" from the Start menu. Change current directory to boost root.

bootstrap.bat
.\b2 --with-date_time --with-filesystem --with-regex --with-system link=static runtime-link=static variant=release

Add parameter address-model=64 if you compile 64-bit version.

Change variant parameter to debug if you want to compile Omni-bot with debugging info.

Change runtime-link parameter to shared if you want to use Code Generation / Runtime Library - Multi-threaded DLL (/MD)

Compile Omni-bot

Open file Omnibot\projects\msvc12\PropertySheets\Paths.props in a text editor and change the BOOST path.

Open solution Omnibot\projects\msvc12\Omni-bot.sln.

The solution contains projects for all supported games. Project MOD_ET is for Enemy Territory. Project MOD_RTCW is for Return to Castle Wolfenstein. Projects Common and gm_ex are required for both games.

Select Release or Debug configuration and Win32 or x64 configuration on the toolbar and compile. There is a Post-Build Event defined to copy output files to installation folders. These folders are defined in Omnibot\projects\msvc12\PropertySheets\Paths.props. Files omnibot_et.dll or omnibot_et_x64.dll are copied into ET_INST. Files omnibot_rtcw.dll or omnibot_rtcw_x64.dll are copied into RTCW_INST.

Compile Mods

Enemy Territory mod solution: GameInterfaces\ET\src\ET.sln

Return to Castle Wolfenstein solution: GameInterfaces\RTCW\src\RTCW.sln

There are 3 projects in the solution: cgame, game, ui. Projects cgame and ui have Post-Build Event defined to compress cgame_mp_x86.dll and ui_mp_x86.dll into omnibot_et.pk3 or omnibot_rtcw.pk3.