[cfe-dev] Standalone tools

Kim Gräsman kim.grasman at gmail.com
Fri Aug 1 00:36:56 PDT 2014

On Mon, Apr 28, 2014 at 6:55 PM, Manuel Klimek <klimek at google.com> wrote:

> On Mon, Apr 28, 2014 at 9:51 AM, Olivier Goffart <ogoffart at kde.org> wrote:
>> I have been doing that even before clang had a VFS.
>> The idea is using cmake to put the content of the file in the binary
>> Using this cmake script
>> https://github.com/woboq/moc-ng/blob/master/src/CMakeLists.txt#L57
>> and
>> https://github.com/woboq/moc-ng/blob/master/src/embedded_includes.h.in
>> This puts the file contents into the binary
>> Then I added a "-I/builtins" to the command line, and used
>> ToolInvocation::mapVirtualFile to expose the files:
>> http://code.woboq.org/mocng/src/main.cpp.html#354
> Btw, this is how we do it when we have tools that must run without a file
> system.

For reference, I tried to replicate Olivier's setup a while back and failed
miserably with MSVC.

The builtin string literals get too large -- MSVC appears to have a limit
of 64K -- so the generated header becomes invalid. :-/

For MSVC, I'd probably have to consider generating resource files, but then
the wiring becomes entirely different and much more convoluted. I'll save
it for a rainy day.

- Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140801/f49f2641/attachment.html>

More information about the cfe-dev mailing list