-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
72 lines (56 loc) · 1.52 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
67
68
69
70
71
72
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(stdnn-ops)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
FIND_PROGRAM(CLANG_TIDY_EXE NAMES "clang-tidy")
IF(CLANG_TIDY_EXE)
SET(CMAKE_CXX_CLANG_TIDY clang-tidy)
ENDIF()
IF(APPLE)
ADD_DEFINITIONS(-DHAVE_STD_CPP_FS)
ELSE()
LINK_LIBRARIES(stdc++fs)
ENDIF()
OPTION(BUILD_BENCHMARKS "Build benchmarks." OFF)
OPTION(BUILD_EXAMPLES "Build examples." OFF)
OPTION(BUILD_LIB "Build library." OFF)
OPTION(BUILD_PACKAGES "Build release packages." OFF)
OPTION(BUILD_TESTS "Build tests." OFF)
OPTION(USE_EXTERN "use extern template." OFF)
OPTION(USE_OPENBLAS "Build with blas." OFF)
OPTION(USE_OPT "Turn on optimization flags." OFF)
OPTION(USE_STRICT "Enable strict build options." ON)
IF(USE_STRICT)
ADD_DEFINITIONS(-Wall)
ADD_DEFINITIONS(-Werror)
ADD_DEFINITIONS(-Wfatal-errors)
ENDIF()
IF(USE_EXTERN)
ADD_DEFINITIONS(-DSTDNN_OPS_EXTERN_TEMPLATE)
ENDIF()
IF(USE_OPT)
ADD_DEFINITIONS(-ffast-math)
ENDIF()
IF(USE_OPENBLAS)
INCLUDE(cmake/blas.cmake)
ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
IF(BUILD_TESTS)
FIND_PACKAGE(stdtensor REQUIRED)
ENABLE_TESTING()
INCLUDE(cmake/tests.cmake)
ENDIF()
IF(BUILD_BENCHMARKS)
INCLUDE(cmake/benchmarks.cmake)
ENDIF()
IF(BUILD_LIB)
ADD_LIBRARY(stdnn-ops src/nn/ops.cpp)
TARGET_USE_STDTENSOR(stdnn-ops)
ENDIF()
IF(BUILD_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF()
INSTALL(DIRECTORY include DESTINATION .)
IF(BUILD_PACKAGES)
INCLUDE(cmake/package.cmake)
ENDIF()