|
| 1 | +-- |
| 2 | +-- tests/android/test_android_toolset.lua |
| 3 | +-- Unit tests for Visual Studio Android toolset handling. |
| 4 | +-- Author: Nick Clark |
| 5 | +-- Copyright (c) 2026 Jess Perkins and the Premake project |
| 6 | +-- |
| 7 | + |
| 8 | +local p = premake |
| 9 | +local suite = test.declare("test_android_toolset") |
| 10 | +local vc2010 = p.vstudio.vc2010 |
| 11 | + |
| 12 | + |
| 13 | +-- |
| 14 | +-- Setup |
| 15 | +-- |
| 16 | + |
| 17 | + local wks, prj |
| 18 | + |
| 19 | + function suite.setup() |
| 20 | + p.action.set("vs2015") |
| 21 | + system "android" |
| 22 | + architecture "ARM" |
| 23 | + wks, prj = test.createWorkspace() |
| 24 | + end |
| 25 | + |
| 26 | + local function prepareConfigProperties() |
| 27 | + system "android" |
| 28 | + local cfg = test.getconfig(prj, "Debug", platform) |
| 29 | + vc2010.configurationProperties(cfg) |
| 30 | + end |
| 31 | + |
| 32 | +-- |
| 33 | +-- Test Android GCC 4.6 toolchain mapping. |
| 34 | +-- |
| 35 | + |
| 36 | + function suite.androidGcc46Toolchain() |
| 37 | + toolset "gcc-4.6" |
| 38 | + prepareConfigProperties() |
| 39 | + test.capture [[ |
| 40 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 41 | + <ConfigurationType>Application</ConfigurationType> |
| 42 | + <PlatformToolset>GCC_4_6</PlatformToolset> |
| 43 | + ]] |
| 44 | + end |
| 45 | + |
| 46 | + function suite.androidGcc46ToolsetVersion() |
| 47 | + toolset "gcc" |
| 48 | + toolchainversion "4.6" |
| 49 | + prepareConfigProperties() |
| 50 | + test.capture [[ |
| 51 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 52 | + <ConfigurationType>Application</ConfigurationType> |
| 53 | + <PlatformToolset>GCC_4_6</PlatformToolset> |
| 54 | + ]] |
| 55 | + end |
| 56 | + |
| 57 | +-- |
| 58 | +-- Test Android GCC 4.8 toolchain mapping. |
| 59 | +-- |
| 60 | + |
| 61 | + function suite.androidGcc48Toolchain() |
| 62 | + toolset "gcc-4.8" |
| 63 | + prepareConfigProperties() |
| 64 | + test.capture [[ |
| 65 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 66 | + <ConfigurationType>Application</ConfigurationType> |
| 67 | + <PlatformToolset>GCC_4_8</PlatformToolset> |
| 68 | + ]] |
| 69 | + end |
| 70 | + |
| 71 | + function suite.androidGcc48ToolsetVersion() |
| 72 | + toolset "gcc" |
| 73 | + toolchainversion "4.8" |
| 74 | + prepareConfigProperties() |
| 75 | + test.capture [[ |
| 76 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 77 | + <ConfigurationType>Application</ConfigurationType> |
| 78 | + <PlatformToolset>GCC_4_8</PlatformToolset> |
| 79 | + ]] |
| 80 | + end |
| 81 | + |
| 82 | +-- |
| 83 | +-- Test Android GCC 4.9 toolchain mapping. |
| 84 | +-- |
| 85 | + |
| 86 | + function suite.androidGcc49Toolchain() |
| 87 | + toolset "gcc-4.9" |
| 88 | + prepareConfigProperties() |
| 89 | + test.capture [[ |
| 90 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 91 | + <ConfigurationType>Application</ConfigurationType> |
| 92 | + <PlatformToolset>GCC_4_9</PlatformToolset> |
| 93 | + ]] |
| 94 | + end |
| 95 | + |
| 96 | + function suite.androidGcc49ToolsetVersion() |
| 97 | + toolset "gcc" |
| 98 | + toolchainversion "4.9" |
| 99 | + prepareConfigProperties() |
| 100 | + test.capture [[ |
| 101 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 102 | + <ConfigurationType>Application</ConfigurationType> |
| 103 | + <PlatformToolset>GCC_4_9</PlatformToolset> |
| 104 | + ]] |
| 105 | + end |
| 106 | + |
| 107 | +-- |
| 108 | +-- Test Android Clang 3.4 toolchain mapping. |
| 109 | +-- |
| 110 | + function suite.androidClang34Toolchain() |
| 111 | + toolset "clang-3.4" |
| 112 | + prepareConfigProperties() |
| 113 | + test.capture [[ |
| 114 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 115 | + <ConfigurationType>Application</ConfigurationType> |
| 116 | + <PlatformToolset>Clang_3_4</PlatformToolset> |
| 117 | + ]] |
| 118 | + end |
| 119 | + |
| 120 | + function suite.androidClang34ToolsetVersion() |
| 121 | + toolset "clang" |
| 122 | + toolchainversion "3.4" |
| 123 | + prepareConfigProperties() |
| 124 | + test.capture [[ |
| 125 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 126 | + <ConfigurationType>Application</ConfigurationType> |
| 127 | + <PlatformToolset>Clang_3_4</PlatformToolset> |
| 128 | + ]] |
| 129 | + end |
| 130 | + |
| 131 | +-- |
| 132 | +-- Test Android Clang 3.5 toolchain mapping. |
| 133 | +-- |
| 134 | + |
| 135 | + function suite.androidClang35Toolchain() |
| 136 | + toolset "clang-3.5" |
| 137 | + prepareConfigProperties() |
| 138 | + test.capture [[ |
| 139 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 140 | + <ConfigurationType>Application</ConfigurationType> |
| 141 | + <PlatformToolset>Clang_3_5</PlatformToolset> |
| 142 | + ]] |
| 143 | + end |
| 144 | + |
| 145 | + function suite.androidClang35ToolsetVersion() |
| 146 | + toolset "clang" |
| 147 | + toolchainversion "3.5" |
| 148 | + prepareConfigProperties() |
| 149 | + test.capture [[ |
| 150 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 151 | + <ConfigurationType>Application</ConfigurationType> |
| 152 | + <PlatformToolset>Clang_3_5</PlatformToolset> |
| 153 | + ]] |
| 154 | + end |
| 155 | + |
| 156 | +-- |
| 157 | +-- Test Android Clang 3.6 toolchain mapping. |
| 158 | +-- |
| 159 | + |
| 160 | + function suite.androidClang36Toolchain() |
| 161 | + toolset "clang-3.6" |
| 162 | + prepareConfigProperties() |
| 163 | + test.capture [[ |
| 164 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 165 | + <ConfigurationType>Application</ConfigurationType> |
| 166 | + <PlatformToolset>Clang_3_6</PlatformToolset> |
| 167 | + ]] |
| 168 | + end |
| 169 | + |
| 170 | + function suite.androidClang36ToolsetVersion() |
| 171 | + toolset "clang" |
| 172 | + toolchainversion "3.6" |
| 173 | + prepareConfigProperties() |
| 174 | + test.capture [[ |
| 175 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 176 | + <ConfigurationType>Application</ConfigurationType> |
| 177 | + <PlatformToolset>Clang_3_6</PlatformToolset> |
| 178 | + ]] |
| 179 | + end |
| 180 | + |
| 181 | +-- |
| 182 | +-- Test Android Clang 3.8 toolchain mapping. |
| 183 | +-- |
| 184 | + |
| 185 | + function suite.androidClang38Toolchain() |
| 186 | + toolset "clang-3.8" |
| 187 | + prepareConfigProperties() |
| 188 | + test.capture [[ |
| 189 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 190 | + <ConfigurationType>Application</ConfigurationType> |
| 191 | + <PlatformToolset>Clang_3_8</PlatformToolset> |
| 192 | + ]] |
| 193 | + end |
| 194 | + |
| 195 | + function suite.androidClang38ToolsetVersion() |
| 196 | + toolset "clang" |
| 197 | + toolchainversion "3.8" |
| 198 | + prepareConfigProperties() |
| 199 | + test.capture [[ |
| 200 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 201 | + <ConfigurationType>Application</ConfigurationType> |
| 202 | + <PlatformToolset>Clang_3_8</PlatformToolset> |
| 203 | + ]] |
| 204 | + end |
| 205 | + |
| 206 | +-- |
| 207 | +-- Test Android Clang 5.0 toolchain mapping. |
| 208 | +-- |
| 209 | + |
| 210 | + function suite.androidClang50Toolchain() |
| 211 | + toolset "clang-5.0" |
| 212 | + prepareConfigProperties() |
| 213 | + test.capture [[ |
| 214 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 215 | + <ConfigurationType>Application</ConfigurationType> |
| 216 | + <PlatformToolset>Clang_5_0</PlatformToolset> |
| 217 | + ]] |
| 218 | + end |
| 219 | + |
| 220 | + function suite.androidClang50ToolsetVersion() |
| 221 | + toolset "clang" |
| 222 | + toolchainversion "5.0" |
| 223 | + prepareConfigProperties() |
| 224 | + test.capture [[ |
| 225 | +<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> |
| 226 | + <ConfigurationType>Application</ConfigurationType> |
| 227 | + <PlatformToolset>Clang_5_0</PlatformToolset> |
| 228 | + ]] |
| 229 | + end |
0 commit comments