From c1dcbe82c7f5eadcb167bd152d202cad4afef7a4 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 4 Jan 2023 23:03:03 +0800 Subject: improve arch for masm32 --- tests/projects/asm/masm32/xmake.lua | 1 - xmake/core/tool/toolchain.lua | 14 ++++++++++++-- xmake/toolchains/masm32/xmake.lua | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/projects/asm/masm32/xmake.lua b/tests/projects/asm/masm32/xmake.lua index 64f0f00b5..ba0f6d920 100644 --- a/tests/projects/asm/masm32/xmake.lua +++ b/tests/projects/asm/masm32/xmake.lua @@ -4,4 +4,3 @@ target("test") add_files("src/*.asm") add_files("src/*.rc") set_toolchains("masm32") - add_syslinks("user32", "kernel32") diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index 0ee62b34e..66321dfa4 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -69,12 +69,22 @@ end -- get toolchain platform function _instance:plat() - return self:config("plat") + return self._PLAT or self:config("plat") +end + +-- set toolchain platform +function _instance:plat_set(plat) + self._PLAT = plat end -- get toolchain architecture function _instance:arch() - return self:config("arch") + return self._ARCH or self:config("arch") +end + +-- set toolchain architecture +function _instance:arch_set(arch) + self._ARCH = arch end -- the current platform is belong to the given platforms? diff --git a/xmake/toolchains/masm32/xmake.lua b/xmake/toolchains/masm32/xmake.lua index f4cba74af..b654d8087 100644 --- a/xmake/toolchains/masm32/xmake.lua +++ b/xmake/toolchains/masm32/xmake.lua @@ -42,10 +42,12 @@ toolchain("masm32") end) on_load(function (toolchain) + toolchain:arch_set("x86") local sdkdir = toolchain:sdkdir() if sdkdir then toolchain:add("includedirs", path.join(sdkdir, "include")) toolchain:add("linkdirs", path.join(sdkdir, "lib")) end toolchain:add("asflags", "/coff") + toolchain:add("syslinks", "user32", "kernel32") end) -- cgit v1.3.1