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

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

steps:

#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:

include_directories(/path/to/python/python2.7/site-packages/tensorflow/include)
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