Skip to content

Commit 6da9acd

Browse files
committed
Update tflite to 2.19.0 so that it builds
1 parent c145fce commit 6da9acd

File tree

3 files changed

+33
-43
lines changed

3 files changed

+33
-43
lines changed

apps/hannk/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ set(CMAKE_CXX_EXTENSIONS NO)
2929
# (We need to do this even if HANNK_BUILD_TFLITE is off,
3030
# so that the .tflite file parser can get the right schema)
3131
set(TFLITE_VERSION_MAJOR "2" CACHE STRING "Major version of TFLite to assume")
32-
set(TFLITE_VERSION_MINOR "8" CACHE STRING "Minor version of TFLite to assume")
33-
set(TFLITE_VERSION_PATCH "3" CACHE STRING "Patch version of TFLite to assume")
32+
set(TFLITE_VERSION_MINOR "19" CACHE STRING "Minor version of TFLite to assume")
33+
set(TFLITE_VERSION_PATCH "0" CACHE STRING "Patch version of TFLite to assume")
3434
set(TFLITE_VERSION "${TFLITE_VERSION_MAJOR}.${TFLITE_VERSION_MINOR}.${TFLITE_VERSION_PATCH}")
3535

3636
# ----------------------------

apps/hannk/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ clean:
5959
# ---------------------- TFLite glue
6060

6161
TFLITE_VERSION_MAJOR ?= 2
62-
TFLITE_VERSION_MINOR ?= 8
63-
TFLITE_VERSION_PATCH ?= 3
62+
TFLITE_VERSION_MINOR ?= 19
63+
TFLITE_VERSION_PATCH ?= 0
6464

6565
TFLITE_VERSION = $(TFLITE_VERSION_MAJOR).$(TFLITE_VERSION_MINOR).$(TFLITE_VERSION_PATCH)
6666
TFLITE_TAG = v$(TFLITE_VERSION)

apps/hannk/tflite/CMakeLists.txt

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,49 +20,39 @@ set(FLATBUFFERS_BUILD_FLATC OFF)
2020
# Enable this to see details about downloading -- useful for debugging
2121
# set(FETCHCONTENT_QUIET NO)
2222

23-
FetchContent_Declare(tflite
24-
GIT_REPOSITORY https://github.com/tensorflow/tensorflow
25-
GIT_TAG ${TFLITE_TAG}
26-
GIT_SHALLOW TRUE)
23+
FetchContent_Declare(
24+
tflite
25+
GIT_REPOSITORY https://github.com/tensorflow/tensorflow
26+
GIT_TAG ${TFLITE_TAG}
27+
GIT_SHALLOW TRUE
28+
SOURCE_SUBDIR tensorflow/lite/c
29+
)
2730

28-
FetchContent_GetProperties(tflite)
29-
if (NOT tflite_POPULATED)
30-
FetchContent_Populate(tflite)
31-
# Some of the subprojects (e.g. Eigen) are very noisy and emit status messages all the time.
32-
# Temporary ignore status messages while adding this to silence it. Ugly but effective.
33-
set(OLD_CMAKE_MESSAGE_LOG_LEVEL ${CMAKE_MESSAGE_LOG_LEVEL})
34-
set(CMAKE_MESSAGE_LOG_LEVEL WARNING)
35-
add_subdirectory(${tflite_SOURCE_DIR}/tensorflow/lite/c ${tflite_BINARY_DIR})
36-
set(CMAKE_MESSAGE_LOG_LEVEL ${OLD_CMAKE_MESSAGE_LOG_LEVEL})
37-
endif ()
31+
block(SCOPE_FOR POLICIES VARIABLES)
32+
# Suppress warnings about rotting CMake code we don't control
33+
set(CMAKE_POLICY_DEFAULT_CMP0135 OLD) # DOWNLOAD_EXTRACT_TIMESTAMP
34+
set(CMAKE_POLICY_DEFAULT_CMP0169 OLD) # FetchContent_Populate
35+
set(CMAKE_POLICY_DEFAULT_CMP0177 OLD) # install() path normalization
36+
37+
# Configuration for tflite + upstream deps
38+
set(ABSL_PROPAGATE_CXX_STD ON)
3839

39-
# tensorflowlite_c is implicitly declared by this FetchContent.
40-
# Mark it as EXCLUDE_FROM_ALL so that it won't be built unless we actually
41-
# depend on it (which we might not depending on HANNK_BUILD_TFLITE)
42-
set_property(TARGET tensorflowlite_c PROPERTY EXCLUDE_FROM_ALL TRUE)
40+
# Suppress warnings in tflite code
41+
add_compile_options(
42+
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-anon-enum-enum-conversion>
43+
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-deprecated-this-capture>
44+
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-shadow-uncaptured-local>
45+
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-shadow>
46+
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-tautological-type-limit-compare>
47+
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-unused-template>
48+
)
4349

44-
# Disable some noisy warnings in abseil
45-
foreach (LIB IN ITEMS
46-
absl_base
47-
absl_graphcycles_internal
48-
absl_malloc_internal
49-
absl_synchronization
50-
absl_time
51-
absl_time_zone)
52-
target_compile_options(${LIB}
53-
PRIVATE
54-
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-tautological-type-limit-compare>
55-
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-unused-template>
56-
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-shadow>
57-
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-shadow-uncaptured-local>
58-
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-anon-enum-enum-conversion>)
59-
endforeach ()
50+
FetchContent_MakeAvailable(tflite)
6051

61-
# Disable some noisy warnings in tflite
62-
target_compile_options(tensorflow-lite
63-
PRIVATE
64-
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-gnu-inline-cpp-without-extern>
65-
$<$<CXX_COMPILER_ID:GNU>:-Wno-ignored-attributes>)
52+
set_property(TARGET tensorflowlite_c PROPERTY EXCLUDE_FROM_ALL TRUE)
53+
endblock()
54+
55+
FetchContent_GetProperties(tflite)
6656

6757
# Make an interface library that is just to get the tflite headers,
6858
# without any implied linkage

0 commit comments

Comments
 (0)