Skip to content

Commit

Permalink
Fixing build for Ruby 2.0 bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
axelstudios committed Dec 20, 2013
1 parent fc8b45b commit 31bd0f0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
10 changes: 9 additions & 1 deletion openstudiocore/src/utilities/core/ApplicationPathHelpers.cxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,15 @@ openstudio::path getOpenStudioEmbeddedRubyPath() {
#ifdef Q_OS_WIN32
if (applicationIsRunningFromBuildDirectory())
{
return getApplicationBuildDirectory() / openstudio::toPath("ruby-install/ruby");
//Ruby 2.0 x64
openstudio::path embeddedRubyPath = getApplicationBuildDirectory().parent_path().parent_path().parent_path() / openstudio::toPath("Ruby-prefix/src/Ruby-install");

if (!boost::filesystem::exists(embeddedRubyPath)) {
//Ruby 2.0 x86 and Ruby 1.8.6
embeddedRubyPath = getApplicationBuildDirectory().parent_path().parent_path().parent_path() / openstudio::toPath("Ruby-prefix/src/Ruby");
}

return embeddedRubyPath;
} else {
return getApplicationRunDirectory().parent_path() / openstudio::toPath("ruby-install/ruby");
}
Expand Down
28 changes: 27 additions & 1 deletion openstudiocore/src/utilities/core/RubyInterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,39 +587,65 @@ namespace openstudio

if (!rubypath.empty())
{
// Not defined for 1.8.6
#ifdef RUBY_SEARCH_PATH
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SEARCH_PATH))).external_file_string()).c_str());
#endif


// 1.8.6: /lib/ruby/site_ruby/1.8
#ifdef RUBY_SITE_LIB2
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_LIB2))).external_file_string()).c_str());
#endif

// Not defined for 1.8.6
#ifdef RUBY_SITE_THIN_ARCHLIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_THIN_ARCHLIB))).external_file_string()).c_str());
#endif

// 1.8.6 Win: /lib/ruby/site_ruby/1.8/i386-msvcrt
#ifdef RUBY_SITE_ARCHLIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_ARCHLIB))).external_file_string()).c_str());
#endif

// 1.8.6: /lib/ruby/site_ruby
#ifdef RUBY_SITE_LIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_LIB))).external_file_string()).c_str());
#endif

// Not defined for 1.8.6
#ifdef RUBY_VENDOR_LIB2
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_LIB2))).external_file_string()).c_str());
#endif

// Not defined for 1.8.6
#ifdef RUBY_VENDOR_THIN_ARCHLIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_THIN_ARCHLIB))).external_file_string()).c_str());
#endif

// Not defined for 1.8.6
#ifdef RUBY_VENDOR_ARCHLIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_ARCHLIB))).external_file_string()).c_str());
#endif

// Not defined for 1.8.6
#ifdef RUBY_VENDOR_LIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_LIB))).external_file_string()).c_str());
#endif

// 1.8.6: /lib/ruby/1.8
#ifdef RUBY_LIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_LIB))).external_file_string()).c_str());
#endif

// Not defined for 1.8.6
#ifdef RUBY_THIN_ARCHLIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_THIN_ARCHLIB))).external_file_string()).c_str());
#endif

// 1.8.6 Win: /lib/ruby/1.8/i386-mswin32
#ifdef RUBY_ARCHLIB
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_ARCHLIB))).external_file_string()).c_str());
#endif
}

ruby_init_loadpath();
Expand Down

0 comments on commit 31bd0f0

Please sign in to comment.