diff options
-rw-r--r-- | CMakePresets.json | 196 | ||||
-rw-r--r-- | docs/sections/building.md | 61 |
2 files changed, 256 insertions, 1 deletions
diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..491a245 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,196 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "base", + "description": "Base configuration, sets build directory.", + "hidden": true, + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/build-${presetName}" + }, + { + "name": "gcc-toolchain", + "description": "Use gcc toolchain.", + "hidden": true, + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": { + "type": "STRING", + "value": "${sourceDir}/scripts/cmake/toolchains/bare-metal-gcc.cmake" + } + } + }, + { + "name": "armclang-toolchain", + "description": "Use armclang toolchain.", + "hidden": true, + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": { + "type": "STRING", + "value": "${sourceDir}/scripts/cmake/toolchains/bare-metal-armclang.cmake" + } + } + }, + { + "name": "mps3-300", + "description": "Target mps3 board, SSE-300 subsystem.", + "hidden": true, + "cacheVariables": { + "TARGET_PLATFORM": { + "type": "STRING", + "value": "mps3" + }, + "TARGET_SUBSYSTEM": { + "type": "STRING", + "value": "sse-300" + } + } + }, + { + "name": "mps3-310", + "description": "Target mps3 board, SSE-310 subsystem.", + "hidden": true, + "cacheVariables": { + "TARGET_PLATFORM": { + "type": "STRING", + "value": "mps3" + }, + "TARGET_SUBSYSTEM": { + "type": "STRING", + "value": "sse-310" + } + } + }, + { + "name": "simple-platform", + "description": "Target simple platform.", + "hidden": true, + "cacheVariables": { + "TARGET_PLATFORM": { + "type": "STRING", + "value": "simple_platform" + } + } + }, + { + "name": "simple-gcc", + "displayName": "simple-gcc", + "description": "Target simple platform build with bare-metal gcc toolchain.", + "inherits": [ + "base", + "simple-platform", + "gcc-toolchain" + ] + }, + { + "name": "simple-clang", + "displayName": "simple-armclang", + "description": "Target simple platform build with bare-metal armclang toolchain.", + "inherits": [ + "base", + "simple-platform", + "armclang-toolchain" + ] + }, + { + "name": "mps3-300-gcc", + "displayName": "mps3-300-gcc", + "description": "Target mps3 board, SSE-300 subsystem with bare-metal gcc toolchain.", + "inherits": [ + "base", + "mps3-300", + "gcc-toolchain" + ] + }, + { + "name": "mps3-300-clang", + "displayName": "mps3-300-armclang", + "description": "Target mps3 board, SSE-300 subsystem with bare-metal armclang toolchain.", + "inherits": [ + "base", + "mps3-300", + "armclang-toolchain" + ] + }, + { + "name": "mps3-310-gcc", + "displayName": "mps3-310-gcc", + "description": "Target mps3 board, SSE-310 subsystem with bare-metal gcc toolchain.", + "inherits": [ + "base", + "mps3-310", + "gcc-toolchain" + ] + }, + { + "name": "mps3-310-clang", + "displayName": "mps3-310-armclang", + "description": "Target mps3 board, SSE-310 subsystem with bare-metal armclang toolchain.", + "inherits": [ + "base", + "mps3-310", + "armclang-toolchain" + ] + }, + { + "name": "native", + "inherits": [ + "base" + ], + "displayName": "native", + "description": "Target native system.", + "cacheVariables": { + "TARGET_PLATFORM": { + "type": "STRING", + "value": "native" + }, + "CMAKE_TOOLCHAIN_FILE": { + "type": "STRING", + "value": "${sourceDir}/scripts/cmake/toolchains/native-gcc.cmake" + } + } + } + ], + "buildPresets": [ + { + "name": "native", + "configurePreset": "native" + }, + { + "name": "mps3-300-gcc", + "configurePreset": "mps3-300-gcc" + }, + { + "name": "mps3-300-clang", + "configurePreset": "mps3-300-clang" + }, + { + "name": "mps3-310-gcc", + "configurePreset": "mps3-310-gcc" + }, + { + "name": "mps3-310-clang", + "configurePreset": "mps3-310-clang" + }, + { + "name": "simple-gcc", + "configurePreset": "simple-gcc" + }, + { + "name": "simple-clang", + "configurePreset": "simple-clang" + } + ], + "testPresets": [ + { + "name": "native-tests", + "description": "native tests", + "displayName": "Run native tests.", + "configurePreset": "native" + } + ] +}
\ No newline at end of file diff --git a/docs/sections/building.md b/docs/sections/building.md index 1c39027..a7b64aa 100644 --- a/docs/sections/building.md +++ b/docs/sections/building.md @@ -18,6 +18,7 @@ - [Configuring the build for MPS3 SSE-310](./building.md#configuring-the-build-for-mps3-sse_310) - [Configuring native unit-test build](./building.md#configuring-native-unit_test-build) - [Configuring the build for simple-platform](./building.md#configuring-the-build-for-simple_platform) + - [Building with CMakePresets](./building.md#building-with-cmakepresets) - [Building the configured project](./building.md#building-the-configured-project) - [Building timing adapter with custom options](./building.md#building-timing-adapter-with-custom-options) - [Add custom inputs](./building.md#add-custom-inputs) @@ -73,7 +74,7 @@ Before proceeding, it is *essential* to ensure that the following prerequisites ```log cmake version 3.22.4 - ``` + ``` > **Note:** Required version of CMake is also installed in the Python3 virtual environment created by > `setup_default_resources.py` script. See [Fetching resource files](./building.md#fetching-resource-files) section. @@ -541,6 +542,64 @@ cmake .. \ -DCMAKE_TOOLCHAIN_FILE=scripts/cmake/toolchains/bare-metal-armclang.cmake ``` +### Building with CMakePresets + +If you are using CMake version 3.21 or above, then an alternative method of building is by using CMakePresets. +This can be done by calling the following command: +```commandline +cmake --preset <platform> +cmake --build --preset <platform> +``` +where platform is one of: +```commandline +native +mps3-gcc +mps3-clang +simple-gcc +simple-clang +``` +This will automatically configure and build the evaluation-kit into a corresponding folder. +You can still pass in build flags as usual, for example: +```commandline +cmake --preset mps3-gcc -DUSE_CASE_BUILD=inference_runner +cmake --build --preset mps3-gcc +``` +Alternatively, you can create a CMakeUserPresets.json in the root of the project with personal user settings, for example: +```commandline +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "my-config", + "displayName": "my-config", + "inherits": ["mps3-300-gcc"], + "cacheVariables": { + "LOG_LEVEL": { + "type": "STRING", + "value": "LOG_LEVEL_DEBUG" + } + } + } + ], + "buildPresets": [ + { + "name": "mps3-300-gcc-custom", + "displayName": "mps-300-gcc-custom", + "configurePreset": "my-config", + "targets": [ + "ethos-u-object_detection", + "ethos-u-inference_runner"], + "jobs": 12 + } + ] +} +``` + ### Building the configured project If the CMake command succeeds, build the application as follows: |