-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
85 lines (71 loc) · 2.28 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
add_rules("mode.debug", "mode.release")
set_project("algorithm")
set_languages("c++17")
set_optimize("debug")
add_includedirs("include")
add_requires("catch2", "benchmark")
function define_test_target(name)
local target_name = "test-" .. name
target(target_name)
set_kind("binary")
add_packages("catch2")
add_files('src/'..name..'/test.cpp')
end
function define_bench_target(name)
local target_name = "bench-" .. name
target(target_name)
set_kind("binary")
add_packages("benchmark")
add_files('src/'..name..'/bench.cpp')
end
function define_target(name)
define_test_target(name)
define_bench_target(name)
end
define_target("sliding-window-maximum")
define_target("kth-largest-element-in-an-array")
define_target("reverse-linked-list")
define_target("binary-tree-maximum-path-sum")
define_target("lowest-common-ancestor-of-a-binary-tree")
define_target("delete-node-in-a-bst")
define_target("lru-cache")
define_target("maximum-subarray")
define_target("leetcode")
define_target("longest-substring-without-repeating-characters")
define_target("course-schedule")
define_target("serialize-and-deserialize-binary-tree")
define_target("merge-intervals")
define_target("binary-search")
define_target("guess-number-higher-or-lower")
define_target("sqrtx")
define_target("search-insert-position")
define_target("peak-index-in-a-mountain-array")
define_target("find-the-distance-value-between-two-arrays")
define_target("longest-palindromic-substring")
define_target("top-k-frequent-elements")
task("problem")
set_category("plugin")
on_run(function()
-- 导入参数选项模块
import("core.base.option")
local title = option.get('title')
local src_dir = "$(projectdir)/src/"..title
if os.exists(src_dir) then
print(src_dir.." has exist!!!")
else
os.mkdir(src_dir)
os.cd(src_dir)
os.run("touch solution.hpp")
os.run("touch test.cpp")
os.run("touch bench.cpp")
os.cd('-')
end
end)
set_menu {
usage = "xmake problem title" ,
description = "create leetcode problem template" ,
options =
{
{nil, "title", "v", nil, "the problem title"}
}
}