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 files, but the optional variable FE_EXT can be used to override the selection with a colon-delimited list, such as:


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 (used at runtime, assert in before throwing exceptions)
FE_E_BACKTRACE=1 (used at runtime, try to backtrace certain failures)
FE_E_ATTACH=1 (used at runtime, try to attach to debugger on segfault)
FE_GL_LOCKING=1 (used 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)
path to create 'obj' directory under for generated object files (defaults to FE_LIB in forge)

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


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:


Additional variables for optional tools: