forked from zpye/SimpleInfer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmake.lua
141 lines (119 loc) · 3.93 KB
/
xmake.lua
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
134
135
136
137
138
139
140
141
add_rules("mode.debug", "mode.release")
set_languages("cxx17")
option("build_python")
set_default(false)
set_showmenu(true)
option_end()
option("halide")
set_default(false)
set_showmenu(true)
add_includedirs("$(env HALIDE_ROOT)/include/", { public = true })
add_linkdirs("$(env HALIDE_ROOT)/bin/Release/",
"$(env HALIDE_ROOT)/lib/Release/", { public = true })
add_links("Halide")
add_rpathdirs("$(env HALIDE_ROOT)/bin/Release/")
option_end()
includes("3rdparty")
if has_config("halide") then
includes("src/layer/halide")
end
target("simple-infer")
set_kind("static")
add_includedirs("include/", { public = true })
add_includedirs("src/")
add_files("src/**.cpp")
add_deps("eigen", "abseil-log", "cgraph", "highway")
add_vectorexts("neon")
add_vectorexts("sse", "sse2", "sse3", "ssse3")
add_vectorexts("avx", "avx2")
if has_config("halide") then
add_deps("halide_layers")
end
if has_config("build_python") then
target("pybind11_export")
before_build(function ()
os.cp("python/simpleinfer/", "$(buildir)/python/")
end)
set_kind("shared")
set_basename("simpleinfer")
set_extension(".pyd")
set_targetdir("$(buildir)/python/simpleinfer")
add_files("python/pybind11_main.cpp")
add_deps("pybind11", "simple-infer")
after_build(function ()
os.cp("python/setup.py.in", "$(buildir)/python/setup.py")
end)
end
-- tests
target("test-eigen")
set_kind("binary")
add_includedirs("src/")
add_files("test/test_3rdparty/test_eigen.cpp")
add_deps("simple-infer")
target("test-im2col")
set_kind("binary")
add_includedirs("src/")
add_files("test/test_3rdparty/test_im2col.cpp")
add_deps("simple-infer")
target("test-broadcast")
set_kind("binary")
add_includedirs("src/")
add_files("test/test_3rdparty/test_broadcast.cpp")
add_deps("simple-infer")
target("test-engine")
set_kind("binary")
add_files("test/test_engine/test_engine.cpp")
add_defines("MODEL_PATH=R\"($(curdir)/3rdparty/tmp)\"")
add_deps("simple-infer")
target("test-pnnx-ir")
set_kind("binary")
add_includedirs("src/")
add_files("test/test_pnnx/test_pnnx_ir.cpp")
add_defines("MODEL_PATH=R\"($(curdir)/3rdparty/tmp)\"")
add_deps("simple-infer")
target("test-layer")
set_kind("binary")
add_includedirs("src/", "test/")
add_files("test/test_main.cpp")
add_files("test/test_layer/**.cpp")
add_deps("simple-infer", "catch2")
target("test-gemm")
set_kind("binary")
add_includedirs("src/", "test/")
add_files("test/test_main.cpp")
add_files("test/test_3rdparty/test_gemm.cpp")
add_deps("simple-infer", "catch2")
target("test-yolo")
set_kind("binary")
add_includedirs("src/")
add_files("test/test_yolo/test_yolo.cpp")
add_defines("MODEL_PATH=R\"($(curdir)/3rdparty/tmp)\"")
add_defines("IMAGE_PATH=R\"($(curdir)/imgs)\"")
add_deps("simple-infer", "simpleocv")
target("test-yolo2")
set_kind("binary")
add_includedirs("src/")
add_files("test/test_yolo/test_yolo2.cpp")
add_defines("MODEL_PATH=R\"($(curdir)/3rdparty/tmp)\"")
add_defines("IMAGE_PATH=R\"($(curdir)/imgs)\"")
add_deps("simple-infer")
target("test-classify")
set_kind("binary")
add_includedirs("src/")
add_files("test/test_classify/test_classify.cpp")
add_defines("MODEL_PATH=R\"($(curdir)/3rdparty/tmp)\"")
add_defines("IMAGE_PATH=R\"($(curdir)/imgs)\"")
add_deps("simple-infer")
target("test-highway")
set_kind("binary")
add_includedirs("src/", "test/")
add_files("src/logger.cpp")
add_files("test/test_highway/test_highway.cpp")
add_deps("abseil-log", "highway")
-- benchmark
target("bench")
set_kind("binary")
add_includedirs("src/")
add_files("bench/**.cpp")
add_defines("MODEL_PATH=R\"($(curdir)/3rdparty/tmp)\"")
add_deps("simple-infer", "benchmark")