From b69b4dc0f46d8873fbcded3bb64a86d7651ffac3 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Wed, 9 Oct 2024 14:32:40 +0200 Subject: [PATCH] Add CMakePresets.json Introduce CMakePresests.json which is a simple way to perform incremental build using cmake New configure resets were added: - default: Configure compilation with default options - tests: Same as above but ENABLE_TESTS and SANITIZE_ADDRESS is ON New build presets were added: - 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 ` --- .gitignore | 1 + CMakePresets.json | 64 +++++++++++++++++++++++++++++++++++++++++++++++ doc/BUILD.md | 24 ++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 CMakePresets.json diff --git a/.gitignore b/.gitignore index 3a0d25c25c..c4a4022fba 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ tags nfapi_nr_interface_scf *.log *.out +CMakeUserPresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..9e20a5b07a --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,64 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default", + "displayName": "Default Config", + "description": "Default build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/cmake_targets/ran_build/build", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + }, + { + "name": "tests", + "displayName": "Default unit test config", + "inherits": "default", + "binaryDir": "${sourceDir}/cmake_targets/ran_build/build_test", + "cacheVariables": { + "ENABLE_TESTS": "ON", + "SANITIZE_ADDRESS": "ON", + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + } + ], + "buildPresets": [ + { + "name": "5gdefault", + "configurePreset": "default", + "targets": [ + "nr-uesoftmodem", + "nr-softmodem", + "rfsimulator", + "dfts", + "ldpc", + "params_libconfig", + "params_yaml" + ] + }, + { + "name": "default", + "inherits": "5gdefault" + }, + { + "name": "4gdefault", + "configurePreset": "default", + "targets": [ + "lte-softmodem", + "lte-uesoftmodem", + "dfts", + "coding", + "rfsimulator", + "params_libconfig" + ] + }, + { + "name": "tests", + "configurePreset": "tests", + "targets": [ + "tests" + ] + } + ] +} diff --git a/doc/BUILD.md b/doc/BUILD.md index dc5b1361f2..4d629007b0 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -217,6 +217,30 @@ 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 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.