ext/rays/extconf.rb in rays-0.1.6 vs ext/rays/extconf.rb in rays-0.1.7
- old
+ new
@@ -1,75 +1,26 @@
# -*- coding: utf-8 -*-
-require 'xot/load_path'
-Xot::LoadPath.unshift File.expand_path('../../../lib', __FILE__)
+%w[../xot ../rucy .]
+ .map {|s| File.expand_path "../../../#{s}/lib", __FILE__}
+ .each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
require 'mkmf'
-require 'xot/rake'
+require 'xot/extconf'
require 'xot/module'
require 'rucy/module'
require 'rays/module'
-include Xot::Rake
+Xot::ExtConf.new Xot, Rucy, Rays do
+ setup do
+ headers << 'boost/noncopyable.hpp' << 'ruby.h'
+ local_libs << 'rucy'
+ libs.unshift 'gdi21', 'opengl32' if win32?
+ frameworks << 'AppKit' << 'OpenGL' if osx?
+ $LDFLAGS << ' -Wl,--out-implib=native.dll.a' if cygwin?
+ end
-debug = env :DEBUG, false
-
-
-DEFS = []
-INCDIRS = %w[
- /opt/local/include
- /opt/include
-]
-LIBDIRS = []
-
-HEADERS = %w[
- boost/shared_ptr.hpp
- ruby.h
- xot.h
- rucy.h
- rays.h
-]
-LIBS = %w[
- stdc++
- xot
- rucy
- rays
-]
-FRAMEWORKS = []
-
-
-DEFS << '_DEBUG' if debug
-DEFS << 'NDEBUG' unless debug
-DEFS << $~[0].upcase if RUBY_PLATFORM =~ /mswin|ming|cygwin|darwin/i
-if win32?
- DEFS << 'WINDOWS' << 'WIN32'
- LIBS.unshift 'gdi32', 'opengl32'
-elsif cocoa?
- DEFS << 'COCOA'
- FRAMEWORKS << 'AppKit' << 'OpenGL'
+ dir_config 'boost'
+ create_makefile 'rays/native'
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
-$LDFLAGS << ' -Wl,--out-implib=native.dll.a' if cygwin?
-$CFLAGS << ' --stdlib=libc++' if clang?
-$LOCAL_LIBS << ' -lrucy'
-
-RbConfig::CONFIG.each do |key, val|
- {'gcc' => 'g++', 'clang' => 'clang++'}.each {|from, to| val.gsub! from, to}
-end
-
-
-dir_config 'boost'
-dir_config 'xot', Xot.root_dir
-dir_config 'rucy', Rucy.root_dir
-dir_config 'rays', Rays.root_dir
-
-exit 1 unless HEADERS.all? {|s| have_header(s)}
-exit 1 unless LIBS.all? {|s| have_library(s)}
-
-
-create_makefile 'rays/native'