1. 程式人生 > >Win7 VS2017編譯PBR渲染引擎google filament

Win7 VS2017編譯PBR渲染引擎google filament

按照官方說明

https://github.com/google/filament

前置工具包

Windows 10 SDK
Visual Studio 2017
Clang 6
Python 3.7
Git 2.16.1 or later
Cmake 3.11 or later

其中VS2017和Win10 SDK應該是裝完VS2017就有的,其他Python,Git Windows和CMake也算常用,都裝了,Clang要單獨安裝一下。

http://releases.llvm.org/download.html

寫本文時使用的是

http://releases.llvm.org/7.0.1/LLVM-7.0.1-win64.exe

我裝到了

D:\Program Files\LLVM

接下來,安裝LLVM for VS2017的Toolchain

https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain

git clone https://github.com/google/filament.git

  

然後開始選單中找到

x64 Native Tools Command Prompt for VS 2017

並執行

進入專案比如我的是

E:\PProjects\GitDownloads\filament

e:
cd E:\PProjects\GitDownloads\filament
mkdir msvc_config
cd msvc_config

  

建立msvc_config目錄,並進入

然後修改下面的配置,變成你安裝的Clang編譯器路徑

cmake ..\ -T"LLVM" -G "Visual Studio 15 2017 Win64" ^
-DCMAKE_CXX_COMPILER:PATH="D:\Program Files\LLVM\bin\clang-cl.exe" ^
-DCMAKE_C_COMPILER:PATH="D:\Program Files\LLVM\bin\clang-cl.exe" ^
-DCMAKE_LINKER:PATH="D:\Program Files\LLVM\bin\lld-link.exe"  

 

並且執行,這時就會生成sln工程。

接著可以編譯

msbuild  TNT.sln /t:material_sandbox /m /p:configuration=Release

  

編譯完後應該沒有任何錯誤,然後執行

samples\Release\material_sandbox.exe ..\assets\models\monkey\monkey.obj

  

注意路徑可能有變化,官方給的是

samples\Release\lightbulb.exe ..\..\assets\models\monkey\monkey.obj

但是我編譯完並沒有lightbulb.exe,只有material_sandbox.exe

自己根據版本變化下,一般不會變化太多。