fix : xmake build _lib empty

This commit is contained in:
Chanchan
2023-01-04 21:48:30 +08:00
parent 190c007417
commit 0645d6ced0
2 changed files with 34 additions and 34 deletions

View File

@@ -1,18 +1,30 @@
includes("**/xmake.lua")
on_install(function (target)
os.cp(path.join(get_config("workflow_inc"), "workflow"), path.join(target:installdir(), "include"))
if target:is_static() then
os.cp(path.join(get_config("workflow_lib"), "*.a"), path.join(target:installdir(), "lib"))
else
os.cp(path.join(get_config("workflow_lib"), "*.so"), path.join(target:installdir(), "lib"))
end
end)
after_build(function (target)
local lib_dir = get_config("workflow_lib")
if (not os.isdir(lib_dir)) then
os.mkdir(lib_dir)
end
if target:is_static() then
os.mv(path.join("$(projectdir)", target:targetdir(), "*.a"), lib_dir)
else
os.mv(path.join("$(projectdir)", target:targetdir(), "*.so"), lib_dir)
end
end)
target("workflow")
set_kind("$(kind)")
add_deps("algorithm", "client", "factory", "kernel", "manager",
"nameservice", "protocol", "server", "util")
target("wfkafka")
if has_config("kafka") then
set_kind("$(kind)")
add_deps("kafka_client", "kafka_factory", "kafka_protocol", "kafka_util", "workflow")
else
set_kind("phony")
end
on_load(function (package)
local include_path = path.join(get_config("workflow_inc"), "workflow")
if (not os.isdir(include_path)) then
@@ -23,29 +35,11 @@ target("wfkafka")
os.cp(path.join("$(projectdir)", "src/**.inl"), include_path)
end)
after_build(function (target)
local lib_dir = get_config("workflow_lib")
if (not os.isdir(lib_dir)) then
os.mkdir(lib_dir)
end
if target:is_static() then
os.mv(path.join("$(projectdir)", target:targetdir(), "*.a"), lib_dir)
else
os.mv(path.join("$(projectdir)", target:targetdir(), "*.so"), lib_dir)
end
end)
target("wfkafka")
if has_config("kafka") then
set_kind("$(kind)")
add_deps("kafka_client", "kafka_factory", "kafka_protocol", "kafka_util", "workflow")
else
set_kind("phony")
end
after_clean(function (target)
os.rm(get_config("workflow_inc"))
os.rm(get_config("workflow_lib"))
os.rm("$(buildir)")
end)
on_install(function (target)
os.cp(path.join(get_config("workflow_inc"), "workflow"), path.join(target:installdir(), "include"))
if target:is_static() then
os.cp(path.join(get_config("workflow_lib"), "*.a"), path.join(target:installdir(), "lib"))
else
os.cp(path.join(get_config("workflow_lib"), "*.so"), path.join(target:installdir(), "lib"))
end
end)

View File

@@ -30,5 +30,11 @@ set_config("buildir", "build.xmake")
add_cflags("-fPIC", "-pipe")
add_cxxflags("-fPIC", "-pipe", "-Wno-invalid-offsetof")
after_clean(function (target)
os.rm(get_config("workflow_inc"))
os.rm(get_config("workflow_lib"))
os.rm("$(buildir)")
end)
includes("src", "test", "benchmark", "tutorial")