Development is underway for a new build system using CMake. At this point, the CMake build system is incomplete and experimental.
Normal build instructions are in the main README.md
.
cmake
3.2 or newer;- A supported C++ toolchain, E.G.
clang
,gcc
, ormsvc
; - A supported build tool, E.G.
ninja
,make
, or Microsoft Visual Studio.
# always prefer building outside the source tree
mkdir -p build && cd build
# configure the build
cmake .. # point cmake at the root source directory
# build it
cmake --build .
CMake build variables can be set on the command line with cmake -D<flag>[=<value>]
. Variables are cached in
CMakeCache.txt
. You can list cached variables with cmake -L
. There is also a helpful tool, cmake-gui
, which may
make your life easier.
CMake can generate build files for a number of backends. You can select the generator with -G<generator>
, and list
available generators with --help
. We recommend using with the Ninja
generator, when available. More information is
available here.
Compilation of major components is controlled with the following On/Off flags:
OMR_COMPILER
: Not yet supported.OMR_GC
: RequiresOMR_PORT
andOMR_THREAD
. Default isON
.OMR_JITBUILDER
: Not yet supported.OMR_PORT
: Default isON
.OMR_THREAD
: Default isON
.
Additionally, most testing can be enabled with the OMR_FVTEST
flag.
For more information on testing, see below.
The OMR_GLUE
variable points the build system at the glue directory. It defaults to example/glue
. The glue directory
is treated as a normal CMake subdirectory.
Ensure the tests are being built and that OMR_FVTEST
is On
(Note: default is off).
You must use the example glue. OMR_GLUE
should be example/glue
. OMR_EXAMPLE
should be set to ON
. Most tests will
not function without the example glue.
To actually run the tests:
# from the build directory
ctest -V
Cross compiling is untested. You must define a custom toolchain file for you cross compilers. More information about this is here. OMR relies on native build tools that must be available on the build platform. In a cross compile, these tools are to be imported from a native build.
Cross compiling OMR is done in two steps:
-
build the tools targeting the native platform:
mkdir -p native_build && cd native_build cmake .. && cmake --build .
This will generate
tools/ImportTools.cmake
. To import the tools, point the variableOMR_TOOLS_IMPORTFILE
at this file. -
Cross compile using your CC toolchain and native tools:
mkdir -p foreign_build && cd foreign_buid cmake .. -DCMAKE_TOOLCHAIN_FILE=path/to/file cmake .. -DOMR_TOOLS_IMPORTFILE=../native_build/tools/ImportTools.cmake cmake --build .
- OMR_SANITIZER={address,thread,undefined} turns on one: Address Sanitizer (ASan), Undefined Behaviour Sanitizer (UBSan) or Thread Sanitizer (TSan). This only has an effect with GCC or Clang.
The work here is ongoing. We are tracking development with github issue #993.