@@ -20,49 +20,39 @@ set(FLATBUFFERS_BUILD_FLATC OFF)
20
20
# Enable this to see details about downloading -- useful for debugging
21
21
# set(FETCHCONTENT_QUIET NO)
22
22
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
+ )
27
30
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 )
38
39
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
+ )
43
49
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 )
60
51
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 )
66
56
67
57
# Make an interface library that is just to get the tflite headers,
68
58
# without any implied linkage
0 commit comments