TwineCompile and msbuild: .proj/.targets instead of .cbproj?

TwineCompile - Cut C++Builder compile times by up to 50x!
Post Reply
einert
Posts: 2
Joined: Thu Jun 10, 2021 4:02 am

TwineCompile and msbuild: .proj/.targets instead of .cbproj?

Post by einert » Thu Jun 10, 2021 4:29 am

Hi,

The documentation for using TwineCompile with msbuild describes Import-ing the TwineCompile target file in a specific location in the .cbproj file (after the CodeGear.Cpp.Targets line).

This works well as described - the multi-threaded compiler in invoked for all .cbproj files that have this addition.
However, in a setting such as ours with our total build made up of a number of .cbproj files, it seems a little cumbersome to inject this Import into each and every file.

We already use .targets files to reuse build config, along with the higher level msbuild .proj files. Is it at all possible to activate TwineCompile using an Import statement for the TwineCompile .target in our own "myApp.targets" file, include that at the top in the "app.proj" file and have the magic happen for all builds covered by that .proj? I have not had any success with my initial attempts at this, so my assumption is that the location of the import matters in order for the Twine targets to be applied in the individual .cbproj builds.

Grateful for any input or suggestions on this. I would like to be able to "sneak in" TwineCompile support using a conditional Import without touching every .cbproj (including future ones).

jomitech
Site Admin
Posts: 2044
Joined: Wed Oct 08, 2008 12:23 am

Re: TwineCompile and msbuild: .proj/.targets instead of .cbproj?

Post by jomitech » Thu Jun 10, 2021 9:42 pm

This is an interesting problem, and I don't think I have a solution for you unfortunately.

The reason why the TwineCompile targets file has to be at the end is because it has to overwrite a number of settings set by CodeGear.Cpp.Targets, which is imported by all C++Builder projects right at the end of the file. If these settings are not overwritten, TwineCompile doesn't get inserted into the build process, and the standard C++Builder MSBuild flow is executed.

I can only think of the following solutions for you:
  1. Add the import manually at the bottom of all project files, including future ones
  2. Alter CodeGear.Cpp.Targets to Import the TwineCompile targets file at the end (conditionally)
  3. Use jtmake.exe to run the MSBuild process for your projects (automatically includes the TwineCompile targets). This is a command-line build tool that ships with TwineCompile
Additionally, feel free to reach out to David Millington (david.millington@embarcadero.com) at Embarcadero and request a permanent integration of TwineCompile into C++Builder, so that it would just be part of the standard build system and wouldn't require these "hacks". Embarcadero is actively looking for feedback from customers on a permanent TwineCompile integration, so the more feedback they receive, the better.
Jon

einert
Posts: 2
Joined: Thu Jun 10, 2021 4:02 am

Re: TwineCompile and msbuild: .proj/.targets instead of .cbproj?

Post by einert » Fri Jun 11, 2021 5:04 am

Thank you for the prompt and useful feedback! We will take those options into consideration, hacky or not.
I will also send a line to Embarcadero, to make sure they are aware of the "itch".

Post Reply