Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/vstudio/_preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@
}

p.api.addAllowed("system", p.ANDROID)
p.api.addAllowed("architecture", { "armv5", "armv7", "aarch64", "mips", "mips64", "arm" })
p.api.addAllowed("architecture", { "armv5", "armv7", "mips", "mips64" })
p.api.addAllowed("vectorextensions", { "NEON", "MXU" })
p.api.addAllowed("exceptionhandling", {"UnwindTables"})
p.api.addAllowed("kind", p.PACKAGING)
Expand Down
7 changes: 3 additions & 4 deletions modules/vstudio/vs2010_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3033,8 +3033,7 @@
if cfg.system == p.WINDOWS then
if cfg.architecture == p.ARM then
p.w('<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>')
end
if cfg.architecture == p.ARM64 then
elseif cfg.architecture == p.AARCH64 then
p.w('<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>')
end
end
Expand Down Expand Up @@ -4349,10 +4348,10 @@

if (cfg.architecture ~= nil or cfg.toolchainversion ~= nil) and archMap[arch] ~= nil then
local defaultToolsetMap = {
arm = "arm-linux-androideabi-",
[ p.ARM ] = "arm-linux-androideabi-",
armv5 = "arm-linux-androideabi-",
armv7 = "arm-linux-androideabi-",
aarch64 = "aarch64-linux-android-",
[ p.AARCH64 ] = "aarch64-linux-android-",
mips = "mipsel-linux-android-",
mips64 = "mips64el-linux-android-",
x86 = "x86-",
Expand Down
10 changes: 5 additions & 5 deletions modules/vstudio/vstudio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

vstudio.vs200x_architectures =
{
win32 = "x86",
x86 = "x86",
x86_64 = "x64",
ARM = "ARM",
ARM64 = "ARM64",
win32 = "x86",
x86 = "x86",
x86_64 = "x64",
ARM = "ARM",
AARCH64 = "ARM64",
}

vstudio.vs2010_architectures =
Expand Down
7 changes: 4 additions & 3 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
description = "Set the architecture of the binary to be built.",
allowed = {
{ "ARM", "ARM (On macOS, same as ARM64.)" },
{ "ARM64", "ARM64" },
{ "AARCH64", "AARCH64" },
{ "x86", "x86 (On macOS, same as x86_64.)" },
{ "x86_64", "x86_64" },
{ "ppc", "PowerPC 32-bit" },
Expand All @@ -178,6 +178,7 @@
--
{ "Win32", "Same as x86" },
{ "x64", "Same as x86_64" },
{ "ARM64", "Same as AARCH64" },
},
-- "Generates default platforms for targets, x86 and x86_64 projects for Windows." }
default = nil,
Expand Down Expand Up @@ -235,7 +236,7 @@
filter { "options:lua-src=contrib" }
defines { "LUA_STATICLIB" }

filter { "system:macosx", "options:arch=ARM or arch=ARM64" }
filter { "system:macosx", "options:arch=ARM or arch=AARCH64" }
buildoptions { "-arch arm64" }
linkoptions { "-arch arm64" }

Expand All @@ -258,7 +259,7 @@
filter { "system:windows", "options:arch=ARM" }
platforms { "ARM" }

filter { "system:windows", "options:arch=ARM64" }
filter { "system:windows", "options:arch=AARCH64" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't those filters check both ARM64 or AARCH64?(as there are the "same").

platforms { "ARM64" }

filter { "system:windows", "options:arch=x86 or arch=Win32" }
Expand Down
14 changes: 9 additions & 5 deletions src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
p.X86,
p.X86_64,
p.ARM,
p.ARM64,
p.AARCH64,
p.RISCV64,
p.LOONGARCH64,
p.PPC,
Expand All @@ -38,13 +38,17 @@
p.MIPS64EL
},
aliases = {
i386 = p.X86,
amd64 = p.X86_64,
x32 = p.X86, -- these should be DEPRECATED
x64 = p.X86_64,
i386 = p.X86,
amd64 = p.X86_64,
x32 = p.X86,
x64 = p.X86_64,
ARM64 = p.AARCH64,
},
}

api.deprecateAlias("architecture", "i386", "Use 'x86' instead with `buildoptions { '-march=i386' }`.")
api.deprecateAlias("architecture", "x32", "Use 'x86' instead. There is no x32 ABI support currently.")

