-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
37 lines (29 loc) · 1.14 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
cmake_minimum_required(VERSION 3.17)
project(InfiniTensor C CXX)
option(USE_CUDA "Support CUDA GPU" OFF)
option(USE_BANG "Support BANG MLU" OFF)
option(BUILD_TEST "Build test code" ON)
option(BUILD_ASAN "Build code whith ASAN" OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
################################################################################
# ASAN Check
################################################################################
if(BUILD_ASAN)
set(CMAKE_ASAN_FLAGS "-fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ASAN_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ASAN_FLAGS}")
endif()
include_directories(include)
file(GLOB_RECURSE SOURCE source/core/*.cpp source/operators/*.cpp source/kernels/*.cpp)
add_library(Thread SHARED ${SOURCE})
if(BUILD_TEST)
file(GLOB_RECURSE TEST test/*.cpp)
foreach(file ${TEST})
get_filename_component(filename ${file} NAME_WE)
add_executable(${filename} ${file})
target_link_libraries(${filename} Thread)
add_test(NAME ${filename} COMMAND ${filename})
endforeach()
endif()