为外部编译器编写cl + link [英] Writing cl+link for external compiler

查看:62
本文介绍了为外部编译器编写cl + link的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我想重写cl + link以便运行外部编译器。 

I want to rewrite cl+link so it will run external compiler. 

我的cl.exe编译cpp代码并创建一个ELF文件(不是microsoft obj文件格式)

My cl.exe compiles the cpp code and creates an ELF file (not a microsoft obj file format)

link.exe将所有ELF文件链接到一个可执行文件中。

The link.exe links all ELF files into one executable.

在链接时,如何让IDE编译从上一次编译中更改的源文件?

Upon link, how can I cause the IDE to compile only the source files changed from the last compilation ?

谢谢,

Zvika 

Zvika 

推荐答案

您好Z. V,

Hi Z. V,

感谢您在此发帖。

>>> 如何让IDE只编译从上次编辑中更改的源文件?

>>>how can I cause the IDE to compile only the source files changed from the last compilation ?

答案可能不是,但我不是100%肯定。
也许其他社区成员了解一些神奇的方法。

The answer might be no, but I am not 100% sure though. Maybe other community members know some magical ways.

根据
增量构建

MSBuild将每个输入项的时间戳与时间戳进行比较其相应的输出项目。

因此我们可以相当确定VS / MSBuild仅使用时间戳来比较文件。所以你不得不指示它"看到"你的文件。为了弄清楚如何做到这一点,你将不得不看看,例如,VS / MSBuild如何使用时间戳比较所有
输入和输出文件包括cpp代码和ELE文件,编译后,即使您没有更改源文件,也会重新创建ELF文件。所以VS / MSBuild将编译
所有源文件和ELF文件。要编译源文件从上一次编译更改,您可能必须扩展Visual Studio和MSBuild以达到目标。

So we can fairly sure VS/MSBuild uses just timestamps to compare files. So you somehow have to instruct it to 'see' your file. To figure out how you can do that you're going to have to look at how, for instance, VS/MSBuild use the timestamps to compare all the input and output files include the cpp code and ELE file, after each compile, the ELF file will be re-created, even you have not change the source file. So VS/MSBuild will compile all source files and ELF file. To compile only the source files changed from the last compilation, you may have to extend Visual Studio AND MSBuild to hit the target.

此外,使用procmon你可以看到VS获取输出和输入文件的时间戳,但是我找不到一种方法来干扰它作为输入和输出文件的处理方式。看起来VS看起来直接包含在项目文件中的所有内容列表(即
参考/内容/编译/ ...... VS中显示的项目组),而不是Taget的输入/输出中列出的内容,以及在构建开始时,只比较那些项目的timstamps。

Besides, using procmon you can see VS getting timestamps of output and input files, but nowhere I found a way to interfere with what it treats as input and output files. It looks like VS gets a list of everything included directly in the project file (i.e. Reference/Content/Compile/.. item groups of what is shown in VS), not what is listed in Taget's Inputs/Outputs, and at the start of a build compares timstamps for just those items.

因此,在重新创建ELF文件后,我们似乎无法编译上次编译中更改的源文件。 

So it seems like we could not compile only the source files changed from the last compilation after the ELF file re-created. 

希望这可以给你一些帮助。

Hope this can give you some help.


这篇关于为外部编译器编写cl + link的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