Free Electron
Setup Your Environment

You will have to verify and update version numbers as appropriate.

This are not literal scripts. Read what you type.

For Linux, you will probably need to "export" the variables that you set, depending on the shell that you use. This makes them available to scripts that you run.

For Windows, you can set variable for each user by going to: [Control Panel -> User Accounts -> User Accounts -> Change my environment variables].

You can specify environment variables on the command line with arguments of the form VARIABLE="value". Variables on the command line override variables in the shell. For environment variables not set in the shell and not specified on the command line, the local.env file in the base directory is read fill in the default values. You can edit local.env to adjust your local configuration.

General build environment (all platforms)

For the quick build using wrapper scripts, many of the environment variables are set using the SET_ENV script, which may be a good reference.

It is not required to set any enviroment variables, but some are commonly changed.

The build type can be set with CODEGEN, usually debug or optimize.

CODEGEN=optimize (validate, debug, profile, or optimize)

Validate is a much slower version of debug that incorporates features such as deep reference tracking. Debug should be responsive. Profile usually has optimization, but may also have debug symbols. Optimize does not do Handler timing.

By default, the selection of modules to build is specified with forge.product in various products.py files, but the optional variable FE_EXT can be used to override the selection with a colon-delimited list, such as:

FE_EXT=datatool:geometry:math

Other optional variables:

FE_ROOT=<install path>/base
PRETTY=1 (compile using color and without echoing commands)
CCACHE_DIR=/usr/tmp/ccache (or similar, to use ccache tool)
DISTCC_HOSTS="<hosts>" (for distcc tool, unset or blank to avoid; see distcc man page)
JOBS=`grep -c \^processor /proc/cpuinfo`
FE_CC=g++-4.4 (alternate compiler)
FE_MOD_KILL="src.math:ext.geometry" (forcably remove modules)
FE_UNIT=1 (automatically run unit tests)
FE_USE_SSE=3.0 (numerical; turn on SSE optimizations to specified level, if available)
FE_USE_AVX=0.0 (numerical; turn on AVX optimizations to specified level, if available)
FE_USE_PCH=0 (turn off pre-compiled headers)
FE_USE_VISIBILITY=1 (turn on selective class visibility, if available)
FE_DOUBLE_REAL=1 (define Real as double, otherwise float; default may change)
FE_E_ASSERT=1 (at runtime, assert in before throwing exceptions)
FE_E_BACKTRACE=1 (at runtime, backtrace FE exceptions at throw)
FE_E_UNCAUGHT_BACKTRACE=0 (at runtime, don't add handler to backtrace uncaught exceptions)
FE_SEGV_BACKTRACE=1 (at runtime, don't add handler to backtrace during segfault)
FE_SEGV_ATTACH=1 (at runtime, try to attach to debugger on segfault)
FE_GL_LOCKING=1 (at runtime, use thread locking to serialize OpenGL commands with window operations)
path to create 'lib' directory under for generated binaries (defaults to FE_ROOT in forge)
FE_LIB=/usr/local
path to create 'obj' directory under for generated object files (defaults to FE_LIB in forge)
FE_OBJ=/usr/tmp

Note that if you don't set FE_LIB, you need to use FE_ROOT instead of FE_LIB in the examples that follow.

SSE may reduce binary portability.

Linux environment

When using Free Electron libraries in another tool, you may need to make the full array of libraries visible. This may be possible be adding to the colon-separated environment variable LD_LIBRARY_PATH

${FE_LIB}/lib/x86_linux_${CODEGEN}

Win32 environment

Make sure you activate 'Developer mode'. You can type "Developer Settings" in the Windows search bar. If you can't make symbolic links, you probably aren't in developer mode.

Compile with the "Visual Studio" prompt which automatically sets basic compiler variables.

Basic variables:

Path=%Path%;
%FE_ROOT%\bin;
%FE_LIB%\lib\x86_win32_%CODEGEN%;
%FE_LIB%\lib\x86_win32_%CODEGEN%\fe;

Additional variables for optional tools:

HASH_MAP_OVERRIDE=1
BOOST_STRUCTURE=install
PYTHON_ROOT=c:\python22
DevIL=c:\DevIL
ODE=c:\ode-0.8
OpenAL=%FE_ROOT%\dep\OpenAL1.1
SDL=c:\SDL-1.2.7
INCLUDE=%INCLUDE%;
%DevIL%\include;
%ODE%\include;
%OpenAL%\include;
%OSG_ROOT%\include;
%SDL%\include;
LIB=%LIB%;
%DevIL%\lib;
%ODE%\lib\debugdll;
%OpenAL%\libs;
%OSG_ROOT%\lib;
%SDL%\lib;
Path=%Path%;
%PYTHON_ROOT%;
%PYTHONPATH%;
%DevIL%\lib;
%OpenAL%\dll;
%OSG_PATH%;
%SDL%\lib;
PYTHONPATH=%PYTHONPATH%;
%FE_PATH%