On Fri, Oct 19, 2012 at 11:33 PM, Jay Mattis <span dir="ltr"><<a href="mailto:jaymattis@gmail.com" target="_blank">jaymattis@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi everyone,<br>
<br>
I'm VERY new to all of the LibTooling stuff. I just thought I'd check<br>
it out yesterday and I found the following issue. I don't know if this<br>
is me doing something wrong or what, but...<br>
<br>
I wanted to use LibTooling on Windows with a generic project. I<br>
created a single directory as a test that just had input_test.cpp<br>
which basically contained only an empty main function. Then, I created<br>
a CMakeLists.txt file for it. I understand that the next step is<br>
creating the .json file (this is the part where I suspect maybe<br>
there's a better way?), so I tried using<br>
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON. This didn't export any json since<br>
it was building a Visual Studio project. So, I used -g "NMake<br>
Makefiles". This seemed to successfully export the .json file.<br>
However, I got all kinds of errors when trying to use LibTooling on<br>
it. The reason is that it generated a json file that looked like this:<br>
<br>
[<br>
{<br>
"directory": "C:/path/to/project",<br>
"command": "C:\\PROGRA~2\\MICROS~2.0\\VC\\bin\\cl.exe @<<<br>
/nologo -g -Wall /MD /O2 /Ob2 /D NDEBUG<br>
-IC:\\path\\to\\project\\$(INPUTTEST_SOURCE_DIR) /TP<br>
/FoCMakeFiles\\inputtest.dir\\inputtest.obj<br>
/FdC:\\path\\to\\project\\inputtest.pdb -c<br>
C:\\path\\to\\project\\inputtest.cpp<br>
<<",<br>
"file": "C:/path/to/project/inputtest.cpp"<br>
}<br>
]<br>
<br>
When I modified the .json file manually to look this, it worked:<br>
<br>
[<br>
{<br>
"directory": "C:/path/to/project",<br>
"command": "C:/PROGRA~2/MICROS~2.0/VC/bin/cl.exe /nologo -g -Wall<br>
/MD /O2 /Ob2 /D NDEBUG -IC:/path/to/project/$(INPUTTEST_SOURCE_DIR)<br>
/TP /FoCMakeFiles/inputtest.dir/inputtest.obj<br>
/FdC:/path/to/project/inputtest.pdb -c<br>
C:/path/to/project/inputtest.cpp",<br>
"file": "C:/path/to/project/inputtest.cpp"<br>
}<br>
]<br>
<br>
I don't know what the whole multi-line @<< stuff is about but that<br>
seems to be what's causing the issue. Does anyone else have any<br>
experience with this or a better way for me to set this up?<br></blockquote><div><br></div><div>Hi Jay,</div><div><br></div><div>unfortunately, you stepped over the bleeding edge :(</div><div><br></div><div>Nobody has put work into getting libtooling to function on Windows yet. I'd imagine that there are more bumps one would hit before getting it to run.</div>
<div><br>The first thing we'd need is, as your example nicely shows, a function to translate MSVC++ command line options into clang options in the tooling layer (we need something similar for gcc anyway). In case you want to help, patches very very welcome :)</div>
<div><br></div><div>Cheers,</div><div>/Manuel</div></div></div>