api.register {
name = "basedir",
scope = "project",
Expand Down
2 changes: 1 addition & 1 deletion src/base/_foundation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
premake.X86 = "x86"
premake.X86_64 = "x86_64"
premake.ARM = "ARM"
premake.ARM64 = "ARM64"
premake.AARCH64 = "AARCH64"
premake.RISCV64 = "RISCV64"
premake.LOONGARCH64 = "loongarch64"
premake.PPC = "ppc"
Expand Down
43 changes: 43 additions & 0 deletions src/base/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,37 @@
end


--
-- Mark a specific alias value of a field as deprecated.
--
-- @param name
-- The name of the field containing the alias.
-- @param alias
-- The alias or aliases to mark as deprecated. May be a string
-- for a single alias or an array of multiple aliases.
-- @param message
-- A optional message providing more information, to be shown
-- as part of the deprecation warning message.
--

function api.deprecateAlias(name, alias, message)
if type(alias) == "table" then
for _, a in pairs(alias) do
api.deprecateAlias(name, a, message)
end
else
local field = p.fields[name]
field.deprecatedaliases = field.deprecatedaliases or {}
local actual = field.aliases[alias:lower()]
if actual then
field.deprecatedaliases[alias] = {
message = message
}
end
end
end


--
-- Control the handling of API deprecations.
--
Expand Down Expand Up @@ -648,6 +679,18 @@
local canonical, result
local lowerValue = value:lower()

if field.deprecatedaliases and field.deprecatedaliases[lowerValue] then
local handler = field.deprecatedaliases[lowerValue]
if handler.message and api._deprecations ~= "off" then
local caller = filelineinfo(9)
local key = field.name .. "_" .. value .. "_" .. caller
p.warnOnce(key, "the %s alias %s has been deprecated and will be removed.\n %s\n @%s\n", field.name, lowerValue, handler.message, caller)
if api._deprecations == "error" then
return nil, "deprecation errors enabled"
end
end
end

if field.aliases then
canonical = field.aliases[lowerValue]
end
Expand Down
4 changes: 2 additions & 2 deletions src/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
architecture = {
x86 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch i386", "-m32") end,
x86_64 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch x86_64", "-m64") end,
ARM64 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch arm64", nil) end,
AARCH64 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch arm64", nil) end,
},
fatalwarnings = {
All = "-Werror",
Expand Down Expand Up @@ -504,7 +504,7 @@
architecture = {
x86 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch i386", "-m32") end,
x86_64 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch x86_64", "-m64") end,
ARM64 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch arm64", nil) end,
AARCH64 = function (cfg) return iif(cfg.system == p.MACOSX, "-arch arm64", nil) end,
},
linkerfatalwarnings = {
All = "-Wl,--fatal-warnings",
Expand Down
2 changes: 1 addition & 1 deletion tests/base/test_os.lua
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,6 @@ function suite.targetarch()
test.isequal(_TARGET_ARCH, os.targetarch())

-- --arch has priority over _TARGET_ARCH
_OPTIONS["arch"] = "arm64"
_OPTIONS["arch"] = "AARCH64"
test.isequal(_OPTIONS["arch"], os.targetarch())
end
14 changes: 14 additions & 0 deletions tests/tools/test_clang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,27 @@ end
test.contains({ "-arch x86_64" }, clang.getldflags(cfg))
end

function suite.cflags_macosx_onAARCH64()
system "macosx"
architecture "AARCH64"
prepare()
test.contains({ "-arch arm64" }, clang.getcflags(cfg))
end

function suite.cflags_macosx_onarm64()
system "macosx"
architecture "arm64"
prepare()
test.contains({ "-arch arm64" }, clang.getcflags(cfg))
end

function suite.ldflags_macosx_onAARCH64()
system "macosx"
architecture "AARCH64"
prepare()
test.contains({ "-arch arm64" }, clang.getldflags(cfg))
end

function suite.ldflags_macosx_onarm64()
system "macosx"
architecture "arm64"
Expand Down
22 changes: 18 additions & 4 deletions tests/tools/test_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -644,16 +644,30 @@
test.contains({ "-arch x86_64" }, gcc.getldflags(cfg))
end

function suite.cflags_macosx_onarm64()
function suite.cflags_macosx_onAARCH64()
system "macosx"
architecture "arm64"
architecture "AARCH64"
prepare()
test.contains({ "-arch arm64" }, gcc.getcflags(cfg))
end

function suite.ldflags_macosx_onarm64()
function suite.cflags_macosx_onARM64()
system "macosx"
architecture "arm64"
architecture "ARM64"
prepare()
test.contains({ "-arch arm64" }, gcc.getcflags(cfg))
end

function suite.ldflags_macosx_onAARCH64()
system "macosx"
architecture "AARCH64"
prepare()
test.contains({ "-arch arm64" }, gcc.getldflags(cfg))
end

function suite.ldflags_macosx_onARM64()
system "macosx"
architecture "ARM64"
prepare()
test.contains({ "-arch arm64" }, gcc.getldflags(cfg))
end
Expand Down
10 changes: 5 additions & 5 deletions website/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ architecture ("value")
| x86 | x86 Architecture |
| x86_64 | x86_64 Architecture |
| ARM | 32-bit ARM Architecture |
| ARM64 | 64-bit ARM Architecture |
| AARCH64 | 64-bit ARM Architecture |
| RISCV64 | 64-bit RISCV Architecture |
| loongarch64 | 64-bit LoongArch Architecture |
| ppc | 32-bit PowerPC Architecture |
Expand All @@ -25,18 +25,18 @@ architecture ("value")
| mips64el | 64-bit MIPS (Little Endian) Architecture |
| armv5 | ARMv5 Architecture | Only supported in VSAndroid projects |
| armv7 | ARMv7 Architecture | Only supported in VSAndroid projects |
| aarch64 | 64-bit ARM Architecture | Only supported in VSAndroid projects |
| mips | 32-bit MIPS Architecture | Only supported in VSAndroid projects |
| mips64 | 64-bit MIPS Architecture | Only supported in VSAndroid projects |

Additional values that are aliases for the above:

| Value | Description |
|-------|-------------|
| i386 | Alias for `x86` |
| ARM64 | Alias for `AARCH64` |
| amd64 | Alias for `x86_64` |
| x32 | Alias for `x86`. There is intent to deprecate this |
| x64 | Alias for `x86_64`. There is intent to deprecate this |
| i386 | Alias for `x86` | Deprecated in Premake 5.0.0-beta8. Use `x86` with `buildoptions { '-march=i386' }`. |
| x32 | Alias for `x86`. | Deprecated in Premake 5.0.0-beta8. There is currently no support for `x32` ABI. |
| x64 | Alias for `x86_64`. |

### Applies To ###

Expand Down
Loading