Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
add use_default_cc_compiler methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Mar 26, 2016
1 parent 72574a7 commit 45e93e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions gem.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'mkmf-cu'
s.version = '0.1.1'
s.date = '2016-02-24'
s.version = '0.1.2.pre2'
s.date = '2016-03-26'
s.summary = "Write Ruby extension in C/C++ with NVIDIA CUDA."
s.description =
"Write Ruby extension in C/C++ with NVIDIA CUDA. A simple wrapper command for nvcc and a monkey patch for mkmf."
Expand Down
14 changes: 12 additions & 2 deletions lib/mkmf-cu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@
MakeMakefile::C_EXT << "cu"
MakeMakefile::SRC_EXT << "cu"

def compile_cu_with_cxx_compiler
def treat_cu_as_cxx
MakeMakefile::C_EXT.delete("cu")
MakeMakefile::CXX_EXT << "cu"
end

def compile_cu_with_cc_compiler
def treat_cu_as_cc
MakeMakefile::CXX_EXT.delete("cu")
MakeMakefile::C_EXT << "cu"
end

def use_default_cc_compiler
MakeMakefile::CONFIG["CC"] = RbConfig::CONFIG["CC"]
MakeMakefile::C_EXT.delete("cu")
end

def use_default_cxx_compiler
MakeMakefile::CONFIG["CXX"] = RbConfig::CONFIG["CXX"]
MakeMakefile::CXX_EXT.delete("cu")
end
2 changes: 1 addition & 1 deletion test/test_mkmf-cu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_mkmf_cu
assert MakeMakefile::C_EXT.include?("cu")
assert MakeMakefile::SRC_EXT.include?("cu")

compile_cu_with_cxx_compiler()
treat_cu_as_cxx()
assert !MakeMakefile::C_EXT.include?("cu")
assert MakeMakefile::CXX_EXT.include?("cu")
end
Expand Down

0 comments on commit 45e93e7

Please sign in to comment.