Fix tflite cmake build failures, tensorflow dropped the version support

PiperOrigin-RevId: 808805474
This commit is contained in:
A. Unique TensorFlower
2025-09-18 17:32:51 -07:00
committed by TensorFlower Gardener
parent 3957c71530
commit f1ffdbc50d
2 changed files with 31 additions and 2 deletions

View File

@@ -37,9 +37,14 @@ if(NOT protobuf_POPULATED)
OverridableFetchContent_Populate(protobuf)
endif()
# Export basic variables expected by consumers
set(Protobuf_INCLUDE_DIR "${protobuf_SOURCE_DIR}/src" CACHE INTERNAL "")
set(Protobuf_LIBRARIES protobuf::libprotobuf CACHE INTERNAL "")
add_subdirectory(${protobuf_SOURCE_DIR} ${protobuf_BINARY_DIR})
# Avoid adding the same subdirectory twice when multiple find_package calls
# occur in a single configure (e.g., from different subprojects).
if(NOT TARGET protobuf::libprotobuf)
add_subdirectory(${protobuf_SOURCE_DIR} ${protobuf_BINARY_DIR})
endif()
set(Protobuf_PROTOC_EXECUTABLE protoc CACHE INTERNAL "")

View File

@@ -15,7 +15,31 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_VERSION_H_
#define TENSORFLOW_LITE_VERSION_H_
#include "tensorflow/core/public/release_version.h"
// TODO (b/446006189): Generate the following file from a template that aligns
// LiteRT versioning.
// Update the following version number with every LiteRT release following the
// semantic versioning https://semver.org/
#ifndef TF_VERSION_STRING
#ifndef TF_MAJOR_VERSION
#define TF_MAJOR_VERSION 2
#endif
#ifndef TF_MINOR_VERSION
#define TF_MINOR_VERSION 19
#endif
#ifndef TF_PATCH_VERSION
#define TF_PATCH_VERSION 0
#endif
#ifndef TF_VERSION_SUFFIX
#define TF_VERSION_SUFFIX ""
#endif
#ifndef TF_STR_HELPER
#define TF_STR_HELPER(x) #x
#define TF_STR(x) TF_STR_HELPER(x)
#endif
#define TF_VERSION_STRING \
(TF_STR(TF_MAJOR_VERSION) "." TF_STR(TF_MINOR_VERSION) "." TF_STR( \
TF_PATCH_VERSION) TF_VERSION_SUFFIX)
#endif // TF_VERSION_STRING
// The version number of the Schema. Ideally all changes will be backward
// compatible. If that ever changes, we must ensure that version is the first