@@ -832,6 +832,21 @@ configure_file(
832
832
${LLVM_INCLUDE_DIR} /llvm/Config/Targets.def
833
833
)
834
834
835
+ # For up-to-date instructions for installing the Tensorflow dependency, refer to
836
+ # the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh
837
+ # In this case, the latest C API library is available for download from
838
+ # https://www.tensorflow.org/install/lang_c.
839
+ # We will expose the conditional compilation variable,
840
+ # LLVM_HAVE_TF_API, through llvm-config.h, so that a user of the LLVM library may
841
+ # also leverage the dependency.
842
+ set (TENSORFLOW_C_LIB_PATH "" CACHE PATH "Path to TensorFlow C library install" )
843
+ find_library (tensorflow_c_api tensorflow PATHS ${TENSORFLOW_C_LIB_PATH} /lib )
844
+
845
+ if (tensorflow_c_api )
846
+ set (LLVM_HAVE_TF_API "ON" CACHE BOOL "Full Tensorflow API available" )
847
+ include_directories (${TENSORFLOW_C_LIB_PATH} /include )
848
+ endif ()
849
+
835
850
# Configure the three LLVM configuration header files.
836
851
configure_file (
837
852
${LLVM_MAIN_INCLUDE_DIR} /llvm/Config/config.h.cmake
@@ -972,27 +987,18 @@ set(TENSORFLOW_AOT_PATH "" CACHE PATH "Path to TensorFlow pip install dir")
972
987
973
988
if (NOT TENSORFLOW_AOT_PATH STREQUAL "" )
974
989
set (LLVM_HAVE_TF_AOT "ON" CACHE BOOL "Tensorflow AOT available" )
975
- set (TENSORFLOW_AOT_COMPILER
976
- "${TENSORFLOW_AOT_PATH} /../../../../bin/saved_model_cli"
977
- CACHE PATH "Path to the Tensorflow AOT compiler" )
990
+ set (TENSORFLOW_AOT_COMPILER
991
+ "${TENSORFLOW_AOT_PATH} /../../../../bin/saved_model_cli"
992
+ CACHE PATH "Path to the Tensorflow AOT compiler" )
993
+ # Unlike the LLVM_HAVE_TF_API case, we don't need to expose this through
994
+ # llvm-config.h, because it's an internal implementation detail. A user of the llvm library that wants to also
995
+ # use the TF AOT compiler may do so through their custom build step.
978
996
add_definitions ("-DLLVM_HAVE_TF_AOT" )
979
997
include_directories (${TENSORFLOW_AOT_PATH} /include )
980
998
add_subdirectory (${TENSORFLOW_AOT_PATH} /xla_aot_runtime_src
981
999
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} /tf_runtime )
982
1000
endif ()
983
1001
984
- set (TENSORFLOW_C_LIB_PATH "" CACHE PATH "Path to TensorFlow C library install" )
985
- find_library (tensorflow_c_api tensorflow PATHS ${TENSORFLOW_C_LIB_PATH} /lib )
986
-
987
- # Similar to the above Tensorflow dependency, please refer to the same script.
988
- # In this case, the latest C API library is available for download from
989
- # https://www.tensorflow.org/install/lang_c
990
- if (tensorflow_c_api )
991
- set (LLVM_HAVE_TF_API "ON" CACHE BOOL "Full Tensorflow API available" )
992
- add_definitions ("-DLLVM_HAVE_TF_API" )
993
- include_directories (${TENSORFLOW_C_LIB_PATH} /include )
994
- endif ()
995
-
996
1002
# Put this before tblgen. Else we have a circular dependence.
997
1003
add_subdirectory (lib/Demangle )
998
1004
add_subdirectory (lib/Support )
0 commit comments