From ef7c7803295bd846113f3d8b749a65e1301759bd Mon Sep 17 00:00:00 2001 From: Luke Hutton Date: Mon, 17 Jul 2023 12:16:31 +0000 Subject: [PATCH] [CMAKE] Conditionally link "clog" in NNPack install "cpuinfo" is a direct dependency of NNPack. It is installed via the NNPack's cmake script, but the version is not pinned. The "clog" dependency was recently removed from "cpuinfo" (https://github.com/pytorch/cpuinfo/commit/3dc310302210c1891ffcfb12ae67b11a3ad3a150), which leads to issues when compiling TVM with support for NNPack. When building TVM with newly generated docker images and NNPack enabled, we run into the following cmake configuration error: ``` The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: NNPACK_CLOG_CONTRIB_LIB ``` This commit intends to fix this failure while also keeping compatibility with older versions of cpuinfo. It conditionally adds "clog" to the linker libs variable if it was found. Change-Id: I103f81b7ac75e9623ed808d240ce959749c13cf2 --- cmake/modules/contrib/NNPack.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/modules/contrib/NNPack.cmake b/cmake/modules/contrib/NNPack.cmake index 7030333f8e44..86059b298f0b 100644 --- a/cmake/modules/contrib/NNPack.cmake +++ b/cmake/modules/contrib/NNPack.cmake @@ -32,5 +32,7 @@ if(USE_NNPACK) list(APPEND TVM_RUNTIME_LINKER_LIBS ${NNPACK_CONTRIB_LIB}) list(APPEND TVM_RUNTIME_LINKER_LIBS ${NNPACK_PTHREAD_CONTRIB_LIB}) list(APPEND TVM_RUNTIME_LINKER_LIBS ${NNPACK_CPUINFO_CONTRIB_LIB}) - list(APPEND TVM_RUNTIME_LINKER_LIBS ${NNPACK_CLOG_CONTRIB_LIB}) + if(NNPACK_CLOG_CONTRIB_LIB) + list(APPEND TVM_RUNTIME_LINKER_LIBS ${NNPACK_CLOG_CONTRIB_LIB}) + endif(NNPACK_CLOG_CONTRIB_LIB) endif(USE_NNPACK)