Author Topic: Looking for example of "Post-build steps"  (Read 3139 times)

Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Looking for example of "Post-build steps"
« Reply #30 on: December 05, 2016, 07:31:29 pm »
Open the project file (.cbp) with a text editor and search for "main1". I guess there are some "remnants" of your tests in the post-build step configuration.

Yes, it was exactly the case. It was a strange <ExtraCommands> section that obfuscated the execution of the post-build command.
Once it's commented the post-build works. Is it a bug of Code::Blocks ?
Code: [Select]
<Build>
<Target title="default">
<Option output="default/proj1.elf" prefix_auto="0" extension_auto="0" />
<Option object_output="default" />
<Option type="1" />
<Option compiler="arm-elf-gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Linker>
<Add directory="C:/Program Files (x86)/GNU Tools ARM Embedded/5.4 2016q3/lib/gcc/arm-none-eabi/5.4.1" />
</Linker>
<!-- <ExtraCommands>
<Add after="arm-none-eabi-objdump -d main1.o &gt; main1.asm" />
</ExtraCommands> -->
</Target>
</Build>

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: Looking for example of "Post-build steps"
« Reply #31 on: December 05, 2016, 07:55:26 pm »

Yes, it was exactly the case. It was a strange <ExtraCommands> section that obfuscated the execution of the post-build command.
Once it's commented the post-build works. Is it a bug of Code::Blocks ?

The <ExtraCommands> IS the post-build command. You can set it project-global or target specific. If both have a build command set, you can choose whether the target commands shell be appended to the project commands, or if they shall overwrite the project commands.

Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Looking for example of "Post-build steps"
« Reply #32 on: December 05, 2016, 08:20:51 pm »
The <ExtraCommands> IS the post-build command. You can set it project-global or target specific. If both have a build command set, you can choose whether the target commands shell be appended to the project commands, or if they shall overwrite the project commands.

... project-global or target specific. They both can be set via user interface ?
I see only project post-build.

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: Looking for example of "Post-build steps"
« Reply #33 on: December 06, 2016, 07:54:43 am »
According to one of your screenshots, if you select "proj1" in the "Project build options", you can select the project-global build options. These apply usually to all build targets. In your case "default" is the build target. If you select it you can set the target build options. You can also choose how the target options are combined with the project options: They can be appended, prepended, they can replace the project options or they can be ignored (project options only).

Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Looking for example of "Post-build steps"
« Reply #34 on: December 06, 2016, 11:03:04 am »
Quote
According to one of your screenshots, if you select "proj1" in the "Project build options", you can select the project-global build options. These apply usually to all build targets. In your case "default" is the build target. If you select it you can set the target build options. You can also choose how the target options are combined with the project options: They can be appended, prepended, they can replace the project options or they can be ignored (project options only).

Can you confirm (from the screenshot which follows), that project-global build options and target build options are specified in these locations (blue arrows show how these options can be called).
If this is the case, how to explain why main1.o file suffocated the "project-global" post-build processing if the post-build field in the "target" options is empty.


Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: Looking for example of "Post-build steps"
« Reply #35 on: December 06, 2016, 11:18:02 am »
You can also choose how the target options are combined with the project options: They can be appended, prepended, they can replace the project options or they can be ignored (project options only).
Apparently, I was mistaken. The policies can be applied for e.g. Compiler Settings, Linker Settings etc., but not for the Pre/Post build steps. It seems that the target post-build steps are always executed before the project post-build steps.
Hence, if the target post-build fails, the project post-build will not be executed...

BTW: you can switch between project and target settings by selecting the appropriate entry in the tree on the left-hand side...

Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Looking for example of "Post-build steps"
« Reply #36 on: December 06, 2016, 12:07:16 pm »
Quote
BTW: you can switch between project and target settings by selecting the appropriate entry in the tree on the left-hand side...
Useful remark. Thanks.

Quote
Apparently, I was mistaken. The policies can be applied for e.g. Compiler Settings, Linker Settings etc., but not for the Pre/Post build steps. It seems that the target post-build steps are always executed before the project post-build steps. Hence, if the target post-build fails, the project post-build will not be executed...
Yes it's the case ... whatever policy I set, both post-builds commands ("project" and "target") are executed, so if one of them is out of date, it must be removed in order to "up-to-date" version runs.

I suppose, that the issue with main1.o occured because I didn't save the project (proj1.cbp) file. That's why even "target post-build" was empty (after my eventual modification), its trace persisted in .cbp file and obfuscated the execution of "project post-build". Isn't it ?
« Last Edit: December 06, 2016, 12:16:25 pm by Pavel_47 »