-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
38 lines (29 loc) · 1.04 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
cmake_minimum_required(VERSION 3.14.6)
project(fasttensor LANGUAGES CXX)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(USE_LIBCPP ON CACHE BOOL "Use libc++ if compiling with clang")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND USE_LIBCPP)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++")
endif()
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
if(${FORCE_COLORED_OUTPUT})
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-fcolor-diagnostics)
endif()
endif()
include(clang-format.cmake)
option(BUILD_TESTS "Set to ON to build tests" ON)
option(BUILD_BENCHMARKS "Set to ON to build benchmarks" ON)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(fasttensor)
if(BUILD_TESTS)
add_subdirectory(ext/googletest)
add_subdirectory(tests)
endif()
if(BUILD_BENCHMARKS)
add_subdirectory(bench)
endif()