PathEngine home previous: Building in Visual Studionext: Preprocessor Defines
Contents, Programmers Guide, Building the Source Code, Building with the Python Build Scripts

Building with the Python Build Scripts

For platforms without Visual Studio, the PathEngine source archives come with a python build script that serves to make a default build from the source code, with some dependency checking. The GCC based platform specific code packages enable the PathEngine run-time library to be built on various operating systems and architectures where the GCC toolchain is available as a standard compilation environment.

Motivation and scope

The python build scripts are provided as a quick way to get the source code to build, avoiding the complexities of cross-platform differences in makefile operation, and to demonstrate a baseline set of compile settings for each platform.

While the build scripts do include automatic dependency generation and checking (per source file), and should generally build the source code robustly, the scripts do have some rough edges, and are not intended to take the place of a fully featured build setup tool.

Requirements

The build scripts require python and GCC installed and on the search path. (The dependency generation code works by calling through to 'gcc -MM'.)

Python is generally included as standard with Linux and FreeBSD distributions.
If not then it can be downloaded and installed from www.python.org.
The build setup has been tested against Python versions 2.5 and 2.6, should also work with other 2.x releases.

Building the source code requires a reasonably standard compliant compiler (e.g. a recent version of GCC), with C and C++ standard libraries installed.

Contents of the platform archives

Python build scripts are provided with the platform specific code archives for the following platforms (by platform code, see Source Code Packages)):

These platform specific archives then include platform specific code directories, plus python build scripts and text files with a list of source files to be included for each project.

The packages should be extracted over the top of the base full source package, ensuring that the release numbers for the two packages match.

Where more than one of the above packages is installed files will be repeated and it is ok for these to be overwritten.

Setting environmental variables

Before building the source code, the following environmental variables need to be set:

(In Bash, you can do this from the command line with 'export PATHENGINE_CONFIGURATION=Debug' and 'export PATHENGINE_CONFIGURATION=GCCx64', for example, before executing the build command.)

Running the build scripts

Before running the build scripts, change directory to 'SDKRoot/python/buildScripts'.

The build command is then of the form "python MakeProject.py projectType projectName", where:

After the first build the build scripts will check dependencies and only recompile objects that need to be recompiled.

Building the run-time library

To build the PathEngine run-time library as a shared object, type "python MakeProject.py so PathEngine".

Build result

The above build operation should generate a file 'PathEngine.so', in a directory location 'SDKRoot/build/platform/configuration/projectType/', where platform is replaced by the code for the platform being built, configuration is replaced by the configuration being built (e.g. 'Debug' or 'Release'), and projectType is the project type specified in the build command.

(So, assuming a debug build, on x64 Linux, the build result should be located at 'SDKRoot/build/GCCx64/Debug/so/PathEngine.so'.)

This is a shared object binary, essentially the Linux equivalent of a Windows DLL.
Refer to Dynamic Linking on GCC Based Platforms for details about linking dynamically against this file.

Static linkage

To build the PathEngine run-time library as a .lib file for static linkage use "python MakeProject.py lib PathEngine".

Refer to Static Linkage for information about static linkage in general.

Changing the compile command

Depending on how GCC is setup, it may be necessary to modify the compile command.
This can be done by modifying the compileCommand() function, in 'SDKRoot/code/buildScripts/PlatformConfig.py'.
(And this compile command can also be modified to change the level of optimisation, and so on.)

Forcing a full rebuild

Note that the build scripts don't check themselves as a dependency, so it may be necessary to perform a full rebuild after script changes.
This can be done by deleting all the intermediate directories generated by a previous build command, or by simply deleting the build directory completely.


Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: Preprocessor Defines