Skip to content
Browse files

Added cpp plus failure test into sample_files test suite

git-svn-id: http://mkrf.rubyforge.org/svn/trunk@60 6e48df83-f314-0410-b1e7-e69642b30866
  • Loading branch information...
1 parent e6cb2bc commit b71095cba2c454c7f3ba580371a3f751dcad43b2 hoanga committed Jul 17, 2007
Showing with 30 additions and 3 deletions.
  1. +8 −2 Rakefile
  2. +1 −1 lib/mkrf.rb
  3. +15 −0 test/sample_files/cpp_bang/ext/bang.cpp
  4. +6 −0 test/sample_files/cpp_bang/ext/mkrf_config.rb
View
10 Rakefile
@@ -43,13 +43,14 @@ namespace :test do
SAMPLE_DIRS = {
:trivial => BASE_DIR + '/libtrivial/ext/',
:syck => BASE_DIR + '/syck-0.55/ext/ruby/ext/syck/',
- :libxml => BASE_DIR + '/libxml-ruby-0.3.8/ext/xml/'
+ :libxml => BASE_DIR + '/libxml-ruby-0.3.8/ext/xml/',
+ :cpp_bang => BASE_DIR + '/cpp_bang/ext/'
}
task :default => [:all]
desc "Try to compile all of the sample extensions"
- task :all => [:trivial, :libxml, :syck]
+ task :all => [:trivial, :libxml, :syck, :cpp_bang]
desc "Try to compile a trivial extension"
task :trivial do
@@ -66,6 +67,11 @@ namespace :test do
sh "cd #{SAMPLE_DIRS[:syck]}; ruby extconf.rb; rake"
end
+ desc "Try to compile cpp_bang"
+ task :cpp_bang do
+ sh "cd #{SAMPLE_DIRS[:cpp_bang]}; ruby mkrf_config.rb; rake"
+ end
+
desc "Clean up after sample tests"
task :clobber do
if ENV['PROJECT']
View
2 lib/mkrf.rb
@@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/mkrf/availability'
require File.dirname(__FILE__) + '/mkrf/generator'
-Mkrf::VERSION = "0.2.1"
+Mkrf::VERSION = "0.2.2"
View
15 test/sample_files/cpp_bang/ext/bang.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+#include <ruby.h>
+
+VALUE rk_mBang;
+
+static VALUE t_bang(VALUE self) {
+ return rb_str_new2("Bang !");
+}
+
+extern "C" void Init_bang() {
+ // define the class 'Hello'
+ rk_mBang = rb_define_module("Bang");
+ rb_define_singleton_method(rk_mBang, "bang", (VALUE(*)(...))t_bang, 0);
+}
+
View
6 test/sample_files/cpp_bang/ext/mkrf_config.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+require 'mkrf'
+
+Mkrf::Generator.new('bang', ["*.cpp"]) do |g|
+ g.ldshared << ' -L/usr/lib -lgcc -lstdc++'
+end

0 comments on commit b71095c

Please sign in to comment.
Something went wrong with that request. Please try again.