diff options
| author | ruki <[email protected]> | 2024-07-08 23:01:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-07-08 23:01:53 +0800 |
| commit | c14fe608eff79051422ff32250f87a1e4f6cd597 (patch) | |
| tree | 6904be2845d486a2104a7766addcf9866d08a9f3 | |
| parent | 8a9a8a2bee6db0730d6e376e0114a3430ceba063 (diff) | |
fix vs arch
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/action/trybuild/cmake.lua | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 735d2fe48..d2fa362c6 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -102,8 +102,8 @@ function _get_vsarch(package) local arch = package:arch() if arch == "x86" or arch == "i386" then return "Win32" end if arch == "x86_64" then return "x64" end + if arch == "arm64ec" then return "ARM64EC" end if arch:startswith("arm64") then return "ARM64" end - if arch:startswith("arm64ec") then return "ARM64EC" end if arch:startswith("arm") then return "ARM" end return arch end diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua index c976e4bd5..747ab9c94 100644 --- a/xmake/modules/private/action/trybuild/cmake.lua +++ b/xmake/modules/private/action/trybuild/cmake.lua @@ -49,6 +49,17 @@ function _get_buildenv(key) return value end +-- get vs arch +function _get_vsarch() + local arch = get_config("arch") or os.arch() + if arch == "x86" or arch == "i386" then return "Win32" end + if arch == "x86_64" then return "x64" end + if arch == "arm64ec" then return "ARM64EC" end + if arch:startswith("arm64") then return "ARM64" end + if arch:startswith("arm") then return "ARM" end + return arch +end + -- get msvc function _get_msvc() local msvc = toolchain.load("msvc") @@ -456,7 +467,9 @@ function _build_for_msvc(opt) local runenvs = _get_msvc_runenvs() local msbuild = find_tool("msbuild", {envs = runenvs}) local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!") - os.vexecv(msbuild.program, {slnfile, "-nologo", "-t:Build", "-m", "-p:Configuration=" .. (is_mode("debug") and "Debug" or "Release"), "-p:Platform=" .. (is_arch("x64") and "x64" or "Win32")}, {envs = runenvs}) + os.vexecv(msbuild.program, {slnfile, "-nologo", "-t:Build", "-m", + "-p:Configuration=" .. (is_mode("debug") and "Debug" or "Release"), + "-p:Platform=" .. _get_vsarch()}, {envs = runenvs}) local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj" if os.isfile(projfile) then os.vexecv(msbuild.program, {projfile, "/property:configuration=" .. (is_mode("debug") and "Debug" or "Release")}, {envs = runenvs}) |
