Add clang compiler option

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
José Martínez 2011-06-16 16:42:15 +02:00 committed by Adam Vandenberg
parent ea35d749af
commit 2763fc6f5a
2 changed files with 7 additions and 2 deletions

View File

@ -9,8 +9,9 @@ module Homebrew extend self
end end
def dump_build_env env def dump_build_env env
puts %["--use-clang" was specified] if ARGV.include? '--use-clang'
puts %["--use-llvm" was specified] if ARGV.include? '--use-llvm' puts %["--use-llvm" was specified] if ARGV.include? '--use-llvm'
puts "\"--use-gcc\" was specified" if ARGV.include? '--use-gcc' puts %["--use-gcc" was specified] if ARGV.include? '--use-gcc'
%w[ CC CXX LD ].each do |k| %w[ CC CXX LD ].each do |k|
value = env[k] value = env[k]

View File

@ -18,7 +18,11 @@ module HomebrewEnvExtension
self['CMAKE_PREFIX_PATH'] = "#{HOMEBREW_PREFIX}" self['CMAKE_PREFIX_PATH'] = "#{HOMEBREW_PREFIX}"
end end
if MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm') if MACOS_VERSION >= 10.6 and ARGV.include? '--use-clang'
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/clang"
self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/clang++"
cflags = ['-O3'] # -O4 makes the linker fail on some formulae
elsif MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm')
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-gcc" self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-gcc"
self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-g++" self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-g++"
cflags = ['-O4'] # link time optimisation baby! cflags = ['-O4'] # link time optimisation baby!