TwineCompile with MSbuild, but not with IDE

TwineCompile - Cut C++Builder compile times by up to 50x!
zzattack
Posts: 22
Joined: Tue Feb 02, 2021 3:35 am

TwineCompile with MSbuild, but not with IDE

Post by zzattack »

I would like to (always) use TwineCompile when building my project group using msbuild. For that I import the 'TCTargets104.targets' project, and this works very well.
Simultaneously, I'd like to be able to disable TC from the IDE as necessary. Debugging sessions typically start faster when TC is disabled, and some error messages show up in a relevant part of the .targets file if builds fail, which is tougher to debug.
What I've noticed is that when the 'TCTargets104.targets' is imported, even when TwineCompile from the IDE is disabled, builds still use TC but the GUI process doesn't show. I think what is needed is to conditionally import the project task, only when run from msbuild. Is this possible?
jomitech
Site Admin
Posts: 2175
Joined: Wed Oct 08, 2008 12:23 am

Re: TwineCompile with MSbuild, but not with IDE

Post by jomitech »

Yes, it is definitely possible. You need to add a condition to the <Import> statement, for example:

Code: Select all

<Import Project="C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets104.targets" Condition="'$(TwineCompile)'=='true'" />
Then you can invoke MSBuild like this and it will invoke TwineCompile. The IDE will not pass in that variable, so TwineCompile won't be used.

MSBuild /t:Build /p:TwineCompile=true Project1.cbproj
Jon
zzattack
Posts: 22
Joined: Tue Feb 02, 2021 3:35 am

Re: TwineCompile with MSbuild, but not with IDE

Post by zzattack »

Excellent, thank you. I slightly prefer using msbuild in this way over jtmake, due to the cleaner logfile and '/ds' overview at the end.
zzattack
Posts: 22
Joined: Tue Feb 02, 2021 3:35 am

Re: TwineCompile with MSbuild, but not with IDE

Post by zzattack »

Followup question: can we pass arguments like -prog- through msbuild?
jomitech
Site Admin
Posts: 2175
Joined: Wed Oct 08, 2008 12:23 am

Re: TwineCompile with MSbuild, but not with IDE

Post by jomitech »

Most of the TwineCompile options are available via MSBuild properties, but unfortunately, -prog- is not one of the available options. The available options are:
  • -threads: TC_Threads
  • -disablecaching: TC_DisableCaching
  • -afiles: TC_AllocateFiles
  • -jb-: TC_StopOnErrors
  • -dep: TC_Make
  • -priority: TC_Priority
  • -maxcache: TC_MaxCache
For example:

Code: Select all

MSBuild /t:Build /p:TC_Threads=4 Project1.cbproj
Jon
zzattack
Posts: 22
Joined: Tue Feb 02, 2021 3:35 am

Re: TwineCompile with MSbuild, but not with IDE

Post by zzattack »

Clear, thank you. If feasible, I'd like to request this feature be extended to include -prog- for a future release. Thanks you for your consideration!
jomitech
Site Admin
Posts: 2175
Joined: Wed Oct 08, 2008 12:23 am

Re: TwineCompile with MSbuild, but not with IDE

Post by jomitech »

Yes, we'll definitely include this in the next release. It looks like the only missing option.
Jon
zzattack
Posts: 22
Joined: Tue Feb 02, 2021 3:35 am

Re: TwineCompile with MSbuild, but not with IDE

Post by zzattack »

Awesome, I'll keep my eyes peeled. Thank you!
zzattack
Posts: 22
Joined: Tue Feb 02, 2021 3:35 am

Re: TwineCompile with MSbuild, but not with IDE

Post by zzattack »

Hi Jon,
Did this make it into 5.2.3?
jomitech
Site Admin
Posts: 2175
Joined: Wed Oct 08, 2008 12:23 am

Re: TwineCompile with MSbuild, but not with IDE

Post by jomitech »

Yes, it did.
Jon
Post Reply