forked from VeriSilicon/TIM-VX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (55 loc) · 2.13 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required (VERSION 3.14)
project(tim-vx LANGUAGES C CXX)
OPTION(TIM_VX_ENABLE_TEST "Build the unit test" ON)
OPTION(TIM_VX_ENABLE_LAYOUT_INFER "Enable layout inference support" ON)
OPTION(TIM_VX_CODE_COVERAGE "Run code coverage with gconv(gcc only" OFF)
option(TIM_VX_USE_EXTERNAL_OVXLIB "Use external OVXLIB" OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror")
set(CONFIG "" CACHE STRING "Target Platform")
if(${TIM_VX_CODE_COVERAGE})
set(CMAKE_CXX_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage")
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
endif()
set(CMAKE_C_VISIBILITY_PRESET hidden)
if(EXTERNAL_VIV_SDK AND EXISTS ${EXTERNAL_VIV_SDK})
# this is for internal development purpose
include(cmake/local_sdk.cmake)
else()
set(TIM_VX_ENABLE_TEST OFF)
if("${CONFIG}" STREQUAL "A311D")
include(cmake/A311D.cmake)
elseif("${CONFIG}" STREQUAL "S905D3")
include(cmake/S905D3.cmake)
elseif("${CONFIG}" STREQUAL "vim3_android")
include(cmake/vim3_android.cmake)
elseif("${CONFIG}" STREQUAL "YOCTO")
include(cmake/YOCTO.cmake)
else()
set(TIM_VX_ENABLE_TEST ON)
include(cmake/X86_64_linux.cmake)
endif()
endif()
if(TIM_VX_ENABLE_TEST)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif()
endif()
include_directories(${PROJECT_SOURCE_DIR}/include/tim/vx)
include_directories(${OVXDRV_INCLUDE_DIRS})
add_subdirectory("src/tim/")
add_subdirectory("samples/lenet")