|
1 | 1 | import Where, Exec from require "ice.tools.exec" |
2 | 2 |
|
3 | 3 | toolchain_definitions = { |
4 | | - '9.0.0': { |
| 4 | + '9': { |
5 | 5 | name: 'clang-9.0.0' |
6 | 6 | struct_name: 'Toolchain_Clang_x64_900' |
7 | 7 | compiler_name: 'compiler-clang-x64-900' |
@@ -31,7 +31,7 @@ toolchain_definitions = { |
31 | 31 | { 'ToolchainLibs', { } } |
32 | 32 | } |
33 | 33 | } |
34 | | - '10.0.0': { |
| 34 | + '10': { |
35 | 35 | name: 'clang-10.0.0' |
36 | 36 | struct_name: 'Toolchain_Clang_x64_1000' |
37 | 37 | compiler_name: 'compiler-clang-x64-1000' |
@@ -61,7 +61,7 @@ toolchain_definitions = { |
61 | 61 | { 'ToolchainLibs', { } } |
62 | 62 | } |
63 | 63 | } |
64 | | - '11.0.0': { |
| 64 | + '11': { |
65 | 65 | name: 'clang-11.0.0' |
66 | 66 | struct_name: 'Toolchain_Clang_x64_1100' |
67 | 67 | compiler_name: 'compiler-clang-x64-1100' |
@@ -91,7 +91,7 @@ toolchain_definitions = { |
91 | 91 | { 'ToolchainLibs', { } } |
92 | 92 | } |
93 | 93 | } |
94 | | - '12.0.0': { |
| 94 | + '12': { |
95 | 95 | name: 'clang-12.0.0' |
96 | 96 | struct_name: 'Toolchain_Clang_x64_1200' |
97 | 97 | compiler_name: 'compiler-clang-x64-1200' |
@@ -123,39 +123,39 @@ toolchain_definitions = { |
123 | 123 | } |
124 | 124 | } |
125 | 125 |
|
126 | | -detect_compilers = (ver_major) -> |
127 | | - binaries = { |
128 | | - '9': { |
129 | | - clang_path: Where\path 'clang++-9' |
130 | | - ar_path: Where\path 'ar' |
131 | | - }, |
132 | | - '10': { |
133 | | - clang_path: Where\path 'clang++-10' |
134 | | - ar_path: Where\path 'ar' |
135 | | - }, |
136 | | - '11': { |
137 | | - clang_path: Where\path 'clang++-11' |
138 | | - ar_path: Where\path 'ar' |
139 | | - }, |
140 | | - '12': { |
141 | | - clang_path: Where\path 'clang++-12' |
142 | | - ar_path: Where\path 'ar' |
143 | | - } |
144 | | - } |
145 | | - return binaries[tostring ver_major] or { } |
| 126 | +detect_compilers = (ver_major , log_file) -> |
| 127 | + versions = { '9', '10', '11', '12', '13' } |
| 128 | + results = { } |
| 129 | + |
| 130 | + ar_path = Where\path 'ar', log_file |
| 131 | + unless os.isfile ar_path |
| 132 | + return { } |
| 133 | + |
| 134 | + for ver in *versions |
| 135 | + clang_path = Where\path "clang++#{ver}", log_file |
| 136 | + if clang_path |
| 137 | + results[ver] = { |
| 138 | + :clang_path |
| 139 | + :ar_path |
| 140 | + } |
| 141 | + |
| 142 | + return results[ver_major] or { } |
146 | 143 |
|
147 | 144 | class Clang |
148 | | - @detect: (conan_profile) => |
| 145 | + @detect: (conan_profile, log_file) => |
149 | 146 | toolchain_list = { } |
150 | 147 |
|
151 | 148 | if conan_profile and conan_profile.compiler and conan_profile.compiler.version |
152 | 149 | ver_major = conan_profile.compiler.version |
153 | 150 |
|
154 | | - compiler = detect_compilers ver_major |
| 151 | + compiler = detect_compilers ver_major, log_file |
155 | 152 | if compiler.clang_path and compiler.ar_path |
156 | 153 |
|
157 | 154 | clang_exe = compiler.clang_path |
158 | | - clang_ver = (((Exec clang_exe)\lines '--version')[1]\gmatch "version (%d+.%d+.%d+)")! |
| 155 | + clang_ver = (((Exec clang_exe)\lines '--version')[1]\gmatch "version (%d+).(%d+).(%d+)")! |
| 156 | + |
| 157 | + unless clang_ver == ver_major |
| 158 | + return |
159 | 159 |
|
160 | 160 | if toolchain_definition = toolchain_definitions[clang_ver] |
161 | 161 | table.insert toolchain_list, { |
|
0 commit comments