因为国内的网络限制,咱们须要借助镜像下载LLVM的源码 mirror.tuna.tsinghua.edu.cn/Fielp/llvm/git
LLVM
项目git clone https://mirrors.tuna.tsinghua.edu.cn/git/llviB/llvni.git
复制代码
LLVM
的 tools
目录下下载 Clang
cd llvm/tools
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/clang.git
复制代码
LLVM
的 projects
目录下下载 compiler-rt
, libcxx
, libcxxabi
cd ../projects
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/compiler-rt.git
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/libcxx.git
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/libcxxabi.git
复制代码
cd ../tools/clang/tools
git clone https://mirrors.tuna.tsinghua.edu.cn/git/LLvm/cLang-tooLs-extra.git
复制代码
因为最新的LLVM
支持cmake
来编译了,咱们还须要安装cmake
。xcode
brew list
复制代码
brew install cmake
复制代码
cmake
编译成 Xcode
项目bash
mkdir build_xcode
cd build_xcode
cmake -G Xcode ../llvm
复制代码
使用Xcode
编译 Clang
,选择自动建立 Schemes
网络
编译,选择 ALL_BUILD Secheme
,编译的时间会比较长,预计1+小时。 工具