Fix cmake host build error due to gcc warnings being treated as errors

LiteRT-PiperOrigin-RevId: 850147345
This commit is contained in:
Google AI Edge 2025-12-29 13:34:02 -08:00 committed by Copybara-Service
parent 44713aa110
commit e2fb1c0fe0
4 changed files with 19 additions and 3 deletions

View File

@ -63,6 +63,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Suppress deprecation warnings (matching Bazel build behavior in .bazelrc)
# The codebase has deprecated Error constructors that are still in use
add_compile_options(
-Wno-deprecated-declarations
-Wno-return-type
-fpermissive
)
if(CMAKE_SYSTEM_PROCESSOR)
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" LITERT_SYSTEM_PROCESSOR_LOWER)
else()
@ -410,4 +418,3 @@ add_subdirectory(vendors)
if(LITERT_BUILD_TOOLS)
add_subdirectory(tools)
endif()

View File

@ -177,6 +177,7 @@ else()
${ABSEIL_TOOL_LIBS}
${LITERT_TOOL_COMMON_LIBS}
"-Wl,--end-group"
${CMAKE_DL_LIBS}
)
endif()
@ -221,6 +222,7 @@ else()
litert_core
litert_core_model
"-Wl,--end-group"
${CMAKE_DL_LIBS}
)
endif()
@ -272,6 +274,7 @@ else()
${ABSEIL_TOOL_LIBS}
${LITERT_TOOL_COMMON_LIBS}
"-Wl,--end-group"
${CMAKE_DL_LIBS}
)
endif()
# Platform-specific configurations for all executables

View File

@ -324,6 +324,7 @@ std::string AbslUnparseFlag(QualcommOptions::GraphPriority graph_priority) {
case QualcommOptions::GraphPriority::kHigh:
return "high";
}
return "default";
}
std::string AbslUnparseFlag(
@ -336,6 +337,7 @@ std::string AbslUnparseFlag(
case QualcommOptions::OptimizationLevel::kOptimizeForInferenceO3:
return "O3";
}
return "O1";
}
} // namespace litert::qualcomm

View File

@ -229,7 +229,12 @@ function(_litert_add_dispatch_so VENDOR DIR OUTPUT_BASENAME)
endfunction()
# Google Tensor
_litert_add_dispatch_so(GoogleTensor "google_tensor/dispatch" "GoogleTensor")
set(GOOGLE_TENSOR_SB_API_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/google_tensor/dispatch/sb_api.h")
if(EXISTS "${GOOGLE_TENSOR_SB_API_HEADER}")
_litert_add_dispatch_so(GoogleTensor "google_tensor/dispatch" "GoogleTensor")
else()
message(STATUS "Skipping Google Tensor dispatch: sb_api.h not found")
endif()
# MediaTek
check_include_file_cxx("neuron/api/NeuronAdapter.h" HAVE_MEDIATEK_NEURON_HDR)
if(NEUROPILOT_HEADERS_DIR AND EXISTS "${NEUROPILOT_HEADERS_DIR}/neuron/api/NeuronAdapter.h")
@ -258,4 +263,3 @@ if(LITERT_ENABLE_QUALCOMM)
# Use modular CMake structure for Qualcomm
add_subdirectory(qualcomm)
endif()