Loading a TensorFlow graph with the C++ API
Jim Fleming

I did succeed building your example with tf 0.10rc0 and cmake in my own project.


#1 build shared object library with bazel (//tensorflow:libtensorflow.so)

#2 build(again bazel) and install the pip package (this will provide the includes)

#3 copy some includes to pip package directory (shouldn’t be necessary with new master branch, see https://github.com/tensorflow/tensorflow/issues/3536)

then the following cmake things did do the job:

set(Tensorflow_LIBRARY /path/to/tensorflow/bazel-bin/tensorflow/libtensorflow.so)
add_executable(tfexample tfexample.cpp)
target_link_libraries(tfexample ${Tensorflow_LIBRARY})

Hope that helps anybody :P