Which files compose build configurations?

Hi there,

I have a project, and I want to commit the files that contain the build configuration into our Git repository.

I've tried to narrow down the files that make the build configuration appear in Visual Studio Code when opening the project, and I initially found that the CMakeCache.txt and build.ninja files of the build directory are the ones, but I'm starting to doubt my findings as these files are very large and often have huge changes from build to build.

There must be a better way. Is there?

Parents
  • Hi,

    Once you make the build configuration, you can choose to save it. Once you save it, it will be in your project root directory and is called CMakePresets.json.

    An example of the file it creates:

    {
        "version": 2,
        "cmakeMinimumRequired": {
            "major": 3,
            "minor": 20
        },
        "configurePresets": [
            {
                "name": "build",
                "displayName": "Build for nRF52840 DK NRF52840",
                "generator": "Ninja",
                "binaryDir": "${sourceDir}/build",
                "cacheVariables": {
                    "NCS_TOOLCHAIN_VERSION": "NONE",
                    "BOARD": "nrf52840dk_nrf52840",
                    "CONF_FILE": "${sourceDir}/prj.conf"
                }
            }
        ]
    }

    Also as a warning, I've been having trouble getting it to save any DTS overlay files (just opened a ticket). That hasn't been a problem until this new update so just a heads up. Here's the ticket I just made for your reference.

  • That looks just like what I needed... but it seems simply having the CMakePresets.json file in the project directory is not sufficient. In nRF Connect SDK for VS Code, the build target in the Applications section only appears if there is a subdirectory with CMakeCache.txt present, so it is not possible to have a build target in CMakePresets.json defined and run a pristine build for this configuration just after checking it out from a repository (unless you include the build directory which all its temporary generated files).

    @mlac:Is the build configuration in your project still present if you delete the build directory (${sourceDir}/build in the example above)? Have you found a beauftiful way for handling build targets in your repository without committing the build directories?

  • By default, the build configurations don't show up for me in VS Code after checking out the repo, and I don't think they're supposed to show up. To my knowledge, CMakePresets.json only offers presets when creating build configurations.

    I'd also love the build configurations to show up by default without having to create them.

Reply Children
No Data
Related