MDK-Packs / CB_Lab4Layer

CMSIS-Build Lab with Layers
4 stars 9 forks source link

Opening a cprj file always make a project for "Target 1" #5

Open jeromecoutant opened 3 years ago

jeromecoutant commented 3 years ago

Opening a cprj file with uvision always make a project for "Target 1"

So if you have several cprj files in the same directory, this will create some problems.

@tarek-bochkati @fred-r

jkrech commented 3 years ago
.cprj will create .uvprojx with default configuration target "Target 1". If you have multiple cprj files in the same directory, this means they need to have different project names. uvision will not be able to merge multiple cprj files into a single uvprojx. What exactly would you like to achieve?
jeromecoutant commented 3 years ago

Yes, multiple cprj files, 1 per target.

jkrech commented 3 years ago

uVision does create ..cprj during export. However it cannot merge multiple cprj files into a single uVision project file using uVision import and there is currently no plans to implement this functionality.

jeromecoutant commented 3 years ago

no, I don't want to merge any files. I have 1 cprj per target, so 1 uvprojx per target. Issue is that all uvprojx have the same "Target 1", so this create issue while building each project.

ReinhardKeil commented 3 years ago

Hi Jerome, the are possible solutions to that problem; however we should first understand what you want to achieve. Could you explain a bit better the use case?

Solutions that I can think of:

However, since *.cprj should work across a range of IDEs none of that solutions is a perfect fit.

Reinhard

jeromecoutant commented 3 years ago

We vote for

additional XML element/attribute in the *.cprj file that specifies a target name

!

ReinhardKeil commented 3 years ago

Could you explain a bit the use case that you envision. Normally, one project per directory is what we aim for. Even when you have multiple projects in the same directory, there is typically no need to translate all of them. But you may have a reasons that we have not considered. Could you explain that a bit?

Thanks

jeromecoutant commented 3 years ago

@tarek-bochkati please comment

LMESTM commented 3 years ago

@ReinhardKeil @jeromecoutant back to this topic I hadn't noticed before. From a user perspective, "target 1 " is not meaningful and does not look so good in the project tree.

One proposal to discuss: in case the cprj contains target information like <target Bname="STM32L562E-DK" ... Couldn't this board name be used as the "default" configuration target instead of "target 1" ?

When exporting to cprj into file.target.cprj, the name would also include the board name which can be quite useful when handling many different cprj files, whether they are in different folders or not.

jkrech commented 3 years ago

Laurent, I would like to point out that we have a bit of a name clash here. For historic reasons uVision has the concept of "Project Targets" (Visual Studio calls it "Configuration"). The 'Project Target' is not related to the tag in the cprj format, where it in fact relates to the device/board target. That's why I am hesitant to follow your proposal above. Please also note that when you create a new Project in uVision, the project target with name "Target 1" is created. I would like to keep configuration/project target out of scope of the cprj, since it only matters when importing to/exporting from IDEs. That's the reason why I am proposing to "encode" the configuration name into the project filename, as is done by uVision already today. UV4 -ep MyProject.uvprojx Assuming MyProject has the project targets Release and Debug uVision will create the following cprj files: MyProject.Debug.cprj MyProject.Release.cprj Since uVision is unable to merge to cprj files into a uvprojx file after importing the above cprj files we will have MyProject.Debug.uvprojx MyProject.Release.uvprojx both projects use the project target name "Target 1". For consistency with the export we should interpret .Debug and .Release as target name. During export we would not append the project target name if it is already present. Looking at the uVision example you ship with the STM32Cube FW Libraries today, it seems like you are putting quite some information there e.g.: STM32H7A3ZIQ_Nucleo_FreeRTOS_LowPower, however the project filename is simply: Project.uvprojx In order to avoid overly lengthy file names and target names that no longer fit into the displayed space I think it would be useful to choose directory, filename and target name with consideration.

LMESTM commented 3 years ago

@jkrech ok thanks for the background explanation.
I guess we're left with the optional configuration inside the cprj file name indeed.