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
12 changes: 11 additions & 1 deletion modules/vstudio/_preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,17 @@
"3.5",
"3.6",
"3.8",
"5.0", })
"5.0",
})

p.api.deprecateField("toolchainversion", "Use `toolchain 'gcc-<version>'` or `toolchain 'clang-<version>'` instead.",
function(value)
if value == "4.6" or value == "4.8" or value == "4.9" then
toolset("gcc-" .. value)
elseif value == "3.4" or value == "3.5" or value == "3.6" or value == "3.8" or value == "5.0" then
toolset("clang-" .. value)
end
end)

p.api.register {
name = "floatabi",
Expand Down
2 changes: 2 additions & 0 deletions modules/vstudio/tests/_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ return {
"android/test_android_build_settings.lua",
"android/test_android_files.lua",
"android/test_android_project.lua",
"android/test_android_toolset.lua",

-- Linux projects
"linux/test_linux_files.lua",
"linux/test_linux_toolchains.lua",

-- Visual Studio 2026+ Solutions
"sln2026/test_configurations.lua",
Expand Down
229 changes: 229 additions & 0 deletions modules/vstudio/tests/android/test_android_toolset.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
--
-- tests/android/test_android_toolset.lua
-- Unit tests for Visual Studio Android toolset handling.
-- Author: Nick Clark
-- Copyright (c) 2026 Jess Perkins and the Premake project
--

local p = premake
local suite = test.declare("test_android_toolset")
local vc2010 = p.vstudio.vc2010


--
-- Setup
--

local wks, prj

function suite.setup()
p.action.set("vs2015")
system "android"
architecture "ARM"
wks, prj = test.createWorkspace()
end

local function prepareConfigProperties()
system "android"
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.configurationProperties(cfg)
end

--
-- Test Android GCC 4.6 toolchain mapping.
--

function suite.androidGcc46Toolchain()
toolset "gcc-4.6"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>GCC_4_6</PlatformToolset>
]]
end

function suite.androidGcc46ToolsetVersion()
toolset "gcc"
toolchainversion "4.6"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>GCC_4_6</PlatformToolset>
]]
end

--
-- Test Android GCC 4.8 toolchain mapping.
--

function suite.androidGcc48Toolchain()
toolset "gcc-4.8"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>GCC_4_8</PlatformToolset>
]]
end

function suite.androidGcc48ToolsetVersion()
toolset "gcc"
toolchainversion "4.8"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>GCC_4_8</PlatformToolset>
]]
end

--
-- Test Android GCC 4.9 toolchain mapping.
--

function suite.androidGcc49Toolchain()
toolset "gcc-4.9"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>GCC_4_9</PlatformToolset>
]]
end

function suite.androidGcc49ToolsetVersion()
toolset "gcc"
toolchainversion "4.9"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>GCC_4_9</PlatformToolset>
]]
end

--
-- Test Android Clang 3.4 toolchain mapping.
--
function suite.androidClang34Toolchain()
toolset "clang-3.4"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_4</PlatformToolset>
]]
end

function suite.androidClang34ToolsetVersion()
toolset "clang"
toolchainversion "3.4"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_4</PlatformToolset>
]]
end

--
-- Test Android Clang 3.5 toolchain mapping.
--

function suite.androidClang35Toolchain()
toolset "clang-3.5"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_5</PlatformToolset>
]]
end

function suite.androidClang35ToolsetVersion()
toolset "clang"
toolchainversion "3.5"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_5</PlatformToolset>
]]
end

--
-- Test Android Clang 3.6 toolchain mapping.
--

function suite.androidClang36Toolchain()
toolset "clang-3.6"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_6</PlatformToolset>
]]
end

function suite.androidClang36ToolsetVersion()
toolset "clang"
toolchainversion "3.6"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_6</PlatformToolset>
]]
end

--
-- Test Android Clang 3.8 toolchain mapping.
--

function suite.androidClang38Toolchain()
toolset "clang-3.8"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_8</PlatformToolset>
]]
end

function suite.androidClang38ToolsetVersion()
toolset "clang"
toolchainversion "3.8"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_3_8</PlatformToolset>
]]
end

--
-- Test Android Clang 5.0 toolchain mapping.
--

function suite.androidClang50Toolchain()
toolset "clang-5.0"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_5_0</PlatformToolset>
]]
end

function suite.androidClang50ToolsetVersion()
toolset "clang"
toolchainversion "5.0"
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>Clang_5_0</PlatformToolset>
]]
end
6 changes: 4 additions & 2 deletions modules/vstudio/tests/linux/test_linux_files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ local vc2010 = p.vstudio.vc2010

function suite.linkTimeOptimization_On()
linktimeoptimization('on')
toolset('gcc-remote')
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess the flexibility of this approach is that if there is ever a Remote_GCC_1_1 we can always extend this to gcc-remote-1.1 or whatever

prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>Remote_GCC_1_0</PlatformToolset>
<LinkTimeOptimization>true</LinkTimeOptimization>
</PropertyGroup>
]]
Expand All @@ -48,11 +49,12 @@ local vc2010 = p.vstudio.vc2010

function suite.linkTimeOptimization_Fast()
linktimeoptimization('fast')
toolset('gcc-remote')
prepareConfigProperties()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>Remote_GCC_1_0</PlatformToolset>
<LinkTimeOptimization>true</LinkTimeOptimization>
</PropertyGroup>
]]
Expand Down
Loading
Loading