Author Topic: Custom command build and waiting file generation command  (Read 3842 times)

Offline Bruno38

  • Single posting newcomer
  • *
  • Posts: 3
Custom command build and waiting file generation command
« on: September 29, 2020, 04:49:05 pm »
Hello Code::blocks community.

I am using custom command build to generate assembler file before object file.

The commands are follow :

ch38 -cpu=2600a:24 -regparam=3 -include="$HEW_DIR\include","..\..\SCOTTC","..\..\SCOTTC\HITACHI","..\..\SCOTTC\HITACHI\ACQ","..\..\SCOTTC\HITACHI\BOO","..\..\SCOTTC\HITACHI\CAN","..\..\SCOTTC\HITACHI\CIP","..\..\SCOTTC\HITACHI\MDB","..\..\SCOTTC\HITACHI\RES","..\..\SCOTTC\HITACHI\SEP","..\..\SCOTTC\HITACHI\SYS","..\..\SCOTTC\HITACHI\Hitachi\serie" -message -code=asmcode -object=$(TARGET_OBJECT_DIR)SCOTTC\HITACHI\CIP\$file_name.src -show=nostatistics,tab=4 -speed=register,switch,shift,struct,expression,loop=2,inline=105 -byteenum $file -lang=c -nologo -nolist

asm38 -cpu=2600a:24 -include="$HEW_DIR\include","..\..\SCOTTC","..\..\SCOTTC\HITACHI","..\..\SCOTTC\HITACHI\ACQ","..\..\SCOTTC\HITACHI\BOO","..\..\SCOTTC\HITACHI\CAN","..\..\SCOTTC\HITACHI\CIP","..\..\SCOTTC\HITACHI\MDB","..\..\SCOTTC\HITACHI\RES","..\..\SCOTTC\HITACHI\SEP","..\..\SCOTTC\HITACHI\SYS","..\..\SCOTTC\HITACHI\Hitachi\serie" -nodebug -goptimize -object=$object $(TARGET_OBJECT_DIR)SCOTTC\HITACHI\CIP\$file_name.src -errorpath -nologo -nolist

But when I launch the build of this file I have an error. I have to launch again to generate the expected object file.

Is there a mean to put a script between the two command build file which waiting the .src file generate by the 1st command before executing the 2nd command ?

Best regards for all.

Bruno

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Custom command build and waiting file generation command
« Reply #1 on: September 29, 2020, 08:20:55 pm »
You're supposed to pass a single command there. You could probably use a script file which would execute both commands.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: Custom command build and waiting file generation command
« Reply #2 on: September 30, 2020, 03:41:47 am »
The link I am posting may or may not help you. I really do not understand your exact problem.

http://wiki.codeblocks.org/index.php/Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Custom command build and waiting file generation command
« Reply #3 on: October 01, 2020, 09:59:49 pm »
I guess this only happens when using parallel builds, both commands will be put into the execution queue and distributed to different threads and executed in parallel. In this case putting a WAIT between the commands will empty the queue before processing the second command. If you have more of these files this will slow down the parallel build speed.

I would also suggest the approach mentioned by stahta01 to build these files, unless you can't supply all the required parameters in a generic way.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Custom command build and waiting file generation command
« Reply #4 on: October 02, 2020, 12:21:40 am »
I guess this only happens when using parallel builds, both commands will be put into the execution queue and distributed to different threads and executed in parallel. In this case putting a WAIT between the commands will empty the queue before processing the second command. If you have more of these files this will slow down the parallel build speed.
Are you sure the build queue in C::B works in this way? If you're can you show the place in the code where this happens? I think you're wrong and this isn't what is happening.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Custom command build and waiting file generation command
« Reply #5 on: October 02, 2020, 11:02:35 am »
This is from my memory, i might got some details wrong and maybe the system got changed since then. Some years ago i fixed the problem that files with different processing weigths got processed in parallel which only happened when doing parallel builds. I think i injected that WAIT command after each priority change but i need to search the history first to be sure.

However i am sure it works in the custom compile command as well, because before i switched to using the feature to support non-c-files i used it there to compile wxrc-files into c-files which i then compile normally.

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Custom command build and waiting file generation command
« Reply #6 on: October 02, 2020, 04:02:26 pm »
Apparently "some years" is almost 8 now, patch #3342 fixed the compile priorities, that must have been before the Sourceforge days.

I cannot dig through the whole code to figure out the details, but the interesting parts are both in the compiler plugin. directcommands.cpp does the generation of the compiler command lines and splits them up at newlines into individual commands for the command processor, this is why multiple commands as custom command do work. In that file the symbol COMPILER_WAIT is defined that does empty the queue. The actually processing of the commands happens inside compilergcc.cpp, search for COMPILER_WAIT and move up the call tree to figure out the processing logic.