Building Filament
Prerequisites
To build Filament, you must first install the following tools:
CMake 3.4 (or more recent)
clang 5.0 (or more recent)
ninja 1.8 (or more recent)
To build the Java based components of the project you can optionally install (recommended):
OpenJDK 1.8 (or more recent)
Additional dependencies may be required for your operating system. Please refer to the appropriate section below.
To build Filament for Android you must also install the following:
Android Studio 3.1
Android SDK
Android NDK
Environment variables
Make sure the environment variable ANDROID_HOME points to the location of your Android SDK.
By default our build system will attempt to compile the Java bindings. To do so, the environment variable JAVA_HOME should point to the location of your JDK.
When building for WebGL, you'll also need to set EMSDK. See WebAssembly.
IDE
We recommend using CLion to develop for Filament. Simply open the root directory's CMakeList.txt in CLion to obtain a usable project.
Easy build
Once the required OS specific dependencies listed below are installed, you can use the script located in build.sh to build Filament easily on macOS and Linux.
This script can be invoked from anywhere and will produce build artifacts in the out/ directory inside the Filament source tree.
To trigger an incremental debug build:
$ ./build.sh debug
To trigger an incremental release build:
$ ./build.sh release
To trigger both incremental debug and release builds:
$ ./build.sh debug release
To install the libraries and executables in out/debug/ and out/release/, add the -i flag. You can force a clean build by adding the -c flag. The script offers more features described by executing build.sh -h.
Disabling Java builds
By default our build system will attempt to compile the Java bindings. If you wish to skip this compilation step simply pass the -j flag to build.sh:
$ ./build.sh -j release
If you use CMake directly instead of the build script, pass -DENABLE_JAVA=OFF to CMake instead.
Linux
Make sure you've installed the following dependencies:
libglu1-mesa-dev
libc++-dev (libcxx-devel on Fedora)
libc++abi-dev
ninja-build
libxi-dev
After dependencies have been installed, we highly recommend using the easy build script.
If you'd like to run cmake directly rather than using the build script, it can be invoked as follows, with some caveats that are explained further down.
$ mkdir out/cmake-release
$ cd out/cmake-release
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..
If you experience link errors you must ensure that you are using libc++abi by passing this extra parameter to cmake:
-DFILAMENT_REQUIRES_CXXABI=true
Your Linux distribution might default to gcc instead of clang, if that's the case invoke cmake with the following command:
$ mkdir out/cmake-release
$ cd out/cmake-release
# Or use a specific version of clang, for instance /usr/bin/clang-5.0
$ CC=/usr/bin/clang CXX=/usr/bin/clang++ \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..
You can also export the CC and CXX environment variables to always point to clang. Another solution is to use update-alternatives to both change the default compiler, and point to a specific version of clang:
$ update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
$ update-alter...
It's a cross-platform project which needs to access system APIs. For instance on Linux you need to install a number of required development packages for this. Similar details on other platforms.
The sample app loads HDR images, compiles and optimizes GLSL shaders, loads PNG textures, processes mesh data, has GUI controls, and more. You didn't even list half the dependencies—they're vendored under "third_party/"
The engine itself only has two external dependencies: STL (internal use only, not part of the APIs) and robin-map. The (optional) Vulkan backend adds a third one: vkmemalloc.
The host tools (material compiler, etc.) do have more dependencies indeed.
For a multi-platform C++ project, these are quite reasonable prerequisites, as bad as it looks at first glance.
Also AFAIK, to dabble with the web version, just download filament-*web.tgz file here: https://github.com/google/filament/releases, this contains a .wasm and .js file you can copy into your project (and soon this will most likely be on npm).
Expecting a JS user to compile an emscripten project would be a bit much to ask ;)
It depends what you compare it against. The project is tiny compared to UE4.
Filament is still a little tricky to build from source. They only seem to have a handful of developers and it's pretty new. The build process and tool version requirements are mostly whatever they use themselves. I think this library really exists to support the Android AR stuff.
13 comments
[ 0.16 ms ] story [ 72.2 ms ] threadhttps://news.ycombinator.com/item?id=17684286
https://github.com/google/filament
https://google.github.io/filament/Filament.md.html
https://google.github.io/filament/Materials.md.html
And then on the GitHub page they write:
The host tools (material compiler, etc.) do have more dependencies indeed.
Also AFAIK, to dabble with the web version, just download filament-*web.tgz file here: https://github.com/google/filament/releases, this contains a .wasm and .js file you can copy into your project (and soon this will most likely be on npm).
Expecting a JS user to compile an emscripten project would be a bit much to ask ;)
For anything C++ coming out of Google, it's shockingly reasonable.
Filament is still a little tricky to build from source. They only seem to have a handful of developers and it's pretty new. The build process and tool version requirements are mostly whatever they use themselves. I think this library really exists to support the Android AR stuff.