ext/rays/extconf.rb in rays-0.1.2 vs ext/rays/extconf.rb in rays-0.1.3

- old
+ new

@@ -1,59 +1,69 @@ # -*- coding: utf-8 -*- -%w[../../../rucy/lib ../../lib].each do |path| +%w[. xot rucy].map {|s| "../../#{s}/lib"}.each do |path| $: << File.expand_path(File.join File.dirname(__FILE__), *path.split('/')) end require 'rubygems' require 'mkmf' +require 'xot/rake/helpers' +require 'xot/module' require 'rucy/module' require 'rays/module' +include Xot::Rake -DEBUG = ENV['DEBUG'] || false +DEBUG = env :DEBUG, false + DEFS = [] -INCDIRS = %w[/opt/local/include /opt/include] + - Rucy.include_dirs + Rays.include_dirs -LIBDIRS = %w[] + - Rucy.library_dirs + Rays.library_dirs +INCDIRS = %w[ + /opt/local/include + /opt/include +] +LIBDIRS = [] -HEADERS = %w[ - boost/scoped_array.hpp +HEADERS = %w[ boost/shared_ptr.hpp ruby.h + xot.h rucy.h rays.h ] -LIBS = %w[stdc++ rucy rays] -FRAMEWORKS = %w[] +LIBS = %w[ + stdc++ + xot + rucy + rays +] +FRAMEWORKS = [] DEFS << '_DEBUG' if DEBUG - -case RUBY_PLATFORM -when /mswin|ming|cygwin/ - DEFS << 'WINDOWS' << 'WIN32' << $~[0].upcase +DEFS << $~[0].upcase if RUBY_PLATFORM =~ /mswin|ming|cygwin|darwin/i +if win32? + DEFS << 'WINDOWS' << 'WIN32' LIBS.unshift 'gdi32', 'opengl32' -when /darwin/ +elsif cocoa? DEFS << 'COCOA' FRAMEWORKS << 'AppKit' << 'OpenGL' end $CPPFLAGS << DEFS.map {|s| " -D#{s}"}.join $CPPFLAGS << INCDIRS.map {|s| " -I#{s}"}.join $LDFLAGS << LIBDIRS.map {|s| " -L#{s}"}.join $LDFLAGS << FRAMEWORKS.map {|s| " -framework #{s}"}.join $LOCAL_LIBS << ' -lrucy' +Config::CONFIG.each {|key, val| val.gsub!(/gcc/, 'g++')} + + dir_config 'boost' +dir_config 'xot', Xot.root_dir dir_config 'rucy', Rucy.root_dir dir_config 'rays', Rays.root_dir - - -Config::CONFIG.each {|key, val| val.gsub!(/gcc/, 'g++')} exit 1 unless HEADERS.all? {|s| have_header(s)} exit 1 unless LIBS.all? {|s| have_library(s)}