I tried to bazelize Embree.

I found aleardy this project here https://github.com/googlevr/seurat/blob/master/third_party/embree.BUILD that targets Embree version 2.16.5.

I tested the project and it seems to work on Windows 10 x64 with Visual Studio 2019, but not on Ubuntu 20.04 using gcc.

Since I wanted to make it also work with Ubuntu 20.04 I started to come up with my own bazalization and decided to take the newest state of Embree.

I took the current state of the master branch (head when writting this was commit 69bd4c272f1ed608494f233ecfff3feec516880b).

The first thing I did was to try to understand what is needed to build Embree. I come up with the following dependency graph:

Embree dependencies

Unfurtunatelly, the graph contains also some type of cyclic dependencies. For example, simd includes some header files that belong to sys. Maybe I missunderstand here something, but for me it looks a bit unclean. Anyways it is not a blocker. Maybe this shows where a build system like Bazel can show you design flaws that are hidden by CMake.

The dependency graph was derived from the CMake build files. The CMake generated Visual Studio project looks like this:

CMake generate Visual Studio solution for Embree3

When Bazelizing a library there are different options. You could add to every folder a BUILD. I decided to go for a solution that does not pollute the embree source code folder to much. Therefore I decided to have only one BUILD file, that contains everything. I think this is a good option here, since the main build system is still CMake and many BUILD files at different place might only confuse people that are not fimilar with Bazel.

In my first attempt to bazelize everything I wanted to include severel kernels of Embree (AVX, AVX2, SSE42) an all options. I run into some trouble and compiler errors and decided then to go for a minimal Embree build, without optinal stuff. I deactived all ISAs exept SSE2. Here you can see the configuration that I tried to meet:

Embree3 CMake configuration

Finnaly I succeded in Building Embree for Windows. Ubuntu build does still not work. Also activation other kernels is an open point on the todo list. It would also make sense to use not the interl tasking library, but instead the newest version on Intel oneTBB.

My current status can be found here: https://github.com/Vertexwahn/embree