Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ Simply do the following, after installing MATLAB:
* ruby setup.rb setup
* ruby setup.rb install

If you are using OSX please make sure your Matlab paths are the same as the ones in the ext/matlab_api/extconf.rb file and add the following two lines to your ~/.bash_profile file:

export PATH=/Applications/MATLAB_R2012a.app/bin:$PATH
export DYLD_LIBRARY_PATH=/Applications/MATLAB_R2012a.app/bin/maci64:$DYLD_LIBRARY_PATH

Alternatively, you can download and install the RubyGem package for
matlab-ruby (you must have RubyGems and MATLAB installed, first):

Expand Down
21 changes: 19 additions & 2 deletions ext/matlab_api/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@

SWIG_WRAP = "matlab_api_wrap.c"

matlab_dirs = dir_config( "matlab", "/usr/local/matlab/extern/include", "/usr/local/matlab/bin/glnx86" )
case RbConfig::CONFIG['host_os']
when /mswin|windows/
# Windows - Who cares
when /linux|arch/
if RbConfig::CONFIG['host_cpu'] =~ /x86_64/
matlab_dirs = dir_config( "matlab", "/usr/local/matlab/extern/include", "/usr/local/matlab/bin/glnxa64" )
else
matlab_dirs = dir_config( "matlab", "/usr/local/matlab/extern/include", "/usr/local/matlab/bin/glnx86" )
end
when /darwin/
if RbConfig::CONFIG['host_cpu'] =~ /x86_64/
matlab_dirs = dir_config( "/Applications/MATLAB_R2012a.app/bin/matlab", "/Applications/MATLAB_R2012a.app/extern/include", "/Applications/MATLAB_R2012a.app/bin/maci64" )
else
matlab_dirs = dir_config( "/Applications/MATLAB_R2012a.app/bin/matlab", "/Applications/MATLAB_R2012a.app/extern/include", "/Applications/MATLAB_R2012a.app/bin/maci" )
end
else
puts "Architecture Not Found, Please edit PATH variable in extconf.rb"
end

if have_header( "engine.h" ) && have_library( "eng", "engOpen" )
if have_header( "engine.h" ) && have_library( "eng", "engOpen" )
if !File.exists?( SWIG_WRAP ) || with_config( "swig", false )
swig_includes = (matlab_dirs.any? ? (matlab_dirs.collect { |dir| "-I#{dir}" }.join(" ")) : nil)
puts "creating #{SWIG_WRAP}"
Expand Down
4 changes: 2 additions & 2 deletions setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def multipackage_install?

class ConfigTable

c = ::Config::CONFIG
c = RbConfig::CONFIG

rubypath = c['bindir'] + '/' + c['ruby_install_name']

Expand Down Expand Up @@ -1219,7 +1219,7 @@ def ruby_extentions(dir)
raise InstallError, "no ruby extention exists: 'ruby #{$0} setup' first"
end

DLEXT = /\.#{ ::Config::CONFIG['DLEXT'] }\z/
DLEXT = /\.#{ RbConfig::CONFIG['DLEXT'] }\z/

def _ruby_extentions(dir)
Dir.open(dir) {|d|
Expand Down