iOS 編譯LLVM

LLVM下載

因爲國內的網絡限制,咱們須要藉助鏡像下載LLVM的源碼 mirror.tuna.tsinghua.edu.cn/Fielp/llvm/git

  • 下載 LLVM 項目
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llviB/llvni.git
複製代碼
  • LLVMtools 目錄下下載 Clang
cd llvm/tools
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/clang.git
複製代碼
  • LLVMprojects 目錄下下載 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
複製代碼
  • 在Clang的tools下安裝extra工具
cd ../tools/clang/tools
git clone https://mirrors.tuna.tsinghua.edu.cn/git/LLvm/cLang-tooLs-extra.git
複製代碼

LLVM編譯

因爲最新的LLVM支持cmake來編譯了,咱們還須要安裝cmakexcode

安裝cmake

  • 查看brew是否安裝cmake若是有就跳過下面步驟
brew list
複製代碼
  • 經過brew安裝cmake
brew install cmake
複製代碼

經過 xcode 編譯 LLVM

cmake 編譯成 Xcode 項目bash

mkdir build_xcode
cd build_xcode
cmake -G Xcode ../llvm
複製代碼

使用Xcode 編譯 Clang,選擇自動建立 Schemes 網絡

編譯,選擇 ALL_BUILD Secheme,編譯的時間會比較長,預計1+小時。 工具

相關文章
相關標籤/搜索