summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-27 22:34:37 +0800
committerruki <[email protected]>2021-10-27 22:34:37 +0800
commitd76dfd89f4c32c51a7dc898f0f86320294df7dfb (patch)
tree5766341016e949410015b0dbe289c243ea588f0b
parentda63bca85fe3d05368556056a90498d784c47bae (diff)
improve ml/has_flags
-rw-r--r--xmake/modules/detect/tools/ml/has_flags.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/modules/detect/tools/ml/has_flags.lua b/xmake/modules/detect/tools/ml/has_flags.lua
index 53576fa22..0dbda2134 100644
--- a/xmake/modules/detect/tools/ml/has_flags.lua
+++ b/xmake/modules/detect/tools/ml/has_flags.lua
@@ -61,12 +61,21 @@ function _check_try_running(flags, opt)
-- make an stub source file
local sourcefile = path.join(os.tmpdir(), "detect", "ml_has_flags.asm")
if not os.isfile(sourcefile) then
- io.writefile(sourcefile, ".code\nend")
+ io.writefile(sourcefile, [[
+ifndef X64
+.686p
+.model flat, C
+endif
+.code
+end]])
end
-- check it
local errors = nil
return try { function ()
+ if opt.program:find("ml64", 1, true) then
+ table.insert(flags, "-DX64")
+ end
local _, errs = os.iorunv(opt.program, table.join("-c", "-nologo", flags, "-Fo" .. os.nuldev(), sourcefile), {envs = opt.envs})
if errs and #errs:trim() > 0 then
return false, errs