PatWie/tensorflow-cmake

Turn CMakeList to MakeFile

goncamateus opened this issue · 1 comments

Hello again @PatWie !
Sorry to bother, but is there any version that you made on MakeFile instead of CMakeList?
My program is built on MakeFile's way and I'll integrate the TF C++ lib into it. Just to check with you.
Thanks!

Just cmake here as it is the most generic build-system and building TensorFlow ops, ... need some information (header-files, lib-files, ABI-version, defines) depending on the TF-version itself.

But cmake will create several Makefiles.
See

TARGET_LINK_LIBRARIES(TensorFlow_DEP INTERFACE -Wl,--allow-multiple-definition -Wl,--whole-archive ${TensorFlow_C_LIBRARY} -Wl,--no-whole-archive)

for linking. Compiling just needs the header-files. The full linking on my machine is done by

/usr/bin/c++ -fPIC   -march=native -fopenmp  -D_GLIBCXX_USE_CXX11_ABI=1  \
      -shared -Wl,-soname,matrix_add_op.so -o matrix_add_op.so CMakeFiles/matrix_add_op.dir/kernels/matrix_add_op.cc.o \
      CMakeFiles/matrix_add_op.dir/kernels/matrix_add_kernel.cc.o CMakeFiles/matrix_add_op.dir/ops/matrix_add.cc.o \
      -Wl,-rpath,$HOME/git/github.com/patwie/tensorflow-cmake/custom_op/user_ops:$HOME/.local/lib/python3.6/site-packages/tensorflow matrix_add_op_cu.so \
      $HOME/.local/lib/python3.6/site-packages/tensorflow/libtensorflow_framework.so \
      /opt/cuda/toolkit_10.0/cuda/lib64/libcudart_static.a -lpthread -ldl -lrt