From d1b57e8ecad537ddcbf0de74ee55986f50392657 Mon Sep 17 00:00:00 2001 From: Zhouheng Zheng Date: Mon, 28 Mar 2022 09:42:19 +0800 Subject: [PATCH] Add cmake option of custom op support (#335) Co-authored-by: zhouheng.zheng --- CMakeLists.txt | 1 + samples/CMakeLists.txt | 5 ++++- src/tim/CMakeLists.txt | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 101e67f..babc3ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required (VERSION 3.14) project(tim-vx LANGUAGES C CXX) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) +option(TIM_VX_ENABLE_CUSTOM_OP "Enable custom op support" OFF) option(TIM_VX_ENABLE_TEST "Build the unit test" OFF) option(TIM_VX_ENABLE_LAYOUT_INFER "Enable layout inference support" ON) option(TIM_VX_ENABLE_NBG_PARSER "Enable NBG parser" OFF) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index b80d9e4..aca032d 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -1,5 +1,8 @@ add_subdirectory("benchmark_test") -add_subdirectory("custom_op_test") +if(${TIM_VX_ENABLE_CUSTOM_OP}) + add_subdirectory("custom_op_test") +endif() + add_subdirectory("lenet") if(${TIM_VX_ENABLE_VIPLITE}) add_subdirectory("lenet_lite") diff --git a/src/tim/CMakeLists.txt b/src/tim/CMakeLists.txt index 3cccbc0..0a3a68c 100644 --- a/src/tim/CMakeLists.txt +++ b/src/tim/CMakeLists.txt @@ -5,6 +5,10 @@ set(TARGET_NAME "tim-vx") aux_source_directory(./vx VX_SRC) aux_source_directory(./vx/ops OPS_SRC) +if(NOT ${TIM_VX_ENABLE_CUSTOM_OP}) + list(REMOVE_ITEM OPS_SRC "./vx/ops/custom_base.cc") +endif() + set(${TARGET_NAME}_SRCS) list(APPEND ${TARGET_NAME}_SRCS ${VX_SRC}