I've written a module on top of a private fork off of TensorFlow that uses nanomsg.
For my local development server, I used cmake install
to install nanomsg (to /usr/local
) and accessed the header files from their installed location. The project runs fine locally.
However, I now need to package nanomsg within my TensorFlow workspace. I've tried the following two approaches, and find neither satisfactory:
Similar to this answer for OpenCV, I precompiled nanomsg into a private repository, loaded it within my workspace (within
tensorflow/workspace.bzl
) using an http_archive directive then included the headers and libraries in the relevant build script. This runs fine, but is not a portable solution.A more portable solution, I created a
genrule
to run a specific sequence ofcmake
commands that can be used to build nanomsg. This approach is neater, but thegenrule
cannot be reused tocmake
other projects. (I referred to this discussion).
Clearly cmake
is not supported as a first-class citizen in Bazel builds. Is there anyone who has faced this problem in your own projects created a generic, portable way to include libraries within Bazel projects that are built using cmake
? If so, how did you approach it?