diff --git a/doc/BUILD.md b/doc/BUILD.md index 063c31dbe1..c8efd3a4b0 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -2,9 +2,9 @@ # OAI Build Procedures -[[_TOC_]] +This page describes how to build OAI. -This page is valid on tags starting from **`2019.w09`**. +[[_TOC_]] ## Overview @@ -12,7 +12,11 @@ The [OAI EPC](https://github.com/OPENAIRINTERFACE/openair-epc-fed/blob/master/do OAI softmodem sources, which aim to implement 3GPP compliant UEs, eNodeB and gNodeB can be downloaded from the Eurecom [gitlab repository](./GET_SOURCES.md). -Sources come with a build script [build_oai](../cmake_targets/build_oai) located at the root of the `openairinterface5g/cmake_targets` directory. This script is developed to build the oai binaries (executables,shared libraries) for different hardware platforms, and use cases. +The historically convential way to build OAI is +[build_oai](../cmake_targets/build_oai) located at the root of the +`openairinterface5g/cmake_targets` directory. This script is developed to build +the oai binaries (executables,shared libraries) for different hardware +platforms, and use cases, and is a wrapper on top of `cmake`. The main oai binaries, which are tested by the Continuous Integration process are: @@ -39,6 +43,81 @@ The oai softmodem supports many use cases, and new ones are regularly added. Mos - s1, noS1 - all simulators as the rfsimulator, the L2 simulator, with exception of PHY simulators, which are distinct executables. +## Dependencies + +TODO. + +## Running `cmake` directly + +As mentioned, `build_oai` is a wrapper on top of `cmake`. It is therefore +possible, and now recommended, to run `cmake` directly. To build all of OAI in +a default install: + +``` +cd openairinterface5g +mkdir build +cd build +cmake .. -GNinja +ninja +``` + +Alternatively, let cmake generate the directory: + +``` +cd openairinterface5g +cmake -B build -G Ninja +cmake --build build +``` + +To build additional libraries, e.g., telnetsrv, do the following: +```bash +cmake .. -GNinja -DENABLE_TELNETSRV=ON +ninja telnetsrv +``` + +A list of all libraries can be seen using `ccmake ..` or `cmake-gui ..`. + +The default target directory of `build_oai` is the following, for historical +reasons: +```bash +cd openairinterface5g/cmake_targets/ran_build/build +cmake ../../.. -GNinja +ccmake ../../.. +cmake-gui ../../.. +``` + +You can of course use all standard cmake/ninja/make commands in this directory, +assuming you already build with `build_oai`. For instance, to compile sources +after modifying the code, do +``` +cd cmake_targets/ran_build/build +ninja +``` + +### cmake presets + +CMake presets are common project configure options. See [here](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html). + +Configure presets: + + - `default`: Configure compilation with default options + - `tests`: Same as above but `ENABLE_TESTS` and `SANITIZE_ADDRESS` is ON + +Build presets: + + - `5gdefault`: Build the software for NR rfsimulator test + - `default`: same as 5gdefault + - `4gdefault`: Build the software for LTE rfsimulator test + - `tests`: build all unit tests + +To configure using configuration preset: + + cmake --preset + +To build using a build preset: + + cmake --build --preset + ## Running `build_oai` ### List of options @@ -176,60 +255,6 @@ Some libraries have further dependencies and might not build on every system: - `websrv`: npm and others - `ldpc_aal`: DPDK with patch -## Running `cmake` directly - -`build_oai` is a wrapper on top of `cmake`. It is therefore possible to run `cmake` directly. An example using `ninja`: to build all "main targets" for 5G, excluding additional libraries: -``` -cd openairinterface5g -mkdir build && cd build -cmake .. -GNinja && ninja nr-softmodem nr-uesoftmodem nr-cuup params_libconfig coding rfsimulator ldpc -``` - -To build additional libraries, e.g., telnetsrv, do the following: -```bash -cmake .. -GNinja -DENABLE_TELNETSRV=ON && ninja telnetsrv -``` - -A list of all libraries can be seen using `ccmake ..` or `cmake-gui ..`. - -It is currently not possible to build all targets in the form of `cmake .. --GNinja && ninja`: currently, SDRs are always exposed, even if you don't have -the dependencies, and some targets are simply broken. Again, `build_oai` list -all targets that it builds, and you can use them with `ninja` - -The default target directory of `build_oai` is the following, for historical reasons: -```bash -cd openairinterface5g/cmake_targets/ran_build/build -cmake ../../.. -GNinja -ccmake ../../.. -cmake-gui ../../.. -``` -You can of course use all standard cmake/ninja/make commands in this directory. - -### cmake presets - -CMake presets are common project configure options. See [here](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html). - -Configure presets: - - - `default`: Configure compilation with default options - - `tests`: Same as above but ENABLE_TESTS and SANITIZE_ADDRESS is ON - -Build presets: - - - `5gdefault`: Build the software for NR rfsimulator test - - `default`: same as 5gdefault - - `4gdefault`: Build the software for LTE rfsimulator test - - `tests`: build all unit tests - -To configure using configuration preset: - - cmake --preset - -To build using a build preset: - - cmake --build --preset - ## Cross Compile If you want to use cross-compiler on x86 platform for aarch64 version, please refer the [cross-compile.md](./cross-compile.md) for more information.