Compile: Difference between revisions

From MyGamingTalk
No edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 5: Line 5:
Latest Omni-bot version for Enemy Territory and Return to Castle Wolfenstein is in the '''stable''' branch !!!
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.
Use the Download ZIP button or install Git and clone the repository.


You also need GameMonkey: https://github.com/jswigart/gmscriptex
git clone https://github.com/jswigart/omni-bot.git -b stable --depth 1 --recursive /omni-bot
You also need submodule GameMonkey: https://github.com/jswigart/gmscriptex


The gmscriptex repository has 3 folders. You only need the '''gmsrc_ex''' folder. Move it into Omnibot\dependencies folder or create symbolic link.
Omni-bot depends on the Boost libraries which can be downloaded from https://github.com/boostorg/boost/releases or https://sourceforge.net/projects/boost/


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


= Linux =
You need C++ compiler:
 
sudo apt-get install g++


== Compile Boost ==
== Compile Boost ==


If your Linux distribution contains boost packages, you can just install the packages and skip this step.
If your Linux distribution contains boost packages, you can just install the packages and skip this step. But those packages does not work on 64-bit.


Run shell as root. Change current directory to boost.
Run shell terminal and change current directory to boost source.


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


Header files will be copied into /usr/local/include/boost. Libraries will be copied into /usr/local/lib
If you want to copy Boost to the system path /usr/local, you can use b2 parameter install, but it requires root privileges. You can also use --prefix parameter to install it to another folder.
 
It's possible to install boost to another folder which does not require root privileges. See boost documentation.


== Compile Omni-bot ==
== Compile Omni-bot ==


If you want to compile Omni-bot for other games than Enemy Territory, open the file Omnibot\Jamfile in a text editor and uncomment build-project commands (they are at the end of Jamfile).
If you don't want to compile Omni-bot for all supported games, open 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.
Open script Omnibot\linux\buildbot.sh in a text editor and change paths. The '''$BOOST''' variable is a path to include header files. It is usually same as the Boost root installation folder. The '''$BOOST_LIB''' is path with static libraries (libboost_system.a, libboost_regex.a ...). They are usually located in $BOOST/stage/lib. The $BOOST_BUILD_PATH and $BOOST_SUFFIX variables are not needed anymore in the 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.
If you are lucky and compilation is successful, you will have file omnibot_et.so or omnibot_rtcw.so somewhere in Omnibot\build folder.
Line 50: Line 51:
Add parameter address-model=64 to bjam command when you compile Omni-bot.
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 =
= Windows =


Project files are for Microsoft Visual Studio 2013. You can use free Express or Community edition.
Project files are for Microsoft Visual Studio 2017 or newer. You can [https://visualstudio.microsoft.com/downloads/ download] free Community edition. While installing choose the "Desktop development with C++" workload.


== Compile Boost ==
== Compile Boost ==
Start "VS2013 x86 Native Tools Command Prompt" from the Start menu.
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.
Change current directory to boost root.


  bootstrap.bat
  bootstrap.bat
  .\bjam --with-date_time --with-filesystem --with-regex --with-system --with-thread link=static runtime-link=static variant=release
  .\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 variant parameter to debug if you want to compile Omni-bot with debugging info.
Line 68: Line 82:
== Compile Omni-bot ==
== Compile Omni-bot ==


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


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


The solution contains projects for all supported and unsupported games. You probably only need to compile projects Common, gm_ex and MOD_ET or  MOD_RTCW.
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 on toolbar and compile.
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 file to installation folder. You can modify it if you want another folder.
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
If you are lucky and compilation is successful, you will have file omnibot_et.dll or omnibot_rtcw.dll.
omnibot_rtcw.dll or omnibot_rtcw_x64.dll are copied into RTCW_INST.


== Compile Mods ==
== Compile Mods ==


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


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


There are 3 projects in the solution: cgame, game, ui.  
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.
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.
<headertabs />

Latest revision as of 11:17, 31 December 2024


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 clone the repository.

git clone https://github.com/jswigart/omni-bot.git -b stable --depth 1 --recursive /omni-bot

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

Omni-bot depends on the Boost libraries which can be downloaded from https://github.com/boostorg/boost/releases or 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. But those packages does not work on 64-bit.

Run shell terminal and change current directory to boost source.

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

If you want to copy Boost to the system path /usr/local, you can use b2 parameter install, but it requires root privileges. You can also use --prefix parameter to install it to another folder.

Compile Omni-bot

If you don't want to compile Omni-bot for all supported games, open 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 variable is a path to include header files. It is usually same as the Boost root installation folder. The $BOOST_LIB is path with static libraries (libboost_system.a, libboost_regex.a ...). They are usually located in $BOOST/stage/lib. The $BOOST_BUILD_PATH and $BOOST_SUFFIX variables are not needed anymore in the 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.