Skip to content

Commit 31bd0f0

Browse files
committed
Fixing build for Ruby 2.0 bindings
1 parent fc8b45b commit 31bd0f0

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

openstudiocore/src/utilities/core/ApplicationPathHelpers.cxx.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,15 @@ openstudio::path getOpenStudioEmbeddedRubyPath() {
369369
#ifdef Q_OS_WIN32
370370
if (applicationIsRunningFromBuildDirectory())
371371
{
372-
return getApplicationBuildDirectory() / openstudio::toPath("ruby-install/ruby");
372+
//Ruby 2.0 x64
373+
openstudio::path embeddedRubyPath = getApplicationBuildDirectory().parent_path().parent_path().parent_path() / openstudio::toPath("Ruby-prefix/src/Ruby-install");
374+
375+
if (!boost::filesystem::exists(embeddedRubyPath)) {
376+
//Ruby 2.0 x86 and Ruby 1.8.6
377+
embeddedRubyPath = getApplicationBuildDirectory().parent_path().parent_path().parent_path() / openstudio::toPath("Ruby-prefix/src/Ruby");
378+
}
379+
380+
return embeddedRubyPath;
373381
} else {
374382
return getApplicationRunDirectory().parent_path() / openstudio::toPath("ruby-install/ruby");
375383
}

openstudiocore/src/utilities/core/RubyInterpreter.hpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,39 +587,65 @@ namespace openstudio
587587

588588
if (!rubypath.empty())
589589
{
590+
// Not defined for 1.8.6
590591
#ifdef RUBY_SEARCH_PATH
591592
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SEARCH_PATH))).external_file_string()).c_str());
592593
#endif
593-
594+
595+
// 1.8.6: /lib/ruby/site_ruby/1.8
596+
#ifdef RUBY_SITE_LIB2
594597
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_LIB2))).external_file_string()).c_str());
598+
#endif
599+
600+
// Not defined for 1.8.6
595601
#ifdef RUBY_SITE_THIN_ARCHLIB
596602
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_THIN_ARCHLIB))).external_file_string()).c_str());
597603
#endif
604+
605+
// 1.8.6 Win: /lib/ruby/site_ruby/1.8/i386-msvcrt
606+
#ifdef RUBY_SITE_ARCHLIB
598607
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_ARCHLIB))).external_file_string()).c_str());
608+
#endif
609+
610+
// 1.8.6: /lib/ruby/site_ruby
611+
#ifdef RUBY_SITE_LIB
599612
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_SITE_LIB))).external_file_string()).c_str());
613+
#endif
600614

615+
// Not defined for 1.8.6
601616
#ifdef RUBY_VENDOR_LIB2
602617
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_LIB2))).external_file_string()).c_str());
603618
#endif
604619

620+
// Not defined for 1.8.6
605621
#ifdef RUBY_VENDOR_THIN_ARCHLIB
606622
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_THIN_ARCHLIB))).external_file_string()).c_str());
607623
#endif
608624

625+
// Not defined for 1.8.6
609626
#ifdef RUBY_VENDOR_ARCHLIB
610627
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_ARCHLIB))).external_file_string()).c_str());
611628
#endif
612629

630+
// Not defined for 1.8.6
613631
#ifdef RUBY_VENDOR_LIB
614632
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_VENDOR_LIB))).external_file_string()).c_str());
615633
#endif
616634

635+
// 1.8.6: /lib/ruby/1.8
636+
#ifdef RUBY_LIB
617637
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_LIB))).external_file_string()).c_str());
638+
#endif
618639

640+
// Not defined for 1.8.6
619641
#ifdef RUBY_THIN_ARCHLIB
620642
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_THIN_ARCHLIB))).external_file_string()).c_str());
621643
#endif
644+
645+
// 1.8.6 Win: /lib/ruby/1.8/i386-mswin32
646+
#ifdef RUBY_ARCHLIB
622647
ruby_incpush(openstudio::toString(((rubypath / openstudio::toPath(RUBY_ARCHLIB))).external_file_string()).c_str());
648+
#endif
623649
}
624650

625651
ruby_init_loadpath();

0 commit comments

Comments
 (0)