summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-05-03 00:42:28 +0800
committerruki <[email protected]>2019-05-02 22:14:50 +0800
commit5ed784324f22c0c2d899a321341e0c1052fdef15 (patch)
tree34c1cd08edbc6dbbc7dd47dca3f2bc22550996b9
parente50041f92ef327b9b84bbdc40c3b80ac854f9512 (diff)
improve win.sdk.application rule
-rw-r--r--xmake/rules/winsdk/dotnet/xmake.lua15
-rw-r--r--xmake/rules/winsdk/xmake.lua11
2 files changed, 20 insertions, 6 deletions
diff --git a/xmake/rules/winsdk/dotnet/xmake.lua b/xmake/rules/winsdk/dotnet/xmake.lua
index 60c0eb854..176d0c005 100644
--- a/xmake/rules/winsdk/dotnet/xmake.lua
+++ b/xmake/rules/winsdk/dotnet/xmake.lua
@@ -47,6 +47,21 @@ rule("win.sdk.dotnet")
-- get dotnet
local dotnet = target:data("win.sdk.dotnet")
+ if not dotnet then
+
+ -- imports
+ import("core.project.config")
+ import("detect.sdks.find_dotnet")
+
+ -- find dotnet
+ dotnet = assert(find_dotnet(nil, {verbose = true}), "dotnet not found!")
+
+ -- add link directory
+ target:add("linkdirs", path.join(dotnet.libdir, "um", config.arch()))
+
+ -- save dotnet
+ target:data_set("win.sdk.dotnet", dotnet)
+ end
-- get file config
local fileconfig = target:fileconfig(sourcefile) or {}
diff --git a/xmake/rules/winsdk/xmake.lua b/xmake/rules/winsdk/xmake.lua
index f048520f9..d9b08efea 100644
--- a/xmake/rules/winsdk/xmake.lua
+++ b/xmake/rules/winsdk/xmake.lua
@@ -21,15 +21,14 @@
-- define rule: application
rule("win.sdk.application")
- -- add deps
- add_deps("win.sdk.dotnet")
+ -- before load
+ before_load(function (target)
+ target:set("kind", "binary")
+ end)
-- after load
after_load(function (target)
- -- set kind: binary
- target:set("kind", "binary")
-
-- set subsystem: windows
local subsystem = false
for _, ldflag in ipairs(target:get("ldflags")) do
@@ -47,4 +46,4 @@ rule("win.sdk.application")
target:add("links", "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32")
target:add("links", "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32", "comctl32")
target:add("links", "cfgmgr32", "comdlg32", "setupapi", "strsafe", "shlwapi")
- end) \ No newline at end of file
+ end)