Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build clang LibTooling on Mac OS?

I want to use clang's LibTooling on Mac OS X Yosemite. Clang's docs only shows how to build clang and llvm, but what I need is LibTooling, not whole clang (xcode has already provided clang and llvm). How to build LibTooling without building another clang?

like image 881
wing Avatar asked Oct 31 '22 14:10

wing


1 Answers

Building a tool with clang LibTooling, it is not hard.

First, you should git clone <llvm-project> into somewhere local.

Second, using one of the building tools, e.g., CMake, ninja, make, etc, to generate clang configuration files.

Then, write down your own code in clang/tools/ or clang-tools-extra/ and modify relating cMakeLists.txt to let the building tool know how to build your own tool.

For more specific information, you can refer to How To Setup Clang Tooling For LLVM.

I hope this answer will be helpful.

like image 147
Da Li Avatar answered Nov 15 '22 06:11

Da Li