summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-05-17 00:42:04 +0800
committerruki <[email protected]>2018-05-16 22:12:28 +0800
commit4e9bcf218d167b0efa875625f0b75f1e88c9f9b7 (patch)
tree825c15a075508157dbd81c5ded6f9e3679dd05bc
parent9275981ad07841dad83f07235339efc06dd40af8 (diff)
improve wdk rules
-rw-r--r--tests/projects/wdk/umdf/skeleton/xmake.lua6
-rw-r--r--xmake/rules/wdk/env/xmake.lua5
-rw-r--r--xmake/rules/wdk/inf/xmake.lua5
-rw-r--r--xmake/rules/wdk/load.lua12
-rw-r--r--xmake/rules/wdk/man/xmake.lua5
-rw-r--r--xmake/rules/wdk/mc/xmake.lua5
-rw-r--r--xmake/rules/wdk/mof/xmake.lua10
7 files changed, 42 insertions, 6 deletions
diff --git a/tests/projects/wdk/umdf/skeleton/xmake.lua b/tests/projects/wdk/umdf/skeleton/xmake.lua
index 6bfa00aca..f4ff33c46 100644
--- a/tests/projects/wdk/umdf/skeleton/xmake.lua
+++ b/tests/projects/wdk/umdf/skeleton/xmake.lua
@@ -25,5 +25,9 @@ target("skeleton")
add_shflags("/DEF:exports.def", {force = true})
-- set entry
- add_shflags("/ENTRY:_DllMainCRTStartup", {force = true})
+ if is_arch("x64") then
+ add_shflags("/ENTRY:_DllMainCRTStartup", {force = true})
+ else
+ add_shflags("/ENTRY:_DllMainCRTStartup@12", {force = true})
+ end
diff --git a/xmake/rules/wdk/env/xmake.lua b/xmake/rules/wdk/env/xmake.lua
index c0b98cff0..9e192cd41 100644
--- a/xmake/rules/wdk/env/xmake.lua
+++ b/xmake/rules/wdk/env/xmake.lua
@@ -49,6 +49,11 @@ rule("wdk.env")
wdk.kmdfver = kmdfver
end
+ -- add defines for debug
+ if is_mode("debug") then
+ target:add("define", "DBG=1")
+ end
+
-- save wdk
target:data_set("wdk", wdk)
end
diff --git a/xmake/rules/wdk/inf/xmake.lua b/xmake/rules/wdk/inf/xmake.lua
index 3052ec275..83d46db8e 100644
--- a/xmake/rules/wdk/inf/xmake.lua
+++ b/xmake/rules/wdk/inf/xmake.lua
@@ -39,9 +39,12 @@ rule("wdk.inf")
-- get arch
local arch = assert(config.arch(), "arch not found!")
+
+ -- get wdk
+ local wdk = target:data("wdk")
-- get stampinf
- local stampinf = path.join(target:data("wdk").bindir, arch, is_host("windows") and "stampinf.exe" or "stampinf")
+ local stampinf = path.join(wdk.bindir, wdk.sdkver, arch, is_host("windows") and "stampinf.exe" or "stampinf")
assert(stampinf and os.isexec(stampinf), "stampinf not found!")
-- save uic
diff --git a/xmake/rules/wdk/load.lua b/xmake/rules/wdk/load.lua
index b8cbcfc01..13ad92ae5 100644
--- a/xmake/rules/wdk/load.lua
+++ b/xmake/rules/wdk/load.lua
@@ -39,6 +39,9 @@ function umdf_driver(target)
local umdfver = wdk.umdfver:split('%.')
if arch == "x64" then
target:add("defines", "_WIN64", "_AMD64_", "AMD64")
+ else
+ target:add("defines", "_X86_=1", "i386=1", "STD_CALL")
+ target:add("defines", "DEPRECATE_DDK_FUNCTIONS=1", "MSC_NOOPT", "_ATL_NO_WIN_SUPPORT", "_WINDLL")
end
target:add("defines", "UMDF_VERSION_MAJOR=" .. umdfver[1], "UMDF_VERSION_MINOR=" .. umdfver[2], "UMDF_USING_NTSTATUS")
target:add("defines", "WIN32_LEAN_AND_MEAN=1", "_WIN32_WINNT=0x0A00", "WINVER=0x0A00", "WINNT=1", "NTDDI_VERSION=0x0A000004", "_WINDLL")
@@ -56,7 +59,7 @@ function umdf_driver(target)
target:add("shflags", "-NODEFAULTLIB:kernel32.lib", "-NODEFAULTLIB:user32.lib", "-NODEFAULTLIB:libucrt.lib", {force = true})
-- set subsystem: windows, TODO 10.00
- target:add("shflags", "-subsystem:windows,10.00", {force = true})
+ target:add("shflags", "-subsystem:windows,10.00", "-MACHINE:X86", {force = true})
-- set default driver entry if does not exist
local entry = false
@@ -85,6 +88,9 @@ function umdf_binary(target)
local arch = config.arch()
if arch == "x64" then
target:add("defines", "_WIN64", "_AMD64_", "AMD64")
+ else
+ target:add("defines", "_X86_=1", "i386=1", "STD_CALL")
+ target:add("defines", "_ATL_NO_WIN_SUPPORT", "_CRT_USE_WINAPI_PARTITION_APP")
end
target:add("defines", "WIN32_LEAN_AND_MEAN=1", "_WIN32_WINNT=0x0A00", "WINVER=0x0A00", "WINNT=1", "NTDDI_VERSION=0x0A000004", "_WINDLL")
@@ -118,6 +124,8 @@ function kmdf_driver(target)
local kmdfver = wdk.kmdfver:split('%.')
if arch == "x64" then
target:add("defines", "_WIN64", "_AMD64_", "AMD64")
+ else
+ target:add("defines", "_X86_=1", "i386=1", "STD_CALL")
end
target:add("defines", "WIN32_LEAN_AND_MEAN=1", "_WIN32_WINNT=0x0A00", "WINVER=0x0A00", "WINNT=1", "NTDDI_VERSION=0x0A000004", "_WINDLL")
target:add("defines", "KMDF_VERSION_MAJOR=" .. kmdfver[1], "KMDF_VERSION_MINOR=" .. kmdfver[2], "KMDF_USING_NTSTATUS")
@@ -169,6 +177,8 @@ function kmdf_binary(target)
local kmdfver = wdk.kmdfver:split('%.')
if arch == "x64" then
target:add("defines", "_WIN64", "_AMD64_", "AMD64")
+ else
+ target:add("defines", "_X86_=1", "i386=1", "STD_CALL")
end
target:add("defines", "WIN32_LEAN_AND_MEAN=1", "_WIN32_WINNT=0x0A00", "WINVER=0x0A00", "WINNT=1", "NTDDI_VERSION=0x0A000004", "_WINDLL")
target:add("defines", "KMDF_VERSION_MAJOR=" .. kmdfver[1], "KMDF_VERSION_MINOR=" .. kmdfver[2])
diff --git a/xmake/rules/wdk/man/xmake.lua b/xmake/rules/wdk/man/xmake.lua
index 8158fa610..36dd181ba 100644
--- a/xmake/rules/wdk/man/xmake.lua
+++ b/xmake/rules/wdk/man/xmake.lua
@@ -39,9 +39,12 @@ rule("wdk.man")
-- get arch
local arch = assert(config.arch(), "arch not found!")
+
+ -- get wdk
+ local wdk = target:data("wdk")
-- get ctrpp
- local ctrpp = path.join(target:data("wdk").bindir, arch, is_host("windows") and "ctrpp.exe" or "ctrpp")
+ local ctrpp = path.join(wdk.bindir, arch, is_host("windows") and "ctrpp.exe" or "ctrpp")
assert(ctrpp and os.isexec(ctrpp), "ctrpp not found!")
-- save ctrpp
diff --git a/xmake/rules/wdk/mc/xmake.lua b/xmake/rules/wdk/mc/xmake.lua
index 7f517e167..cf81e2d5b 100644
--- a/xmake/rules/wdk/mc/xmake.lua
+++ b/xmake/rules/wdk/mc/xmake.lua
@@ -39,9 +39,12 @@ rule("wdk.mc")
-- get arch
local arch = assert(config.arch(), "arch not found!")
+
+ -- get wdk
+ local wdk = target:data("wdk")
-- get mc
- local mc = path.join(target:data("wdk").bindir, arch, is_host("windows") and "mc.exe" or "mc")
+ local mc = path.join(wdk.bindir, arch, is_host("windows") and "mc.exe" or "mc")
assert(mc and os.isexec(mc), "mc not found!")
-- save mc
diff --git a/xmake/rules/wdk/mof/xmake.lua b/xmake/rules/wdk/mof/xmake.lua
index 422f875f8..af8459392 100644
--- a/xmake/rules/wdk/mof/xmake.lua
+++ b/xmake/rules/wdk/mof/xmake.lua
@@ -41,6 +41,9 @@ rule("wdk.mof")
-- get arch
local arch = assert(config.arch(), "arch not found!")
+ -- get wdk
+ local wdk = target:data("wdk")
+
-- get mofcomp
local mofcomp = find_program("mofcomp", {check = function (program)
local tmpmof = os.tmpfile()
@@ -51,7 +54,12 @@ rule("wdk.mof")
assert(mofcomp, "mofcomp not found!")
-- get wmimofck
- local wmimofck = path.join(target:data("wdk").bindir, "x86", arch, is_host("windows") and "wmimofck.exe" or "wmimofck")
+ local wmimofck = nil
+ if arch == "x64" then
+ wmimofck = path.join(wdk.bindir, wdk.sdkver, "x86", "x64", is_host("windows") and "wmimofck.exe" or "wmimofck")
+ else
+ wmimofck = path.join(wdk.bindir, wdk.sdkver, "x86", is_host("windows") and "wmimofck.exe" or "wmimofck")
+ end
assert(wmimofck and os.isexec(wmimofck), "wmimofck not found!")
-- save mofcomp and wmimofck