Building Code

Building Code#

Cross compilation is handled by CMake but in order to make the build process as easy as possible a Python based build tool is available which will coordinate the various invocations of cmake required. This requires Python 3.7+, but should not require any additional libraries.

build.py has the following options:

-x Specify which compiler to use without using interactive mode (default gcc, whichever version your machine has)
-d Specify where to find dependencies without using interactive mode (default /opt/polaris/deps/)
-i Interactive mode - prompts the user for dependency directory, compiler, and whether to reconfigure (if folder already exists) and build
-c Configure POLARIS without asking (default no)
-b Build POLARIS without asking (default no)
-t Test POLARIS without asking (default no)

An example for downloading and building POLARIS:

git clone "https://github.com/anl-polaris/polaris-linux.git" <code_dir>
cd <code_dir>
python3 build.py -x clang -d /opt/example/directory/ -c -b -t

Interactive mode example with default input for dependencies directory and compiler:

python build.py -i
Enter POLARIS dependencies directory (default is /opt/polaris/deps):
Enter compiler to use (gcc and clang supported, default is gcc):
Build directory already exists, would you like to reconfigure? (y/n, default is no): y
Would you like to build POLARIS now? (y/n, default is no): y

After running, configure-polaris.py will print and save its config for later use - if you want to configure and build with clang with a different dependency directory, it will save these settings in config.json:

python3 build.py -c -b

The above will use whatever settings are default (described above) or saved in config.json. Build files will be made in <code_dir>/build_linux, either release or debug. Note that only Clang supports the debug configuration, GCC will not build.

The application can be tested by executing against the supplied test city: cd <code_dir>/data/test_city ./run.sh Or by using the build script:

python3 build.py -t

Execution binary for debug is located in <code_dir>\build_win32\bin\Debug Execution binary for release is located in <code_dir>\build_win32\bin\Release