-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1138 from waruqi/master
Improve xmake.lua
- Loading branch information
Showing
17 changed files
with
94 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,8 @@ bazel-* | |
.idea | ||
cmake-build-debug/ | ||
workflow-config.cmake | ||
|
||
# xmake configs | ||
.xmake | ||
build.xmake | ||
_include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
target("factory") | ||
add_files("*.cc") | ||
set_kind("object") | ||
if (get_config("mysql") == false) then | ||
if not has_config("mysql") then | ||
remove_files("MySQLTaskImpl.cc") | ||
end | ||
if (get_config("redis") == false) then | ||
if not has_config("redis") then | ||
remove_files("RedisTaskImpl.cc") | ||
end | ||
remove_files("KafkaTaskImpl.cc") | ||
|
||
target("kafka_factory") | ||
if (get_config("kafka") == true) then | ||
if has_config("kafka") then | ||
add_files("KafkaTaskImpl.cc") | ||
set_kind("object") | ||
add_cxxflags("-fno-rtti") | ||
add_deps("factory") | ||
add_packages("zlib", "snappy", "zstd", "lz4") | ||
else | ||
set_kind("phony") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
target("manager") | ||
add_files("*.cc") | ||
set_kind("object") | ||
if (get_config("upstrem") == false) then | ||
if not has_config("upstrem") then | ||
remove_files("UpstreamManager.cc") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
target("nameservice") | ||
add_files("*.cc") | ||
set_kind("object") | ||
if (get_config("upstrem") == false) then | ||
if not has_config("upstrem") then | ||
remove_files("WFServiceGovernance.cc", "UpstreamPolicies.cc") | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
target("server") | ||
set_kind("object") | ||
add_files("*.cc") | ||
if (get_config("mysql") == false) then | ||
if not has_config("mysql") then | ||
remove_files("WFMySQLServer.cc") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,51 @@ | ||
includes("**/xmake.lua") | ||
|
||
target("workflow") | ||
if (get_config("type") == "static") then | ||
set_kind("static") | ||
else | ||
set_kind("shared") | ||
end | ||
set_kind("$(kind)") | ||
add_deps("algorithm", "client", "factory", "kernel", "manager", | ||
"nameservice", "protocol", "server", "util") | ||
|
||
target("wfkafka") | ||
if (get_config("kafka") == true) then | ||
if (get_config("type") == "static") then | ||
set_kind("static") | ||
else | ||
set_kind("shared") | ||
end | ||
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 | ||
os.mkdir(include_path) | ||
end | ||
on_load(function (package) | ||
local include_path = path.join(get_config("workflow_inc"), "workflow") | ||
if (not os.isdir(include_path)) then | ||
os.mkdir(include_path) | ||
end | ||
|
||
os.cp(path.join("$(projectdir)", "src/**.h"), include_path) | ||
os.cp(path.join("$(projectdir)", "src/**.inl"), include_path) | ||
end) | ||
os.cp(path.join("$(projectdir)", "src/**.h"), include_path) | ||
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 (get_config("type") == "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) | ||
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) | ||
|
||
after_clean(function (target) | ||
os.rm(get_config("workflow_inc")) | ||
os.rm(get_config("workflow_lib")) | ||
os.rm("$(buildir)") | ||
end) | ||
after_clean(function (target) | ||
os.rm(get_config("workflow_inc")) | ||
os.rm(get_config("workflow_lib")) | ||
os.rm("$(buildir)") | ||
end) | ||
|
||
on_install(function (package) | ||
os.cp(path.join(get_config("workflow_inc"), "workflow"), path.join(package:installdir(), "include")) | ||
if (get_config("type") == "static") then | ||
os.cp(path.join(get_config("workflow_lib"), "*.a"), path.join(package:installdir(), "lib")) | ||
else | ||
os.cp(path.join(get_config("workflow_lib"), "*.so"), path.join(package:installdir(), "lib")) | ||
end | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.