This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF Connect VSCode Extension - Saving Build Configuration

Hello,

I've started to develop with the nRF Connect VSCode extension and enjoying it a lot. However, I've noticed when I share a project the build configuration doesn't carry across.

Is there any way to get the extension to save the build configuration to a file or to .vscode/settings.json?

Our current workaround is to a shell script that runs the same command as the build configurator does but it's not ideal.

Many thanks,

Archie

  • Hi Archie,

    The build configuration in VS Code is connected to the build folder, so sharing the project folder with the build folder inside will technically let you share the build configuration. However, this will give you an error if you try to build the shared project unless you do a pristine build, because the environment of the project folder will now be incorrect with regards to the configurations. I would not recommend doing this.

    Is there a particular reason for why you need to share the build configuration and cannot simply create a new one in the shared project? If you are going to build the shared project you would have to configure the project again anyway (by either doing a pristine build or creating a new build configuration), so there is no reason to share the build configuration/folder.

    Best regards,

    Marte

  • Hi Marte,

    Thank you for your swift response. 

    As you said, I don't want to share the build folder but I do want others to be able to clone the repo and build the same configuration as me (same board, same CMake arguments, same folder name etc). Ideally, I would like these to appear in the nRF Connect GUI like the application does so they can quickly make a pristine build without having to fill in the build configuration GUI or type a command.

    Maybe I'm using build configurations wrong and this isn't the intended use case? We currently have two build configurations in your repo, one for the nRF dev board and one for the native posix board. One is our main target, the other is for unit testing. 

    I hope that makes sense. Let me know if you have more questions. 

    Many Thanks,

    Archie

  • Hi Archie,

    I would not recommend using the build configuration for this. However, some of this can be solved by setting the configurations in CMakeLists.txt. Please see Providing CMake options and Important Build System Variables for more information.

    Best regards,

    Marte

  • Hi Marte,

    Thank you for your reply. This is the solution I have come to as well.

    What is the purpose of build configuration then? I'm a bit unsure what their use case is if this isn't it. 

    Many Thanks,
    Archie

  • Hi Archie,

    The build configuration is essentially a CMake build system. Much of what the VS Code extension does are things you can do on the command line using west and cmake, but with the extension you have a GUI making the process easier. When you create the build configuration it is the same as if you were to run the 'west build' command, but instead of needing to know what parameters to add to the command and how you can just select them in the GUI. For example, it is easier to select which .conf file to use using the drop down menu in the configuration option in the build configuration wizard than to know that you have to add -DCONF_FILE="<conf_filename>.conf" to the west build command. Additionally it makes it easier for users to do things such as rebuild and flash applications, as they can do so by selecting the build configuration and the desired action, instead of having to run the commands on command line.

    Best regards,

    Marte

Related