-
Notifications
You must be signed in to change notification settings - Fork 23
/
CMakeLists.txt
133 lines (113 loc) · 3.66 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
get_filename_component(CHAINER_COMPILER_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} PATH)
set(GSLLITE_INCLUDE_DIRS ${CHAINER_COMPILER_ROOT_DIR}/gsl-lite/include)
include_directories(${GSLLITE_INCLUDE_DIRS})
include_directories(${CHAINER_COMPILER_ROOT_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
include_directories(${CUDA_INCLUDE_DIRS})
add_custom_command(
OUTPUT
"${CMAKE_CURRENT_BINARY_DIR}/compiler_flags.cc"
COMMAND
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_flags_code.py" --mode compiler_flags.cc
--output "${CMAKE_CURRENT_BINARY_DIR}/compiler_flags.cc"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_flags_code.py"
)
add_library(chainer_compiler_tools
"${CMAKE_CURRENT_BINARY_DIR}/compiler_flags.cc"
log.cc
run_onnx_util.cc
util.cc
)
add_dependencies(
chainer_compiler_tools
runtime_chxvm_pb_h gen_node_base_h compiler_flags_h gen_onnx_proto
)
set_hidden_(chainer_compiler_tools)
add_executable(dump dump.cc)
target_link_libraries(dump
chainer_compiler_tools
chainer_compiler_compiler
chainer_compiler_configs
chainer_compiler_runtime
chainer_compiler_common
${CHAINER_COMPILER_DEPENDENCY_LIBRARIES})
set_target_properties(dump PROPERTIES OUTPUT_NAME "dump")
add_library(run_onnx_lib
run_onnx.cc
)
add_dependencies(
run_onnx_lib
runtime_chxvm_pb_h gen_node_base_h compiler_flags_h gen_onnx_proto
)
set_hidden_(run_onnx_lib)
add_executable(run_onnx run_onnx_main.cc)
target_link_libraries(run_onnx
run_onnx_lib
chainer_compiler_tools
chainer_compiler_compiler
chainer_compiler_configs
chainer_compiler_runtime
chainer_compiler_common
${CHAINER_COMPILER_DEPENDENCY_LIBRARIES})
set_target_properties(run_onnx PROPERTIES OUTPUT_NAME "run_onnx")
if(${CHAINER_COMPILER_ENABLE_OPENCV})
add_library(train_imagenet_lib
train_imagenet.cc
)
add_dependencies(
train_imagenet_lib
runtime_chxvm_pb_h gen_node_base_h compiler_flags_h gen_onnx_proto
)
set_hidden_(train_imagenet_lib)
add_executable(train_imagenet train_imagenet_main.cc)
add_dependencies(
train_imagenet
runtime_chxvm_pb_h gen_node_base_h compiler_flags_h gen_onnx_proto
)
target_link_libraries(train_imagenet
train_imagenet_lib
chainer_compiler_tools
chainer_compiler_compiler
chainer_compiler_configs
chainer_compiler_runtime
chainer_compiler_common
feeder
${CHAINER_COMPILER_DEPENDENCY_LIBRARIES})
set_target_properties(train_imagenet PROPERTIES OUTPUT_NAME "train_imagenet")
endif()
if (${CHAINER_COMPILER_ENABLE_PYTHON})
include_directories(${PYTHON_INCLUDE_DIRS})
pybind11_add_module(run_onnx_core.so MODULE run_onnx_core.cc)
set_hidden_(run_onnx_core.so)
target_link_libraries(run_onnx_core.so
PRIVATE
run_onnx_lib
chainer_compiler_tools
chainer_compiler_compiler
chainer_compiler_configs
chainer_compiler_runtime
chainer_compiler_common
${CHAINER_COMPILER_DEPENDENCY_LIBRARIES})
set_target_properties(run_onnx_core.so
PROPERTIES
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_SUFFIX}")
if(${CHAINER_COMPILER_ENABLE_OPENCV})
pybind11_add_module(train_imagenet_core.so MODULE train_imagenet_core.cc)
set_hidden_(train_imagenet_core.so)
target_link_libraries(train_imagenet_core.so
PRIVATE
train_imagenet_lib
chainer_compiler_tools
chainer_compiler_compiler
chainer_compiler_configs
chainer_compiler_runtime
chainer_compiler_common
feeder
${CHAINER_COMPILER_DEPENDENCY_LIBRARIES})
set_target_properties(train_imagenet_core.so
PROPERTIES
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_SUFFIX}")
endif()
endif()