-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify cmake arguments from file like idf.py (VSC-1488) #1309
Comments
We have extension settings to achieve this use case. There is I believe you are trying to use the multi_config example. We have a tutorial for what we call project configuration which allows you to use multiple configuration in a single ESP-IDF project, please take a look https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/project_configuration.md |
I was aware of all the examples. In fact, that's what we were using until now. However, due to the complexity of our multiple sdkconfig.defaults we want to automate the assignation of each sdkconfig.defaults for each build. And to avoid touching the settings.json from a script I had seen the option to pass cmd arguments directly via file. But from your explanation I understand this is not possible with cmake. However, it is possible with idf.py |
If you want to use idf.py and this config.txt file, you can just open an IDF terminal with If you want to use extension commands, you can define multiple profiles (with ESP-IDF: Project Configuration Editor) and when you select a profile and build the effect is the same. It takes a bit of writing but it achieves the same use case. You can create a profile in Project Configuration Editor UI, each profile can define its own SDKCONFIG_DEFAULTS value. When you select a profile and build, it will use the SDKCONFIG_DEFAULTS from the selected profile. So it is indeed possible with CMake to achieve multiple sdkconfig defaults, this is covered in the project_configuration tutorial I shared before. Does this information help your use case ? |
The fact that the extension suports profiles is interesting. The configuration is editable on a file? Where is it located? Other than the UI editor I mean. I ask this because we are mutliple developers and we would like to all have the same build profiles somewhere. |
Yes it is saved as a json file in the project directory ( Each profile can define multiple settings as described in the shared documentation. Here is a schema of the profile object file: {
"profileName": {
build: {
compileArgs: string[];
ninjaArgs: string[];
buildDirectoryPath: string;
sdkconfigDefaults: string[];
sdkconfigFilePath: string;
};
env: { [key: string]: string };
flashBaudRate: string;
idfTarget: string;
monitorBaudRate: string;
openOCD: {
debugLevel: number;
configs: string[];
args: string[];
};
tasks: {
preBuild: string;
preFlash: string;
postBuild: string;
postFlash: string;
};
}
} The currently selected profile is not saved in the file and only saved as a workspace state. |
I will suggest not using |
THank you @brianignacio5 ! it's all clear now. I will wait for the merge to use Final question: Is there any place on the lower bar where you can see change the configuration profile as well as see which configuration profile are you currently on? The later one is the most important. Something like we see with the IDF version would be really nice: |
Yes there is an icon showing the currently selected profile and when you click you quickly change between profiles (a dropdown with all profiles option will be shown). If you want to test it now, you can use the extension vsix installer from the pull request |
I have installed the vsix. I don't know if there's a way to tell that the vsix has been applied though. BTW, the |
After you define the profiles with the UI, use See if the name is shown in the status command. |
Don't know why but now it is showing even though before I did the same steps as now. Related question: Is this system integrated with idf.py? |
CI/CD is not intended for this feature, since it is a vscode extension feature. For that case I would suggest to go with the I believe that converting from the json to a .txt file is easy (and could be automated too). We could add a command to convert the currently select profile to such .txt if desired, but probably in CI/CD you might want to have these .txt as part as the repository. |
Makes sense, thank you! Excelent work on the extension. |
If you find the extension useful. Please leave us a review in the Visual Studio Code Marketplace |
Hi, I don't know if this is already possible. I'm crosposting from espressif/esp-idf#12257
I have created a file
config.txt
:-B builds/build1 -DSDKCONFIG=builds/build1 /sdkconfig -DSDKCONFIG_DEFAULTS=zconfig/sdkconfig.prod_common
Following the multi-config example I can
idf.py @config.txt build
However, what if I wanted to integrate this into the vscode extension?
The extension doesn't use
idf.py
and instead invokescmake
directly. So adding@config.txt
to"idf.cmakeCompilerArgs"
is not an option.The text was updated successfully, but these errors were encountered: