diff options
| author | ruki <[email protected]> | 2022-10-12 23:45:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-12 23:45:45 +0800 |
| commit | ac02e394a0d68a461e615c017ef3a9776d7e5407 (patch) | |
| tree | 35c869478413b5ae843bd547142018d2d95a1877 | |
| parent | 343db2cf17ec4449d886ebf588215e853f1beb7b (diff) | |
support arm64 for tools/cmake
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index cda883daf..a41533d7f 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -112,6 +112,16 @@ function _get_msvc_runenvs(package) return os.joinenvs(_get_msvc(package):runenvs()) end +-- get vs arch +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:startswith('arm64') then return "ARM64" end + if arch:startswith('arm') then return "ARM" end + return arch +end + -- get cflags from package deps function _get_cflags_from_packagedeps(package, opt) local result = {} @@ -728,7 +738,7 @@ function _build_for_msvc(package, configs, opt) os.vrunv(msbuild.program, {slnfile, "-nologo", "-t:Rebuild", (jobs ~= nil and format("-m:%d", jobs) or "-m"), "-p:Configuration=" .. (package:is_debug() and "Debug" or "Release"), - "-p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32")}, {envs = runenvs}) + "-p:Platform=" .. _get_vsarch(package)}, {envs = runenvs}) end -- do build for make @@ -793,7 +803,7 @@ function _install_for_msvc(package, configs, opt) os.vrunv(msbuild.program, {slnfile, "-nologo", "-t:Rebuild", "/nr:false", (jobs ~= nil and format("-m:%d", jobs) or "-m"), "-p:Configuration=" .. (package:is_debug() and "Debug" or "Release"), - "-p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32")}, {envs = runenvs}) + "-p:Platform=" .. _get_vsarch(package)}, {envs = runenvs}) local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj" if os.isfile(projfile) then os.vrunv(msbuild.program, {projfile, "/property:configuration=" .. (package:is_debug() and "Debug" or "Release")}, {envs = runenvs}) |
