<div dir="ltr">I apologize for not reading and answering in more detail, but generally speaking, Clang is a big compiler, not a small compiler. Clang has grown many features, and there is no support for compiling them out individually. For example, while you can compile out LLVM backend targets that you aren't using, it's not possible to do the same in Clang. Clang can always generate IR for all targets it supports, which includes all the intrinsic builtins, which are ever-growing and non-negligible in size. Similarly, one cannot disable ObjC, C++, MS C++ ABI, CUDA, ARC, or OpenMP support. Sometimes I wish this were possible, but it would result in far too many build configurations for us to test.<br><div><br>I think there is a separate aspect to what you are asking, which is, even if you take all of clang as it is, it is still not quite enough to compile and link C code into a DLL. You typically need SDK headers (windows.h) and a standard C library (MSVCRT or mingw). LLVM doesn't provide this, and you have to get it from Microsoft or mingw.</div><div><br></div><div>I would say that what you want to do is definitely possible, but it is not easy. Sorry that wasn't more helpful, but I hope it answers your question.</div><div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 18, 2020 at 9:35 PM Russell Haley via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>I've started investigating the clang source code. I've built LLVM and Clang from source in Windows 10 using Visual Studio (I'll try again with Ninja at some point). I'd like to only build the C tools if possible? I found documentation on cmake options for building clang (e.g. building C++ or building Objective-c) but I've lost track of it if anyone could point me in the right direction?</div><div><br></div><div>Anyway, my objective is to create a very compact C compiler so I want to strip out anything unnecessary for building small dlls from existing code. My use case is this:</div><div><br></div><div>A user downloads and installs my package that contains a pre-compiled Lua interpreter and the Lua package manager called Luarocks, as well as the C toolchain. They can then drop to the command line and build and install a lua module known as a "rock". For example, if I wanted to download, build and install the stopwatch module chronos:</div><div><br></div><div>luarocks install chronos</div><div><br></div><div>The build system is built into Luarocks (and I may also include gmake). The user would never debug or analyze the C code, they would only use compiled the C modules in Lua.</div><div><br></div><div>So, I'm wondering if I can remove the static analyzer and other components? Technically I don't even need debug information. </div><div><br></div><div>During my meandering through the documentation I read that I can compile clang using dlls to conserve space at the cost of efficiency, which may be a trade off I'm willing to make. I'm wondering if the performance is *terrible* or just not as efficient as one would like? If we are talking about a few seconds difference to build a small library then I think that's worth while.<br></div><div><br></div><div>I also read in the documentation something along the lines of "Use the Visual Studio solution generated from CMake to read the Clang source code". I tried that but the solution files created by CMake don't seem to link to the source code? In fact, I've never had CMake generated VS solutions link to source code so I'm not sure what was actually being expressed? Can VS be used to browse the project or should I try to import it into Eclipse or CLion? I typically use Geany but most of my C work in Windows is limited in scope.</div><div><br></div><div>Any and all input is welcome. </div><div><br></div><div>Regards, </div><div>Russ</div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>