mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
feat : support xmake build
This commit is contained in:
49
tutorial/xmake.lua
Normal file
49
tutorial/xmake.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
set_group("tutorial")
|
||||
set_default(false)
|
||||
|
||||
if not is_os("macosx") then
|
||||
add_ldflags("-lrt")
|
||||
end
|
||||
|
||||
add_links("crypto")
|
||||
add_links("ssl")
|
||||
|
||||
add_includedirs(get_config("workflow_inc"))
|
||||
|
||||
function all_examples()
|
||||
local res = {}
|
||||
for _, x in ipairs(os.files("*.cc")) do
|
||||
local item = {}
|
||||
local s = path.filename(x)
|
||||
if((s == "upstream_unittest.cc" and get_config("upstream") == false) or
|
||||
((s == "tutorial-02-redis_cli.cc" or s == "tutorial-03-wget_to_redis.cc") and get_config("redis") == false) or
|
||||
(s == "tutorial-12-mysql_cli.cc" and get_config("mysql") == false) or
|
||||
(s == "tutorial-14-consul_cli.cc" and get_config("consul") == false) or
|
||||
(s == "tutorial-13-kafka_cli.cc")) then
|
||||
else
|
||||
table.insert(item, s:sub(1, #s - 3)) -- target
|
||||
table.insert(item, path.relative(x, ".")) -- source
|
||||
table.insert(res, item)
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
for _, example in ipairs(all_examples()) do
|
||||
target(example[1])
|
||||
set_kind("binary")
|
||||
add_files(example[2])
|
||||
add_deps("workflow")
|
||||
end
|
||||
|
||||
target("tutorial-13-kafka_cli")
|
||||
if (get_config("kafka") == true) then
|
||||
set_kind("binary")
|
||||
add_files("tutorial-13-kafka_cli.cc")
|
||||
add_packages("zlib", "snappy", "zstd", "lz4")
|
||||
add_deps("wfkafka")
|
||||
else
|
||||
set_kind("phony")
|
||||
end
|
||||
|
||||
includes("tutorial-10-user_defined_protocol", "tutorial-16-graceful_restart")
|
||||
Reference in New Issue
Block a user