@@ -2,6 +2,7 @@ require "Build"
22require " Utils"
33require " ../Helpers"
44
5+ local basedir = path .getdirectory (_PREMAKE_COMMAND )
56local llvm = path .getabsolute (basedir .. " /../deps/llvm" )
67
78-- Prevent premake from inserting /usr/lib64 search path on linux. GCC does not need this path specified
@@ -112,15 +113,19 @@ function get_llvm_package_name(rev, conf, arch)
112113 local toolset = get_toolset_configuration_name (arch )
113114 table.insert (components , toolset )
114115
115- if os .istarget (" linux" ) then
116- local version = GccVersion ()
117- if version < " 5.0.0" then
118- -- Minor version matters only with gcc 4.8/4.9
119- version = string.match (version , " %d+.%d+" )
120- else
121- version = string.match (version , " %d+" )
122- end
123- table.insert (components , " gcc-" .. version )
116+ if os .istarget (" linux" ) then
117+ if UseClang () then
118+ table.insert (components , " clang" )
119+ else
120+ local version = GccVersion ()
121+ if version < " 5.0.0" then
122+ -- Minor version matters only with gcc 4.8/4.9
123+ version = string.match (version , " %d+.%d+" )
124+ else
125+ version = string.match (version , " %d+" )
126+ end
127+ table.insert (components , " gcc-" .. version )
128+ end
124129 end
125130
126131 if not conf then
@@ -129,12 +134,6 @@ function get_llvm_package_name(rev, conf, arch)
129134
130135 table.insert (components , conf )
131136
132- if os .istarget (" linux" ) then
133- if GccVersion () >= " 4.9.0" and not UseCxx11ABI () then
134- table.insert (components , " no-cxx11" )
135- end
136- end
137-
138137 return table.concat (components , " -" )
139138end
140139
@@ -216,24 +215,24 @@ function cmake(gen, conf, builddir, options)
216215 if options == nil then
217216 options = " "
218217 end
219- if not UseCxx11ABI () then
220- options = options .. " -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'"
218+
219+ if UseClang () then
220+ local cmake = path .join (basedir , " scripts" , " ClangToolset.cmake" )
221+ options = options .. " -DLLVM_USE_LINKER=/usr/bin/ld.lld"
221222 end
222223
223224 local cmd = cmake .. " -G " .. ' "' .. gen .. ' "'
224225 .. ' -DCLANG_BUILD_TOOLS=false'
225- .. ' -DCLANG_INSTALL_SCANBUILD=false'
226- .. ' -DCLANG_INSTALL_SCANVIEW=false'
227226 .. ' -DCLANG_TOOL_CLANG_DIFF_BUILD=false'
228227 .. ' -DCLANG_TOOL_CLANG_FUNC_MAPPING_BUILD=false'
229228 .. ' -DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=false'
230229 .. ' -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=false'
231230 .. ' -DCLANG_TOOL_CLANG_REFACTOR_BUILD=false'
232231 .. ' -DCLANG_TOOL_CLANG_RENAME_BUILD=false'
233232 .. ' -DCLANG_TOOL_DRIVER_BUILD=false'
234- .. ' -DCLANG_TOOL_HANDLE_CXX_BUILD =false'
235- .. ' -DCLANG_TOOL_HANDLE_LLVM_BUILD=false '
236- .. ' -DLLVM_BUILD_TOOLS=false '
233+ .. ' -DLLVM_BUILD_TOOLS =false'
234+ .. ' -DLLVM_ENABLE_DUMP=true '
235+ .. ' -DLLVM_ENABLE_DUMP=true '
237236 .. ' -DLLVM_ENABLE_LIBEDIT=false'
238237 .. ' -DLLVM_ENABLE_ZLIB=false'
239238 .. ' -DLLVM_ENABLE_TERMINFO=false'
@@ -278,20 +277,17 @@ function cmake(gen, conf, builddir, options)
278277 .. ' -DLLVM_TOOL_LLVM_LINK_BUILD=false'
279278 .. ' -DLLVM_TOOL_LLVM_LTO_BUILD=false'
280279 .. ' -DLLVM_TOOL_LLVM_LTO2_BUILD=false'
281- .. ' -DLLVM_TOOL_LLVM_MCMARKUP_BUILD=false'
282280 .. ' -DLLVM_TOOL_LLVM_MC_ASSEMBLE_FUZZER_BUILD=false'
283281 .. ' -DLLVM_TOOL_LLVM_MC_BUILD=false'
284282 .. ' -DLLVM_TOOL_LLVM_MC_DISASSEMBLE_FUZZER_BUILD=false'
285283 .. ' -DLLVM_TOOL_LLVM_MCA_BUILD=false'
286- .. ' -DLLVM_TOOL_LLVM_MC_FUZZER_BUILD=false'
287284 .. ' -DLLVM_TOOL_LLVM_MODEXTRACT_BUILD=false'
288285 .. ' -DLLVM_TOOL_LLVM_MT_BUILD=false'
289286 .. ' -DLLVM_TOOL_LLVM_NM_BUILD=false'
290287 .. ' -DLLVM_TOOL_LLVM_OBJCOPY_BUILD=false'
291288 .. ' -DLLVM_TOOL_LLVM_OBJDUMP_BUILD=false'
292289 .. ' -DLLVM_TOOL_LLVM_OPT_FUZZER_BUILD=false'
293290 .. ' -DLLVM_TOOL_LLVM_OPT_REPORT_BUILD=false'
294- .. ' -DLLVM_TOOL_LLVM_PDBDUMP_BUILD=false'
295291 .. ' -DLLVM_TOOL_LLVM_PDBUTIL_BUILD=false'
296292 .. ' -DLLVM_TOOL_LLVM_PROFDATA_BUILD=false'
297293 .. ' -DLLVM_TOOL_LLVM_PDBUTIL_BUILD=false'
@@ -308,7 +304,6 @@ function cmake(gen, conf, builddir, options)
308304 .. ' -DLLVM_TOOL_LLVM_UNDNAME_BUILD=false'
309305 .. ' -DLLVM_TOOL_LLVM_XRAY_BUILD=false'
310306 .. ' -DLLVM_TOOL_LTO_BUILD=false'
311- .. ' -DLLVM_TOOL_MSBUILD_BUILD=false'
312307 .. ' -DLLVM_TOOL_OBJ2YAML_BUILD=false'
313308 .. ' -DLLVM_TOOL_OPT_BUILD=false'
314309 .. ' -DLLVM_TOOL_OPT_VIEWER_BUILD=false'
0 commit comments