You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libshit/tools/ci_conf.compiler.rb

46 lines
1.3 KiB
Ruby

def find_gnu_prefixed cmd
opt.triplet_machines.each do |m|
opt.triplet_vendors.each do |v|
opt.triplet_oses.each do |o|
full_cmd = m.dup
full_cmd << "-#{v}" unless v.empty?
full_cmd << "-#{o}" unless o.empty?
full_cmd << "-#{cmd}"
return full_cmd if which full_cmd
end
end
end
fail "Failed to find prefixed executable #{cmd.inspect}"
end
step :compiler_opts, after: :arch_opts, before: :final_opts do
case opt.compiler
when /^clang.*/
pfx = opt.clang_prefix ? "#{opt.clang_prefix}/bin/" : ''
env.AR = "#{pfx}llvm-ar"
env.AS = "#{pfx}clang"
env.CC = "#{pfx}clang"
env.CXX = "#{pfx}clang++"
env.LINKFLAGS.append '-fuse-ld=lld'
if opt.compiler == 'clang' # i.e. not clang_msvc
opt.config_opts.append '--all-bundled', '--with-stdlib=bundle-libc++'
target = %W(-target #{opt.triplet_machines[0]}-#{opt.triplet_vendors[0]}-#{opt.triplet_oses[0]})
env.ASFLAGS.concat target
opt.compile_flags.concat target
env.LINKFLAGS.concat target
end
when 'gcc'
ver = opt.os == 'vita' ? '' : "-#{opt.gcc_version}"
env.AR = find_gnu_prefixed 'gcc-ar'
env.AS = find_gnu_prefixed "gcc#{ver}"
env.CC = env.AS
env.CXX = find_gnu_prefixed "g++#{ver}"
else
fail "Unsupported compiler #{opt.compiler.inspect}"
end
end