forked from OpenPPL/ppl.nn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
109 lines (77 loc) · 2.86 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
cmake_minimum_required(VERSION 3.11)
project(ppl.nn)
# --------------------------------------------------------------------------- #
# options
option(PPLNN_BUILD_TESTS "build all tests" ON)
option(PPLNN_BUILD_TOOLS "build tools" ON)
option(PPLNN_BUILD_SAMPLES "build samples" ON)
option(PPLNN_ENABLE_KERNEL_PROFILING "enable profiling for each kernel" OFF)
# --------------------------------------------------------------------------- #
# variables
set(PPLNN_SOURCES)
set(PPLNN_INCLUDE_DIRECTORIES)
set(PPLNN_COMPILE_DEFINITIONS)
set(PPLNN_LINK_LIBRARIES)
set(PPLNN_LINK_DIRECTORIES)
# --------------------------------------------------------------------------- #
# dependencies
include(cmake/deps.cmake)
include(cmake/protobuf.cmake)
hpcc_populate_dep(rapidjson)
hpcc_populate_dep(ppl.common)
# --------------------------------------------------------------------------- #
# framework related
include(cmake/version.cmake)
file(GLOB_RECURSE PPLNN_MODELS_SRC
src/ppl/nn/models/*.cc)
file(GLOB_RECURSE PPLNN_BUILTIN_ENGINE_SRC
src/ppl/nn/engines/cpu/*.cc
src/ppl/nn/engines/common/*.cc)
file(GLOB_RECURSE PPLNN_OPUTILS_SRC
src/ppl/nn/oputils/*.cc)
file(GLOB PPLNN_FRAMEWORK_SRC
src/ppl/nn/common/*.cc
src/ppl/nn/ir/*.cc
src/ppl/nn/optimizers/*.cc
src/ppl/nn/quantization/*.cc
src/ppl/nn/runtime/*.cc
src/ppl/nn/utils/*.cc
${PPLNN_OPUTILS_SRC}
${PPLNN_BUILTIN_ENGINE_SRC}
${PPLNN_MODELS_SRC})
list(APPEND PPLNN_SOURCES ${PPLNN_FRAMEWORK_SRC})
list(APPEND PPLNN_INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src)
list(APPEND PPLNN_LINK_LIBRARIES pplcommon_static libprotobuf)
if(PPLNN_ENABLE_KERNEL_PROFILING)
list(APPEND PPLNN_COMPILE_DEFINITIONS PPLNN_ENABLE_KERNEL_PROFILING)
endif()
# --------------------------------------------------------------------------- #
# engines
include(cmake/x86.cmake)
include(cmake/cuda.cmake)
# --------------------------------------------------------------------------- #
# dependencies
add_library(pplnn_static STATIC ${PPLNN_SOURCES})
target_include_directories(pplnn_static PUBLIC ${PPLNN_INCLUDE_DIRECTORIES})
target_link_directories(pplnn_static PUBLIC ${PPLNN_LINK_DIRECTORIES})
target_link_libraries(pplnn_static PUBLIC ${PPLNN_LINK_LIBRARIES})
target_compile_definitions(pplnn_static PUBLIC ${PPLNN_COMPILE_DEFINITIONS})
target_include_directories(pplnn_static PRIVATE
${rapidjson_SOURCE_DIR}/include
${protobuf_SOURCE_DIR}/src)
# --------------------------------------------------------------------------- #
# installation
include(cmake/install.cmake)
# --------------------------------------------------------------------------- #
# tools, tests and samples
if(PPLNN_BUILD_TOOLS)
add_subdirectory(tools)
endif()
if(PPLNN_BUILD_TESTS)
add_subdirectory(tests)
endif()
if(PPLNN_BUILD_SAMPLES)
add_subdirectory(samples/cpp)
endif()