libshit

Just some random shit
git clone https://git.neptards.moe/neptards/libshit.git
Log | Files | Refs | Submodules | README | LICENSE

ci_conf.compiler.rb (1357B)


      1 def find_gnu_prefixed cmd
      2   opt.triplet_machines.each do |m|
      3     opt.triplet_vendors.each do |v|
      4       opt.triplet_oses.each do |o|
      5         full_cmd = m.dup
      6         full_cmd << "-#{v}" unless v.empty?
      7         full_cmd << "-#{o}" unless o.empty?
      8         full_cmd << "-#{cmd}"
      9         return full_cmd if which full_cmd
     10       end
     11     end
     12   end
     13   fail "Failed to find prefixed executable #{cmd.inspect}"
     14 end
     15 
     16 step :compiler_opts, after: :arch_opts, before: :final_opts do
     17   case opt.compiler
     18   when /^clang.*/
     19     pfx = opt.clang_prefix ? "#{opt.clang_prefix}/bin/" : ''
     20     env.AR = "#{pfx}llvm-ar"
     21     env.AS = "#{pfx}clang"
     22     env.CC = "#{pfx}clang"
     23     env.CXX = "#{pfx}clang++"
     24 
     25     env.LINKFLAGS.append '-fuse-ld=lld'
     26 
     27     if opt.compiler == 'clang' # i.e. not clang_msvc
     28       opt.config_opts.append '--all-bundled', '--with-stdlib=bundle-libc++'
     29       target = %W(-target #{opt.triplet_machines[0]}-#{opt.triplet_vendors[0]}-#{opt.triplet_oses[0]})
     30       env.ASFLAGS.concat target
     31       opt.compile_flags.concat target
     32       env.LINKFLAGS.concat target
     33     end
     34 
     35   when 'gcc'
     36     ver = opt.os == 'vita' ? '' : "-#{opt.gcc_version}"
     37     env.AR = find_gnu_prefixed 'gcc-ar'
     38     env.AS = find_gnu_prefixed "gcc#{ver}"
     39     env.CC = env.AS
     40     env.CXX = find_gnu_prefixed "g++#{ver}"
     41 
     42   else
     43     fail "Unsupported compiler #{opt.compiler.inspect}"
     44   end
     45 end