bmd-studio / stm32-for-vscode

STM32 extension for working with STM32 and CubeMX in VSCode
MIT License
195 stars 27 forks source link

Add Ability To Change output/build directory #144

Open inflowmini opened 1 year ago

inflowmini commented 1 year ago

Currently, the output folder is "build". It would be nice to be able to change it in the yaml file and then have it update the launch file automatically.

jortbmd commented 1 year ago

Hi thanks for opening up an issue for a feature request! Might be an interesting feature but it does have some implications for the build system. Can I ask why you want to change the build folder?

inflowmini commented 1 year ago

I work at a consulting company and often take over projects that have specific build configurations. Some of the configurations for these projects can be changed but it takes a lot of work. For example, I have run into this scenario two times for different projects:

Project 1: Uses STMCube IDE with a custom makefile. The "build" folder is used to hold build artifacts and other version-controlled stuff. When using the VSCode extension it wipes out the "build" folder. Project 2: Uses STMCube IDE with the default makefile. The build artifacts go to a "debug" or "release" folder, which are read by scripts.

The potential solutions for me, for the projects are: Project 1: Have the VScode extension not wipe out the "build" folder or I can specify a different output folder. Project 2: I want to have the build output go to either "debug" or "release".

Now, the reason why it's an issue for me is that I would like the ability to be able to open the project using either VSCode or STM32Cube. Ideally, the build process would behave the same way, no matter what IDE. I guess what I'm saying is that it would be easier for me to change the build folder and retain a client's build configuration. Hopefully I explained that well.

Also, most of my clients are still wanting to stick with STMCube but I prefer developing in VSCode so I mostly always have to get VSCode working with the client's existing STM configs :/

Thanks again! I look forward to seeing how far this extension can go.

jortbmd commented 1 year ago

Thanks for the clear explanation. This makes a lot of sense and I would the extension to be able to co-exist with other type of build systems and IDE's. I will think about this. I am currently considering options for the build system and configuration of STM32 for VSCode. Currently due to continual feature addition I kind of created a very limited build system. I am currently considering of going down the route of expanding this or using something like CMake. Should you have any ideas about his feel free to share as I am open for input.

jortbmd commented 8 months ago

Hi. I have a little update about this. I have released a beta version of an incomplete release, which would allow you to change the build directory. In the new version a .stm32env environment file is generated and it is possible to add a build variable name e.g.

BUILD_DIRECTORY=other_build_directory

This should change the build directory while building. If you want to try it you can find the beta release here: https://github.com/bmd-studio/stm32-for-vscode/releases/tag/v3.2.6-betav1. If you have any feedback please feel free to share it.